Compare commits

...

1713 Commits

Author SHA1 Message Date
WerWolv
f517dc9829 Merge branch 'master' into feature/clipboard_improvements 2025-05-29 20:27:10 +02:00
WerWolv
fe1309fb3d build: Don't link against llvm demangle in external builds 2025-05-29 20:27:03 +02:00
WerWolv
0ea3adcb75 Merge branch 'master' into feature/clipboard_improvements 2025-05-29 20:01:25 +02:00
WerWolv
12d59ce3e4 fix: Bad copy paste 2025-05-29 20:01:17 +02:00
WerWolv
96ef758bbd impr: Added clip library to improve clipboard situation 2025-05-29 19:56:46 +02:00
WerWolv
224fa83c65 fix: Missing <span> include 2025-05-29 19:55:59 +02:00
WerWolv
f591ac8780 fix: UDP Port not being updated correctly when loading provider from recents file 2025-05-29 18:26:07 +02:00
WerWolv
11e70511e6 build: Fix plugin SDK issues 2025-05-29 18:19:20 +02:00
WerWolv
c1e4121d1e build: Updated Windows resource copyright year 2025-05-29 18:00:41 +02:00
WerWolv
03884ddd05 feat: Added simple UDP Data Provider 2025-05-29 18:00:29 +02:00
WerWolv
ac67e985af build: Make tracing library a static library 2025-05-29 14:02:06 +02:00
WerWolv
9d12cd64d3 impr: Add full resolution Windows icon 2025-05-29 13:53:57 +02:00
paxcut
702b5f2888 fix: Problems with textures in 3d visualizer with bitmap visualizer. (#2167)
The bitmap visualizer has been simplified considerably. The previous version was designed to work with the TIM format which has some peculiarities that are not general enough. The current implementation has the following specifications.

. Whether colors are in a lookup table or part of the image itself they are always 32 bit R8G8B8A8.

. If using a color LUT the image then has indices as its element. Indices can have 16(32000 colors), 8 (256 colors) or 4(16 colors) bits each.

.For the cases 0f 16 and 8 bits, the data should be an array of N*M elements of the given size where N is the number of rows and M is the number of columns of the image.

. For the 4 bit case use an array of N*M/2 bytes so that each column contains two indices.

ToDo: Documentation, sample patterns and unit tests.

The 3-d visualizer can now handle textures from both the command line or the user interface and things should work as expected. A command line entry will be automatically displayed in the user interface, but changes will be applied immediately as you type or use the file picker. If the user interface text is deleted, then the command line texture will be used again.  If a texture is invalid for any reason, then the previous one, if any, will be still in use and an error message will be displayed until the problem is cleared. Valid textures are image files that the stb library can open.
2025-05-27 09:25:20 -07:00
WerWolv
a5eef3f34d build: Fix more linker errors 2025-05-26 21:57:27 +02:00
WerWolv
1bc9277e3c build: Fix undefined references 2025-05-26 20:25:35 +02:00
WerWolv
b33cb07dc0 build: Include tracing library in plugin SDK 2025-05-26 20:19:27 +02:00
WerWolv
ce74915c14 feat: Add full exception tracing support 2025-05-26 20:15:20 +02:00
WerWolv
f341413248 fix: Crash when opening diff view
#2269
2025-05-26 18:34:00 +02:00
WerWolv
ed3e2f65f8 impr: Set default font size to 12pt 2025-05-25 23:32:43 +02:00
WerWolv
6e5878b5d6 fix: OOBE logo background color 2025-05-25 23:29:01 +02:00
WerWolv
39242097dd fix: --reset-settings not working due to superfluous null bytes in string 2025-05-25 23:23:51 +02:00
WerWolv
0aec3fffe1 fix: Unused lambda captures 2025-05-25 22:21:40 +02:00
WerWolv
38ef00548a impr: Speed up Import Pattern popup
Closes #2264
2025-05-25 21:08:52 +02:00
WerWolv
c78c8072e9 fix: Text Editor Scrollbars being added multiple times 2025-05-25 20:35:03 +02:00
WerWolv
7c98411abe fix: Tutorial highlighting of menu item 2025-05-25 18:21:26 +02:00
WerWolv
e22516662f patterns: Updated pattern language 2025-05-25 18:21:03 +02:00
WerWolv
24c1f48522 build: Updated lunasvg and libyara 2025-05-25 15:32:43 +02:00
WerWolv
69b07d40e4 build: Updated ImGui to v1.91.9b 2025-05-25 15:30:33 +02:00
WerWolv
b96692b1ba fix: Global scale race condition during font loading 2025-05-25 15:11:09 +02:00
WerWolv
53afb7cba0 git: Add Ubuntu 25.04 release 2025-05-25 14:09:56 +02:00
WerWolv
8e0953af1e git: Only put the current web assembly build into the release artifact 2025-05-25 13:46:57 +02:00
WerWolv
724f9aa524 git: Deploy both latest release and nightly to web.imhex.werwolv.net 2025-05-25 13:43:06 +02:00
WerWolv
7067ffafe7 patterns: Display pattern errors in red in the pattern data view 2025-05-25 11:46:41 +02:00
WerWolv
145c88db31 patterns: Updated pattern language
Fixes #2266
2025-05-25 11:00:59 +02:00
paxcut
56615d6c06 patterns: Updated pattern language (#2270) 2025-05-24 16:44:59 -07:00
WerWolv
d26bcc1abe fix: Menu bar being gone on the Web build 2025-05-24 23:10:53 +02:00
WerWolv
04f817c042 fix: Web Assembly build 2025-05-24 22:45:17 +02:00
WerWolv
b58f97c1f1 impr: Added function to Texture class to retrieve raw image from GPU 2025-05-24 22:32:56 +02:00
WerWolv
96dc386694 fix: Linux build errors 2025-05-24 22:32:33 +02:00
WerWolv
c6c70daa5e fix: macOS build errors 2025-05-24 22:32:24 +02:00
WerWolv
de16375903 impr: Slightly simplify subpixel rendering logic and required ImGui patches 2025-05-24 22:32:08 +02:00
WerWolv
c6548d5ad1 fix: Non-subpixel rendered glyphs appearing as white rectangles if subpixel rendering is enabled 2025-05-24 21:59:21 +02:00
WerWolv
bd8c4e807c fix: Remove extra pixel from Hex Editor selection frame 2025-05-24 16:19:13 +02:00
WerWolv
553549302c impr: Use linear scaling for the windows title bar icon 2025-05-24 16:18:59 +02:00
WerWolv
c69a7012c5 fix: Unifont glyphs being rendered too far down 2025-05-24 16:09:15 +02:00
WerWolv
7acc5fc02e impr: Make title bar backdrop actually a backdrop and not an overlay 2025-05-24 11:57:02 +02:00
WerWolv
39bc165f36 build: Prevent frame pointer omission to improve stack traces 2025-05-24 11:56:44 +02:00
WerWolv
707a92281b fix: Multithreaded disk access issues 2025-05-24 11:48:07 +02:00
WerWolv
823013a3d9 fix: Fonts being smaller than their set size value 2025-05-24 11:47:46 +02:00
WerWolv
7089561b21 git: Remove accidentally committed file 2025-05-19 00:01:23 +02:00
WerWolv
0f0bff1685 fix: Remaining Subpixel rendering issues 2025-05-19 00:00:32 +02:00
WerWolv
b6387c3f64 fix: Crash when loading subpixel font didn't work 2025-05-18 11:10:43 +02:00
paxcut
ff0bcfb7da fix: More per-provider data access errors (#2256) 2025-05-17 21:48:36 -07:00
Stephen Hewitt
f729d36214 fix: Crash when sorting for value fields in pattern data view, fix HTML export encoding (#2242)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
This is a fix for the ImHex bug "ImHex crashes when analysing any PE
file #2221"

### Implementation description
This is a fix for the ImHex bug "ImHex crashes when analysing any PE
file #2221". The fix requires changes to the Pattern Language and the
ImHex UI. Revision would be wise. We want to avoid collateral damage.
It's a big code base and I'm new to it and the compilers/build-systems
used. And the bug is complex and low-level. I suspect this will fix
other random crashes. The problem is caused by two issues:
- The std::sort algorithm conjuring up garbage due to the sorting
criteria not being a strict weak ordering. See
[this](https://github.com/Voultapher/sort-research-rs/blob/main/writeup/sort_safety/text.md)
link.
- We sort shared_ptr&lt;ptrn::Pattern&gt; by pointer value, and the
object is a clone. In essence we're changing the values as we're
sorting.
 
Fixes #2221

### IMPORTANT
I'm not sure how "plugins/builtin/source/content/data_formatters.cpp"
got into the PR. Been trying for an hour to rectify. I'm not a Git
expert (the last time I used source control seriously SourceSafe was a
thing) please ignore that file. It's a fix for another PR I submitted. I
suspect I stuffed up the branching and merging.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2025-05-17 20:50:21 +00:00
WerWolv
d5a07b6a5b patterns: Updated pattern language 2025-05-17 22:20:05 +02:00
WerWolv
bda0b3ce18 fix: More per-provider data access errors 2025-05-17 22:14:27 +02:00
WerWolv
14d95a7e46 patterns: Updated pattern language 2025-05-17 20:31:38 +02:00
WerWolv
2ef2cdd874 fix: Make sure PerProvider don't get accessed using a nullptr provider 2025-05-17 20:29:54 +02:00
paxcut
57c2d84122 improv: made the text editors to be per provider. (#2255)
The recent update that made importing patterns undoable had the side
effect of undoing tab changes as well. When working on a fix for that it
became clear that the undo/redo stacks were being shared by all
providers so that you could undo changes done in a separate file. The
problem was fixed by making the text editors (and the console editors as
well) to be per provider which gives better control on things like
breakpoints and selections and a more robust focusing system that
preserves the cursor positions and removes the need to click on a
pattern to start editing. There are a lot of changes, but they are
mostly all the uses of text editors being now coded differently to
manage the providers. File imports are still undoable, but switching
providers is not.
Further changes suggested by reviewer were implemented namely a mull provider was being used and there was a get function missing which prevented the use of the preferred syntax.
2025-05-17 11:26:54 -07:00
paxcut
d263962a06 fix: horizontal scrollbar missing in console (#2253)
The recent changes to the text editor to fix the longest line length
problems broke the console horizontal scrollbar. The code that displays
the console editor was more complicated that it needed be, and it had
the bad side effect of resetting the cursor which prevented horizontal
scrolling. Adding a function that appends lines to the text editor fixes
all problems and makes the code clearer. To accommodate for strings
containing zeros, the code that inserts text was changed to print a '.'
when zeros are encountered thus keeping the line length the same.
2025-05-17 00:23:43 -07:00
WerWolv
e32c5784af impr: Further refine pattern tree indenting 2025-05-16 20:24:38 +02:00
WerWolv
1496a6e755 impr: Improve indentation of pattern data tree
#2252
2025-05-16 18:50:35 +02:00
WerWolv
6dab1063a1 fix: Provider getting marked as dirty immediately on load
#2251
2025-05-16 18:50:03 +02:00
paxcut
ff286f3e05 fix: subpixel effects on hex editor. (#2247)
The implementation of subpixel rendering using draw call lists with
callbacks prevents call list merging and their associated clip rects in
tables. As a result clip rects become as narrow as the columns of the
table which can clip previously renderable primitives. The hex editor
has several draw calls that render outside their column so if subpixel
rendering is selected those primitives cease to be displayed.

To fix this issue, and to verify that this was indeed the cause behind
the issue, we simply push an adequately sized clip rect before the draw
call command and pop it right after.

A problem with segment vertical separators not being rendered in the
first tow was also fixed.
2025-05-16 01:31:29 -07:00
WerWolv
6f112c2d16 feat: Added custom encoding row to data inspector 2025-05-15 22:00:43 +02:00
paxcut
8f222dab99 fix: unable to display models if indices are not contiguous in the input file (#2248)
If you tried to collect the indices using addressof like stl pattern
collects vertices you get a small square for visualizer and no error
message. The changes here are able to extract the indices if they can be
extracted and give an error message if they can't.
2025-05-14 22:08:16 -07:00
paxcut
828951ffe9 build: msvc uninitialized variables. (#2239)
MSVC build failing because of a warning treated as an error for
variables being used without initializing even though they are being
passed as references.
2025-05-12 01:58:10 -07:00
WerWolv
616f34e210 fix: Window being created partially off-screen if monitor is too small
Fixes #2238
2025-05-11 23:54:58 +02:00
WerWolv
fa3ed7e618 impr: Load all unicode planes if requested 2025-05-11 23:26:27 +02:00
WerWolv
a207969dec fix: Unicode enable option not working correctly 2025-05-11 23:07:52 +02:00
WerWolv
7fde40b04e impr: Allow for higher planes of unicode characters to be recognized
#2237
2025-05-11 23:07:27 +02:00
WerWolv
1bce588cdd impr: Make sure settings descriptions are always visible 2025-05-11 18:11:28 +02:00
WerWolv
5a095cc993 fix: Icon scaling when using pixel perfect font 2025-05-11 17:42:36 +02:00
WerWolv
431eab47a2 git: Remove Fedora 40 support, add Fedora 42 support 2025-05-11 17:25:20 +02:00
WerWolv
e9e3d25315 fix: Rendering on macOS being broken 2025-05-11 17:18:43 +02:00
WerWolv
e2735e283e fix: Text not rendering at all on the Web version 2025-05-11 17:07:19 +02:00
WerWolv
3e9cb57dd6 fix: Grayscale antialiasing not blending correctly 2025-05-11 17:07:03 +02:00
paxcut
5c4cf7379f feat: Added Subpixel Font rendering (#2092)
Proof of concept for implementing subpixel processing in ImGui. This is
work in progress, and it is bound to have problems.

What it does:
1) Uses freetype own subpixel processing implementation to build a
32-bit color atlas for the default font only (no icons, no unifont) . 2)
Avoids pixel perfect font conversion when possible. 3) Self contained,
no ImGui source code changes.
4) Results in much improved legibility of fonts rendered on low dpi LCD
screens that use horizontal RGB pixel layouts (no BRG or OLED or CRT if
they even exist anymore)

What it doesn't:
1) Fancy class based interface. The code is barely the minimum needed to
show it can work. 2) Dual source color blending. That needs to be
implemented in shader code, so it needs to change ImGui source code
although minimally. This will result in some characters appearing dimmer
than others. Easily fixed with small fragment and vertex shaders. 3)
subpixel positioning. If characters are very thin they will look
colored, or they can be moved to improve legibility. 4) deal with
detection of fringe cases including rare pixel layouts, non LCD screens,
Mac-OS not handling subpixel rendering and any other deviation from the
standard LCD. 5) tries to be efficient in speed or memory use. Font
Atlases will be 4 times the size they were before, but there are no
noticeable delays in font loading in the examples I have tried.

Any comments and code improvements are welcome.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2025-05-11 15:36:32 +02:00
WerWolv
8cd961596e fix: Undo accent color changes as they produced some weird results 2025-05-11 15:24:24 +02:00
WerWolv
d2344418d6 patterns: Updated pattern language 2025-05-11 15:22:27 +02:00
WerWolv
33aa2248d2 fix: Theme color alpha not being applied correctly to accented colors 2025-05-11 11:05:53 +02:00
WerWolv
feb5b209ed web: Adapt new async WASM loading API 2025-05-10 21:30:42 +02:00
WerWolv
34722404f4 build: Emscripten no longer generates imhex.worker.js 2025-05-10 19:25:36 +02:00
WerWolv
b78a234fe1 impr: Make accent colors work more naturally 2025-05-10 18:23:29 +02:00
WerWolv
f19478374f build: Update emscripten to the latest version 2025-05-10 14:24:07 +02:00
WerWolv
51a01c860b patterns: Updated pattern language 2025-05-10 12:17:41 +02:00
WerWolv
eedd044716 build: Updated dependencies 2025-05-10 11:11:18 +02:00
WerWolv
0a327f4ad3 impr: Allow debug banner to be skipped with a env var 2025-05-10 11:00:18 +02:00
WerWolv
eec6a5da0a impr: Unlock frame rate in more cases 2025-05-10 11:00:18 +02:00
WerWolv
fc87bc0cf1 impr: Allow events to be used with a function without args 2025-05-10 11:00:18 +02:00
peelz
1f213408a1 build: Move nlohmann-json to build dependencies (#2218)
nlohmann-json is a headers-only library, so there's no runtime
requirement for it.
2025-05-10 10:59:18 +02:00
WerWolv
bac6fd803f patterns: Updated pattern language 2025-05-09 21:18:31 +02:00
WerWolv
5a74d7e3e2 patterns: Updated pattern language 2025-05-09 19:35:00 +02:00
WerWolv
e289380c39 fix: Crash when selecting invalid time_t 2025-05-09 19:33:01 +02:00
WerWolv
8081dff6b6 build: Updated libfmt (#2234) 2025-05-09 19:00:04 +02:00
WerWolv
7dcf09118b patterns: Updated pattern language 2025-05-09 18:24:50 +02:00
WerWolv
4b9a3d121d fix: Visualizer popups being draggable from their body 2025-05-09 17:23:55 +02:00
WerWolv
cd24cba240 build: Updated libwolv 2025-05-09 17:23:35 +02:00
paxcut
d33fad9d23 fix: The bar between pattern editor and console could be locked even if it seemed like it should be movable. (#2227)
This was caused by the variable that holds the bar location not being
updated when window was resized.
The bar can be moved until only one line is shown in the smaller window.
When ImJex window is resized, the proportion of editor/console height is
maintained.
2025-05-05 02:43:14 -07:00
paxcut
b02aa51e09 fix: macos builds
Found post on s.o. about c++ headers not being found when using llvm
clang installed using homebrew
[here](https://stackoverflow.com/questions/77250743/mac-xcode-g-cannot-compile-even-a-basic-c-program-issues-with-standard-libr)
and when I tested the proposed solution in my imhex fork the macos x86
builds were able to complete.
2025-05-04 21:19:29 -07:00
ThePirate42
36eeee5f9c fix: prevent potential UB using std::clamp.
### Problem description
It is possible for the maximum and minimum value arguments to std::clamp to be swapped which is defined  in the standard as undefined behavior

### Implementation description
Swap the values if necessary.


---------

Co-authored-by: paxcut <53811119+paxcut@users.noreply.github.com>
2025-05-04 17:24:59 -07:00
paxcut
4883ed0e5a fix: Incorrect horizontal scrollbar displayed. (#2209)
The horizontal scroll bar length is set using the maximum line length across the input file. The original setup had the lengths of imported and included files added so changes are made to insure that only changes from the input file are taken. This required changes to the Pattern Language library so the library is updated to the latest version as well.
2025-05-04 07:56:39 -07:00
paxcut
78ad0d2592 fix: fixed console selections while improving code clarity.
The function SetSelection() in the text editor is used as its name implies to set the part of text that will be shown highlighted as a selection. It has two parameter for the selection start and end.

Strangely it also uses a third argument to choose one of 3 selection modes (line, word and normal). This is strange because it seems that if one wanted to select a line one would simply choose the line start and end as the selection values. 

Furthermore using selection mode creates a bug when the word boundaries are advanced twice during a single word left or right selection and a second bug when SetSelection is used to set the cursor when the window acquires focus breaking selections in the console editor.

This PR simply eliminates the extraneous argument to SetSelection() ensuring that any problems related to it are fixed once and for all improving code readability by removing the use of inconsistent argument values to cover for the functionality  duplication design flaw.
2025-04-30 22:08:23 -07:00
SparkyTD
f6def74b29 impr: Fix word bound selection and 'MoveHome' behavior in the pattern editor (#2193)
### Problem description
This PR addresses two small issues regarding the cursor in the pattern
editor (TextEditor.cpp):

1. It was not possible to move the cursor to the start of a line, if it
contained leading white space characters. With my fix, the editor will
behave more like other code editors. Pressing Home once will jump to the
first non-whitespace character (as it did before), but pressing it again
will jump to column 0. Subsequent presses will alternate between the two
positions.
2. When expanding a selection with Ctrl+Shift+{Left/Right}, the new
selection position would skip an additional word, resulting in the
cursor landing "inside" the selection. This PR fixes this bug.

### Implementation description
1. To fix the first issue, I simply added a condition in
`TextEditor::MoveHome` to check if the cursor is already on the first
meaningful character, or on one of the whitespaces preceding it, in
which case the jump offset is set to 0. If we're already on column 0,
then jump forwards to the first non-whitespace character.
2. This bug was happening because the word boundary jump calculations
were essentially happening twice. Once in
`TextEditor::MoveLeft`/`TextEditor::MoveRight`, and then a second time
in `TextEditor::SetSelection`, leading to the selection skipping an
additional word. I fixed this by replacing the ternary operator with
just `SelectionMode::Normal`.

---------

Co-authored-by: paxcut <53811119+paxcut@users.noreply.github.com>
2025-04-30 11:57:34 -07:00
Geky
be44676b01 i18n: Added french translation (#2171) 2025-04-24 11:14:41 +02:00
paxcut
60c1c22a73 fix: fixes Issue #1621 (#2189)
fixes Issue #1621.
Using shift-tab on an empty line caused a crash.  Additionally, changed
the hard coded value of 4 to the tab size variable it really needs to be.
2025-04-23 06:54:39 -07:00
WerWolv
02cadc264e build: Try to use macOS 13 SDK if possible 2025-04-14 20:42:37 +02:00
WerWolv
a0ca5b8072 fix: Missing include on clang 20 2025-04-14 20:21:53 +02:00
WerWolv
31fdb73b0e git: Remove --no-lock from brew commands since it was removed 2025-04-14 19:02:07 +02:00
WerWolv
d2caa1859d fix: LayoutManager build issues 2025-04-09 07:26:45 +02:00
PietHelzel
f6c25b30ae fix: Saving layout now picks the first path in the list (#2208)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
Saving a layout using the "Workspace -> Layout -> Save Layout ..."
button saved to the last writable path in the list that can be found in
the "Help -> About" menu. Instead, it should write to the first working
path encountered.

### Implementation description
Getting all of the writable paths, then picking the first one.

### Screenshots
<!-- If your change is visual, take a screenshot showing it. Ideally,
make before/after sceenshots -->

### Additional things
<!-- Anything else you would like to say -->
2025-04-08 21:47:20 +02:00
WerWolv
379d826f18 build: Fix configure issues with cmake 4.0.0 2025-04-04 00:02:39 +02:00
WerWolv
96afccc46c fix: Workspaces not being updated correctly 2025-04-03 23:55:35 +02:00
paxcut
c0a222644b feat: Allow adding breakpoints in pattern editor by clicking on line numbers (#2161)
Now that line numbers are not part of the line of code clicking them
makes the text editor lose focus. This PR changes that by allowing the
user to toggle breakpoints by clicking the field where the line number
is located.

Not only will the text editor retain focus when breakpoints are set, but
if other parts of ImHex had focus, then it will be transferred to the
text editor's current cursor position when the line number field is
clicked.

It is also possible to keep the focus where it was and only retain the
focus if the text editor was focused when the break point is set. The
change is very trivial so if that is preferred I can easily switch it.
2025-03-11 14:57:49 +01:00
paxcut
653173945f feat: Make undo work when importing pattern (#2160)
A user complained that they imported a file by accident when they meant
to export it and as a result had trouble recovering the changes they
were trying to save. Auto-save saved the day but there is no reason for
not being able to undo changes after importing a pattern.

In fact, the previous implementation treated importing a pattern as a
reset on the editor instance which actually erased all previous undo
entries. Importing now is treated as a normal editing operation where
the entire file is replaced with the imported pattern.
Since all imports use AddText it was easy to add an undo entry to that
function while removing the part where the previous undo records were
being deleted.

Care is taken to add the preprocessed version of the imported file to
the undo buffer so that unwanted chars don't sneak in. A bug was found
in the handling of a tab char as well but hopefully it wont need to be
used anymore.
2025-03-11 14:56:44 +01:00
paxcut
7d09cc6d25 fix: Console editor not showing all output (#2133)
This change is to fix a bug reported in discord by berkus and Naheulf
about the console missing output lines. The bug was caused by using
SetText which replaces the existing text with the text in the argument.

To fix it use InsertText which puts the text at the current cursor
position that was already set to the end of the current contents.

Code was tested with pattern used to reproduce the bug and seemed to
work when evaluated repeatedly.
2025-03-11 14:56:05 +01:00
Stefan
a4360dfe76 lang: Use ß in German translation where needed (#2135) 2025-03-11 14:55:12 +01:00
WerWolv
9887117e7a build: Updated disassembler library 2025-03-03 15:41:04 +01:00
xtex
9be7eafa39 build: Find regex component of Boost explicitly (#2151)
'Boost::regex' could not be found unless regex is specified explicitly
on some systems.

cf. https://github.com/AOSC-Dev/aosc-os-abbs/pull/9798
cc. @chenx97

### Problem description
> Target "libimhex" links to: Boost::regex but the target was not found.
when building ImHex with system Boost.

### Implementation description
Add `COMPONENETS regex` to require regex library explicitly.

Signed-off-by: xtex <xtex@aosc.io>
Co-authored-by: Henry Chen <chenx97@aosc.io>
2025-02-28 12:29:39 +01:00
WerWolv
774eb18a42 impr: Make custom disassemblers reload on run 2025-02-28 12:04:47 +01:00
WerWolv
4e582d02f5 fix: More issues with OpenGL texture deallocation 2025-02-27 21:44:42 +01:00
WerWolv
38d11dacb7 fix: Crash when choosing Edit -> Disassemble Selection without ever opening disassembler view
Fixes #2149
2025-02-27 08:45:24 +01:00
WerWolv
e17490ee04 build: Install updater binary into bundle on macOS 2025-02-27 08:44:32 +01:00
WerWolv
f3a9ca6d6f fix: Only try to delete textures if OpenGL is still available 2025-02-26 16:03:37 +01:00
WerWolv
2653740a36 fix: Wrong scripts menu rendering on macOS with OS menu bar enabled 2025-02-26 16:03:29 +01:00
WerWolv
335042ec08 impr: Reduce CPU usage further 2025-02-26 16:03:24 +01:00
WerWolv
f6944b15f3 fix: Large CPU usage 2025-02-26 16:03:16 +01:00
WerWolv
d7960dccb4 fix: ID collision when having duplicate fonts installed
Fixes #2141
2025-02-25 11:52:46 +01:00
WerWolv
c974c4257d fix: Crash on exit due to frame rate limiter thread not being shut down
Fixes #2140
2025-02-25 11:50:38 +01:00
WerWolv
40d74dd633 fix: Crashes when switching disassembler architecture while disassembling 2025-02-24 19:58:40 +01:00
WerWolv
602c85b57d fix: Way too low sleep target fps 2025-02-24 19:53:07 +01:00
WerWolv
f96fa596b3 fix: Debug assertion 2025-02-24 19:52:41 +01:00
WerWolv
8c13d0096e build: Remove wrong hexpluglib bundling from rpms 2025-02-23 21:08:22 +01:00
WerWolv
7879f8b6a4 impr: Don't wake up frame rate limiter thread more often than necessary 2025-02-23 20:25:29 +01:00
WerWolv
4c0e8bc1d6 build: Disable fortify source in debug builds 2025-02-23 20:24:10 +01:00
WerWolv
6644df3958 build: Make sure plugin libraries don't end up in lib folder 2025-02-20 11:29:39 +01:00
WerWolv
2b5551d719 fix: Crash when closing provider that's open in the diff view 2025-02-20 10:34:59 +01:00
Jonathan Wright
137063dd21 build: Fix using system lunasvg (#2131)
Fix capitalization for cmake find_package and lunasvg.h path
2025-02-19 20:42:22 +01:00
WerWolv
ca403869ab fix: Broken Plugin API link 2025-02-19 14:46:01 +01:00
WerWolv
daf676b277 fix: Potential division by zero on Windows 7
#2130
2025-02-19 10:58:16 +01:00
WerWolv
66bbdbe6ec patterns: Updated pattern language
Fixes #2126
2025-02-18 22:48:49 +01:00
WerWolv
d3c2516f5f fix: Occasional crash when switching fonts 2025-02-18 21:50:51 +01:00
WerWolv
c39ae84922 impr: Make CLI not hang for a second after each command on Linux 2025-02-18 20:54:25 +01:00
WerWolv
a83843fdab patterns: Updated pattern language 2025-02-18 20:39:59 +01:00
WerWolv
2d48da1c4a fix: Prevent stack overread when calling dbus-send 2025-02-18 15:22:29 +01:00
WerWolv
af0c15f69d impr: Make title bar icon always draw at the correct size 2025-02-18 15:21:56 +01:00
WerWolv
7898df9c2c fix: Pattern Editor losing focus during auto evaluation
Fixes #2122
2025-02-18 10:25:59 +01:00
WerWolv
48abdeaf6b build: Fixed Linux build issues 2025-02-18 10:21:26 +01:00
WerWolv
99a4979b65 build: Fixed Windows build issues 2025-02-18 09:24:20 +01:00
WerWolv
d8beff4f6b build: Only enable module scanning when modules are enabled 2025-02-18 00:47:36 +01:00
WerWolv
ccaf1e33c0 build: Make this modules stuff actually mostly work on Clang 2025-02-18 00:39:53 +01:00
WerWolv
3f119b957e build: Use -fvisibility=hidden for plugins 2025-02-17 22:57:33 +01:00
WerWolv
abf97212fe build: Added some initial test code for C++ Modules 2025-02-17 22:57:21 +01:00
WerWolv
b81c3d2f75 build: Updated dependencies 2025-02-17 16:19:02 +01:00
WerWolv
5651c4d95c git: Updated gcc version in compile instructions 2025-02-17 16:14:49 +01:00
WerWolv
c83a5cc1b7 build: Get rid of unused Toolchain file warning 2025-02-17 13:19:53 +01:00
WerWolv
0499807597 fix: Remove unused event unsubscribes in disassembler 2025-02-17 13:07:01 +01:00
WerWolv
f846afd8a9 fix: Crash when setting invalid font 2025-02-17 13:06:35 +01:00
WerWolv
b822c82d18 impr: Added missing ellipsis on Edit options 2025-02-17 11:21:55 +01:00
WerWolv
e4de551008 fix: Closing one view breaking all other views 2025-02-17 10:16:51 +01:00
WerWolv
5333d0180f fix: Crash when loading process memory provider from project 2025-02-17 10:16:37 +01:00
WerWolv
658d4c4d72 fix: Make sure fps counter values are initialized to zero 2025-02-16 23:46:08 +01:00
WerWolv
efa50a8c39 fix: Revert accent color changes 2025-02-16 22:52:54 +01:00
WerWolv
677dc6192d fix: Don't execute EventDPIChanged multiple times 2025-02-16 22:21:00 +01:00
WerWolv
1ed56c1b1d fix: Wrong native scaling on Wayland 2025-02-16 21:59:30 +01:00
WerWolv
983be04722 impr: Allow accent colors to have darker colors 2025-02-16 21:24:23 +01:00
WerWolv
1bd9c918f6 fix: Crash when custom disassembler returns no bytes 2025-02-16 21:11:02 +01:00
WerWolv
0ba16485bb patterns: Updated pattern language 2025-02-16 21:06:39 +01:00
WerWolv
1d9934830b fix: Pattern editor being shifted to the left on evaluate 2025-02-16 20:50:49 +01:00
WerWolv
806d6148eb fix: Pattern console log logic 2025-02-16 20:08:36 +01:00
WerWolv
e484587778 fix: Don't parse version string on every call 2025-02-16 20:08:10 +01:00
WerWolv
1e4b5104b7 build: Updated libwolv 2025-02-16 20:07:44 +01:00
WerWolv
676d2e2ef5 build: Fixed release note generator script 2025-02-16 19:24:40 +01:00
WerWolv
6122d44bd9 git: Fixed dnf cache key 2025-02-16 19:24:27 +01:00
WerWolv
eb9f0cdf0c build: Bumped version to 1.38.0.WIP 2025-02-16 19:24:10 +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
WerWolv
b3d208e6e6 impr: Allow sidebar to be only resized from the right 2025-02-10 21:42:12 +01:00
WerWolv
e8b391c0f6 feat: Added option to randomize window title 2025-02-10 14:02:32 +01:00
WerWolv
02b5df03ab impr: Drastically reduce font-related memory usage 2025-02-10 12:02:05 +01:00
WerWolv
e1580e51cf build: Make ImHex fully compile with warnings enabled in MSVC 2025-02-10 09:42:35 +01:00
WerWolv
3a7578879f fix: RGBA8 data processor node not working correctly 2025-02-09 23:38:35 +01:00
WerWolv
ea3d4b41a9 patterns: Updated pattern language 2025-02-09 10:28:46 +01:00
WerWolv
e0c2a39ce7 build: Fix ARM64 macOS build issues 2025-02-08 11:27:40 +01:00
WerWolv
1fa27b7f09 build: Fix remaining wasm build issues 2025-02-08 10:50:04 +01:00
WerWolv
f980f1dae2 build: Compress wasm build romfs 2025-02-07 23:56:50 +01:00
WerWolv
b81ad53449 build: Move vcpkg.json away 2025-02-07 23:56:50 +01:00
WerWolv
a9727171e2 build: vcpkg is already installed in the macOS docker 2025-02-07 23:37:10 +01:00
WerWolv
a1634fb337 build: Properly update vcpkg pages in web and macOS ARM docker 2025-02-07 23:34:05 +01:00
WerWolv
94a2f9460e impr: Use proper main() return values in forwarder 2025-02-07 22:19:35 +01:00
WerWolv
18cd39270a fix: Very slow processing of large pattern console outputs 2025-02-07 22:19:15 +01:00
WerWolv
72c2bca363 fix: Severe lack of easter eggs 2025-02-07 16:24:57 +01:00
WerWolv
4c153dc76d fix: Windows forwarder application not working when piping output 2025-02-07 16:23:27 +01:00
WerWolv
e63606f6bb feat: Added separate --version-short command 2025-02-07 15:46:11 +01:00
WerWolv
ed6da7fe14 fix: Writing not working correctly through a provider view 2025-02-07 15:45:38 +01:00
WerWolv
a588c96440 fix: Properly trigger global shortcuts 2025-02-06 22:34:34 +01:00
WerWolv
4c284b224e fix: Properly trigger all shortcuts 2025-02-06 22:33:14 +01:00
WerWolv
96afa650d1 fix: Properly trigger shortcuts on selected view on macOS 2025-02-06 22:13:06 +01:00
WerWolv
f17d0d3ae1 impr: Added simplified output option for --version 2025-02-06 21:46:27 +01:00
WerWolv
930d2b4280 fix: Some shortcuts not working correctly on macOS 2025-02-06 15:58:18 +01:00
WerWolv
f67b78bd91 build: Update vcpkg baseline on build 2025-02-06 15:24:57 +01:00
WerWolv
540e8ed602 build: Install vcpkg again in the ARM64 macOS docker 2025-02-06 15:21:07 +01:00
WerWolv
99cb51e813 build: Updated vcpkg baseline 2025-02-06 15:08:48 +01:00
WerWolv
db000c4b12 fix: Missing GLFW include on macOS 2025-02-06 14:12:52 +01:00
WerWolv
0cd557a686 impr: Remove frame from selectable text regions 2025-02-06 14:00:32 +01:00
WerWolv
6142bf859b fix: Missing new line 2025-02-06 13:27:48 +01:00
WerWolv
b6498b5c2d fix: Build error when including file in ObjC code 2025-02-06 13:04:36 +01:00
WerWolv
c15030e96e git: Remove libpl from PDB extraction process 2025-02-06 13:04:01 +01:00
WerWolv
cd2acd73b4 build: Fix libpl linking 2025-02-06 12:08:57 +01:00
WerWolv
cfe06ea1b6 build: Statically link libpl again everywhere 2025-02-06 12:03:20 +01:00
WerWolv
ca5c3e0e94 build: Fix linking against libpl in external plugins 2025-02-05 20:09:42 +01:00
WerWolv
6252fd399a fix: Loading/Storing of shortcut keys 2025-02-05 20:09:24 +01:00
WerWolv
de571e2c2a build: Updated libwolv 2025-02-05 20:09:12 +01:00
WerWolv
0cbd052b91 build: Updated dependencies 2025-02-05 15:09:09 +01:00
WerWolv
aa3ec3ece8 build: Updated dependencies 2025-02-05 13:49:16 +01:00
WerWolv
6b11028b72 impr: Use proper function to get environment variables 2025-02-05 13:47:38 +01:00
WerWolv
269c3e7398 fix: Wrong keys being loaded from settings for shortcuts 2025-02-05 13:47:17 +01:00
WerWolv
08335041f5 fix: Crash on Linux uf XDG_SESSION_TYPE is not set 2025-02-05 09:40:13 +01:00
WerWolv
d75b9cf942 build: Properly link plugins against libpl if it's a shared library 2025-02-04 12:16:46 +01:00
WerWolv
b55c40523f fix: Crash when closing ImHex with one or more view providers open 2025-02-04 09:35:26 +01:00
WerWolv
99a2dee7a2 build: Updated libromfs 2025-02-03 22:06:43 +01:00
WerWolv
c94265c77b build: Only add magic library dir in regular build 2025-02-03 21:48:13 +01:00
WerWolv
7ddfba1b4c build: Exclude more libraries from external plugin builds 2025-02-03 21:46:21 +01:00
WerWolv
9ecdd28eea build: Don't link against libcurl in external plugin builds 2025-02-03 21:43:57 +01:00
WerWolv
d8b36242f6 build: Don't set EXPORT_SYMBOLS when doing an external plugin build 2025-02-03 21:33:41 +01:00
WerWolv
3f470aabe9 fix: Compile errors 2025-02-03 21:11:48 +01:00
WerWolv
1e8dd54b3e build: Don't set -Wno-unused-result on MSVC 2025-02-03 20:51:47 +01:00
WerWolv
0a6681ccb7 impr: Remove dependencies on curl, mbedTLS and GLFW in the SDK 2025-02-03 20:50:11 +01:00
WerWolv
0140e24822 build: Fixed warning in miniaudio library 2025-02-03 16:05:40 +01:00
WerWolv
9fb38922ea impr: Disable main menu items for views that aren't selected right now 2025-02-02 22:32:24 +01:00
WerWolv
7752354598 impr: Make dark theme text slightly off-white 2025-02-02 21:48:12 +01:00
WerWolv
497670c4c3 fix: Don't apply backing scale factor twice to splash screen 2025-02-02 21:36:49 +01:00
WerWolv
84954cd2f1 build: Fixed more SDK errors 2025-02-02 21:22:42 +01:00
WerWolv
8b6eab401e fix: "Other Data Sources" welcome screen sub-window being too tall 2025-02-02 21:15:56 +01:00
WerWolv
71c11a5923 fix: Banner position being wrong while provider is loaded 2025-02-02 21:15:31 +01:00
WerWolv
f345edb252 fix: Banners not being part of the main viewport 2025-02-02 21:06:18 +01:00
WerWolv
be40fd9563 build: Apply flags correctly for imported libraries 2025-02-02 20:50:49 +01:00
WerWolv
5ee2ebfb4f build: Fix addXXXFlag functions for interface targets 2025-02-02 20:32:24 +01:00
WerWolv
cfa6b706a8 patterns: Updated pattern language 2025-02-02 20:32:06 +01:00
WerWolv
42f2a62d62 build: Make plugin library sdk path relative 2025-02-02 19:05:10 +01:00
WerWolv
41b6ef930a build: Fix MinGW build 2025-02-02 17:19:34 +01:00
WerWolv
948cbe0a9c build: Updated dependencies 2025-02-02 13:08:08 +01:00
WerWolv
18669f3230 build: Move back to upstream lunasvg 2025-02-02 12:14:32 +01:00
Tim Blume
4e9f944204 build: Install include folders of plugin libraries to SDK (#2074)
Partially fixes #2068 .

This assumes the headers are in "include" for all plugins - this is
necessary since the INCLUDES argument of add_imhex_plugin may contain
paths to third party libs, whose headers should not be copied.
To fix this I think it is necessary to add a second argument like
"PRIVATE_INCLUDES", which is included, but not installed.

With this it possible to append the ui plugin for example:
```
INCLUDES
        $ENV{IMHEX_SDK_PATH}/lib/plugins/ui/
```
and to link against it:
```    
LIBRARIES
        /usr/local/lib/imhex/plugins/ui.hexpluglib
```

In a follow-up in the CMake Template for plugins imho there should be
fixed, that:

 - you can include plugin includes relative to the SDK Path
- you can link plugins relative to the lib path + without the hexpluglib
or hexplug extension

---------

Co-authored-by: Tim Blume <git@3nd.io>
Co-authored-by: Nik <werwolv98@gmail.com>
2025-02-02 12:12:40 +01:00
WerWolv
fe18cbaa41 fix: Always properly jump to cursor position when scrolling with arrow keys
Fixes #1582
2025-02-02 12:06:34 +01:00
WerWolv
ed3712e1b9 fix: Shortcuts not working until a modal is opened 2025-02-02 12:00:59 +01:00
WerWolv
20dc4f31f0 impr: Show a loading spinner while providers are loading 2025-02-02 11:24:50 +01:00
WerWolv
19f9296a40 feat: Added blocking tasks that show a full-screen modal when active 2025-02-02 11:24:28 +01:00
WerWolv
06c019387c build: Fix most remaining warnings 2025-02-01 22:11:19 +01:00
WerWolv
645b43e9cc fix: Various MSVC warnings 2025-02-01 20:54:00 +01:00
WerWolv
ed37a3711f build: Fix extra comma 2025-02-01 20:23:02 +01:00
WerWolv
a3460de9dc build: Make VS CMake Preset do a 64 bit build 2025-02-01 20:20:42 +01:00
WerWolv
5084009d62 fix: Invalid iterator dereference when removing providers 2025-02-01 20:10:13 +01:00
WerWolv
e5c003d726 fix: Only use __declspec on with MSVC 2025-02-01 19:57:39 +01:00
WerWolv
327a02b87d fix: Plugins not having a proper entry point on MSVC 2025-02-01 19:14:15 +01:00
WerWolv
e9bf1a9f7a fix: Crash when no plugins were loaded 2025-02-01 18:08:47 +01:00
WerWolv
0c6fa768ea build: Fix building for 64bit with MSVC 2025-02-01 18:08:35 +01:00
WerWolv
483468a6c7 impr: Make WorkspaceManager internals static 2025-02-01 16:02:45 +01:00
WerWolv
8039ae1b90 build: Make ImHex fully compile with MSVC and Clang CL
This does NOT make ImHex work yet. However it can now be compiled
2025-02-01 15:13:13 +01:00
WerWolv
466b372d41 build: Added vcpkg manifest 2025-01-31 23:48:52 +01:00
WerWolv
3f6b5203ca fix: Further MSVC compile fixes 2025-01-31 23:48:38 +01:00
WerWolv
8d1352ddff fix: Remaining compile errors 2025-01-31 20:23:47 +01:00
WerWolv
e6ab2c3b7e impr: Various small fixes and improvements 2025-01-31 19:43:39 +01:00
WerWolv
e603c75bd3 build: Updated dependencies 2025-01-31 19:40:58 +01:00
WerWolv
4f28f97141 git: Fix workflow indentation 2025-01-30 22:34:50 +01:00
WerWolv
d0b32e5224 git: Try creating dmg a few times again in case XProtect is being a bitch 2025-01-30 22:25:00 +01:00
WerWolv
2062a23347 patterns: Updated pattern language 2025-01-30 22:12:04 +01:00
WerWolv
8c9236a066 patterns: Updated pattern language 2025-01-30 21:31:14 +01:00
paxcut
2f981ef91e fix: Banners not scaling properly with font size (#2096)
The banner windows did not scale with the fonts resulting in cropped
text when font size was made bigger than normal.
fixed by ensuring the window is big enough and then making sure text is
centered in the y-axis.
2025-01-30 20:18:44 +01:00
WerWolv
6725c170ea build: Updated dependencies 2025-01-30 20:12:19 +01:00
WerWolv
c8cf6e7c08 build: Fix compile errors on platforms where sizeof(long double) > sizeof(unsigned long long) 2025-01-29 22:16:42 +01:00
Connor Gibson
e0b4acee12 build: Updated macOS compile instructions as Brewfile has moved (#2093)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
Brewfile has moved from `dist/Brewfile` to `dist/macOS/Brewfile`.

### Implementation description
Updated build instructions to reflect this previous change

### Screenshots
N/A

### Additional things
N/A
2025-01-29 21:38:47 +01:00
WerWolv
803ebe34ed build: Update for software defined 128 bit types 2025-01-29 21:37:41 +01:00
WerWolv
e981eff1e6 fix: Uninitialized buffers in resize operation 2025-01-29 18:39:19 +01:00
WerWolv
aee7a09b6c feat: Added new --select, --pattern and --debug-mode subcommands 2025-01-29 18:32:54 +01:00
WerWolv
e74e4e92a0 build: Updated libwolv 2025-01-29 18:32:35 +01:00
WerWolv
6dba15defd impr: Removed black border from splash screen bytes 2025-01-28 23:41:44 +01:00
WerWolv
fee7a16692 fix: Exception being thrown while loading projects
Fixes #2091
2025-01-28 23:23:31 +01:00
WerWolv
141030344b fix: Crash when certain pattern language exceptions were thrown
Fixes #2091
2025-01-28 23:23:08 +01:00
WerWolv
4fa9586206 impr: Added Russian language to WiX installer and ImHex Web 2025-01-28 20:55:10 +01:00
WerWolv
fbbc430b7c fix: Body text being displayed in response text field 2025-01-28 20:53:01 +01:00
WerWolv
bfc68c4d28 fix: Replace HTTP Requests text editors with input text boxes 2025-01-28 20:52:00 +01:00
WerWolv
53fc018ada fix: --pl subcommand not working correctly anymore 2025-01-28 19:47:20 +01:00
WerWolv
d45dd45720 fix: Windows system error messages not being encoded correctly 2025-01-28 19:33:31 +01:00
WerWolv
19a9786bbf impr: Make ImHex cli work more like other tools 2025-01-28 18:41:29 +01:00
WerWolv
b8caf41423 fix: Make sure splash screen is rendered consistently on all platforms 2025-01-28 18:38:20 +01:00
WerWolv
0b3866a56a fix: Wrong usage of windows icon texture 2025-01-27 22:35:27 +01:00
WerWolv
53a7577416 impr: Allow resizing of settings window 2025-01-27 22:20:15 +01:00
WerWolv
f5515417d6 fix: Message dispatching related build issues 2025-01-27 22:15:39 +01:00
WerWolv
24e7c2f3db fix: Make sure all textures are destroyed before glfw gets uninitialized 2025-01-27 22:10:30 +01:00
WerWolv
6e6c5bbc67 fix: Splash screen texture scaling 2025-01-27 21:20:59 +01:00
WerWolv
f4403ff480 impr: Make splash screen use SVG directly 2025-01-27 20:45:30 +01:00
WerWolv
098da20761 fix: Delete splash textures before destroying splash screen 2025-01-27 19:08:01 +01:00
WerWolv
ef2373e8c0 feat: Implement messaging support for Linux 2025-01-27 19:07:22 +01:00
WerWolv
b2c8ed17d5 feat: Added shortcut for opening settings 2025-01-26 22:41:20 +01:00
Nik
bb594a459f feat: Implemented macOS messaging support (#2088) 2025-01-26 18:50:19 +01:00
WerWolv
7340a30650 impr: Make scalable font the default 2025-01-26 14:26:57 +01:00
WerWolv
403104dda1 fix: Properly scale unifont glyphs 2025-01-26 14:21:17 +01:00
WerWolv
8334fbb236 fix: Properly apply backing scaling to pixel perfect default font 2025-01-26 14:18:20 +01:00
WerWolv
0a0323ce5d git: Run CI on feature branches 2025-01-26 13:42:19 +01:00
WerWolv
726d36ba3d git: Fix creation of ARM64 DMG trying to enter wrong path 2025-01-26 11:26:04 +01:00
WerWolv
8bb1521963 git: Fix ARM64 .app path 2025-01-26 10:54:26 +01:00
WerWolv
9457c1f2b9 git: Install ImageMagick so create-dmg can make a pretty volume icon 2025-01-26 10:45:26 +01:00
WerWolv
2b24330f9f build: Updated ImHex icons in MSI installer 2025-01-26 10:40:53 +01:00
WerWolv
9329170e59 git: Ignore missing signature when building DMG 2025-01-26 10:32:37 +01:00
WerWolv
98f3de828a git: Add create-dmg to PATH 2025-01-26 10:27:09 +01:00
WerWolv
3f38f42259 git: Produce nicer looking DMG file for macOS 2025-01-26 10:19:05 +01:00
WerWolv
058a8cdc15 fix: Missing <cstdlib> include 2025-01-26 09:22:53 +01:00
WerWolv
d0c1213ea0 fix: Crash on systems where XDG_SESSION_TYPE isn't defined 2025-01-25 23:30:00 +01:00
WerWolv
30967bac6d fix: Modifier keys not working correctly on X11 2025-01-25 23:24:56 +01:00
WerWolv
09c9bcb046 fix: Pattern data filter not working correctly without a compare value 2025-01-25 23:17:03 +01:00
WerWolv
93f1f5d076 impr: Better font scaling with larger backing scale factors 2025-01-25 22:27:59 +01:00
WerWolv
93e5d62782 fix: Web build scaling 2025-01-25 20:12:21 +01:00
Bananchiki
4d7021ece1 lang: Added Russian translation (#1964)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Description
This pull request introduces a complete Russian translation for ImHex,
ensuring that Russian-speaking users can navigate and utilize the
software in their native language. The translation covers all user
interface elements, menus, dialogs, and messages, providing a seamless
experience for Russian users.

### Testing
The translation has been thoroughly tested to ensure accuracy and
completeness. All translated text has been reviewed for grammatical
correctness and contextual appropriateness.

### Screenshots

![image](https://github.com/user-attachments/assets/455ca03d-0b33-45d2-9ed5-ddb404bd0728)

![image](https://github.com/user-attachments/assets/a7ebdb40-806f-43d9-ab36-deea730505c1)

![image](https://github.com/user-attachments/assets/29c5d21b-7443-4751-9129-e5fa054066d3)

Co-authored-by: Lemon4ksan <senya20151718@gmail.com>
2025-01-25 20:06:18 +01:00
WerWolv
f976988c75 impr: Try to detect backing scaling factor on the web build 2025-01-25 19:08:56 +01:00
WerWolv
1eee31fdbb fix: Debug mode only being enabled after everything has been initialized already 2025-01-25 16:54:16 +01:00
paxcut
048c483903 fix: Pattern Editor shortcuts not working correctly on different languages (#2085)
Fixes #2084 

Error in text editor prevented using shortcuts when language other than
English was chosen.

The code was mistakenly using localized name to test which window had
focus a execute the shortcut.

Fixed it by switching the name of the child window to the constant value
used to check the windows focused identity.
2025-01-25 16:34:27 +01:00
Wolf
b646ece14b impr: Refactor and restructure Event Manager (#2082)
### Problem description
This PR addresses issue #2013 that described a cluttered Event Manager.

This is a DX issue and should not impact the users whatsoever.

### Implementation description
The changes revolve around three main points:

1. the Event Manager (`event_manager.hpp`) was split into four
categories: GUI, Interaction, Lifecycle, and Provider, and two types:
Events, and Requests. This results in the following files:
    - `events_gui.hpp`
    - `events_interaction.hpp`
    - `events_lifecycle.hpp`
    - `events_provider.hpp`
    - `requests_gui.hpp`
    - `requests_interaction.hpp`
    - `requests_lifecycle.hpp`
    - `requests_provider.hpp`

2. Every event and request now has its own piece of documentation, with
a `@brief`, accompanied by a longer comment if needed, and gets its
`@param`s described.

3. The old `event_manager.hpp` import was removed and replaced by the
correct imports wherever needed, as to reduce spread of those files only
to where they are truly useful.

### Additional things
The commits have been split into (chrono-)logical steps:
- `feat`: split the Event Manager, and replace the imports
- `refactor`, `chore`: make various small changes to match the required
structure
- `docs`: add documentation for events and requests

Hopefully, this will help to review the PR.
*Note: Beware of very long rebuild times in between the commits, use
them sparingly! The Actions will ensure this PR builds anyways*

Closes #2013

---------

Signed-off-by: BioTheWolff <47079795+BioTheWolff@users.noreply.github.com>
Co-authored-by: Nik <werwolv98@gmail.com>
2025-01-25 15:32:07 +00:00
WerWolv
35e8acd69d impr: Only enable font config Apply button when setting has changed 2025-01-25 15:50:52 +01:00
WerWolv
de4135d1ad fix: ID collision with multiple items of the same name in the Accept Pattern popup 2025-01-25 15:47:09 +01:00
WerWolv
a44959ce1b feat: Added option to enable debug features in release builds 2025-01-25 15:38:57 +01:00
WerWolv
f4bad0053a fix: Linking errors in the web build 2025-01-25 15:24:44 +01:00
WerWolv
26af5987a5 fix: Properly check if distro info exists before printing it 2025-01-25 15:24:25 +01:00
WerWolv
9cf3250751 impr: Replace GitBook AI garbage with simple search API 2025-01-24 22:31:49 +01:00
WerWolv
acc77205bb fix: Image visualizer data processor nodes not working
Fixes #2081
2025-01-24 21:36:29 +01:00
WerWolv
a6b4f62d75 fix: Opening files in existing instance not working 2025-01-23 19:22:40 +01:00
WerWolv
69c5d553b5 fix: Disable postprocessing shaders in Web version 2025-01-22 19:55:17 +01:00
WerWolv
637cdd7084 git: Only generate attestation on main repo 2025-01-22 19:19:19 +01:00
WerWolv
8978e193db impr: Better OS-specific handling of system exceptions 2025-01-21 23:28:22 +01:00
WerWolv
242b100aa3 fix: Properly detect Windows 10 2025-01-20 21:45:53 +01:00
WerWolv
3a888d48df fix: ID collision with color inline visualizer 2025-01-20 21:25:00 +01:00
WerWolv
721de39dbb impr: Make icon context menu use MenuItemEx for its icons 2025-01-20 21:24:49 +01:00
WerWolv
07e29f2030 feat: Added support for OpenGL post processing shaders 2025-01-20 21:24:25 +01:00
WerWolv
c117d9b3e5 fix: Crash when changing DPI 2025-01-19 23:07:53 +01:00
WerWolv
16eae89151 fix: Save/Save As toolbar items being missing by default 2025-01-19 21:49:34 +01:00
WerWolv
95cb6d8ee6 patterns: Updated pattern language 2025-01-19 19:23:48 +01:00
WerWolv
af27c09204 fix: I guess we can still not use std::views::enumerate 2025-01-19 17:54:18 +01:00
WerWolv
5e3532267c fix: Missing glfw include 2025-01-19 17:52:32 +01:00
WerWolv
7c0331df65 impr: Hide window on macOS when close button is pressed 2025-01-19 17:04:31 +01:00
WerWolv
04ab87cd8e patterns: Updated pattern language 2025-01-19 14:42:02 +01:00
WerWolv
91f5e84250 impr: Don't insert a new line at the end of settings pages 2025-01-19 10:56:00 +01:00
WerWolv
b1edd95ebc impr: Shortcut code cleanup 2025-01-19 10:55:27 +01:00
WerWolv
758738da5c fix: Default font not being the default font 2025-01-19 10:34:54 +01:00
WerWolv
41c8be275b fix: Assert when selecting selectable text 2025-01-19 00:26:26 +01:00
WerWolv
117eb1e2a7 feat: Added more granular font settings
Fixes #1260
2025-01-18 23:34:43 +01:00
WerWolv
3129d6e8fd impr: Simplified custom font selection 2025-01-18 19:03:55 +01:00
WerWolv
2ba7db184b build: Fix favicon transparency for ImHex Web 2025-01-18 17:47:36 +01:00
WerWolv
2cb0df4080 build: Properly optimize web build 2025-01-18 16:53:11 +01:00
WerWolv
3adc2c44e6 fix: Font customization not unlocking correctly 2025-01-18 16:05:11 +01:00
WerWolv
6d3ff64894 fix: ImHex using a lot of CPU 2025-01-18 14:57:06 +01:00
WerWolv
cf84ad6196 fix: Added back old constructor for Widgets::DropDown 2025-01-18 14:56:53 +01:00
WerWolv
6259190ad9 impr: Make localization fall back to english if it doesn't exist 2025-01-18 14:40:10 +01:00
WerWolv
181be1a58e fix: Missing paste behaviour option translations 2025-01-18 14:36:31 +01:00
WerWolv
771e191f28 fix: Windows icon not being transparent anymore 2025-01-18 14:11:49 +01:00
WerWolv
d4d6893eb3 git: Make sure PORTABLE flag is created correctly 2025-01-18 13:58:20 +01:00
WerWolv
9e75562662 build: Fix RPM icon path 2025-01-18 13:45:57 +01:00
WerWolv
2b3168163b git: Extract PDBs for for portable version properly 2025-01-18 13:45:32 +01:00
WerWolv
252c06eb12 build: Extract PDBs from build files 2025-01-18 13:26:12 +01:00
WerWolv
2a51d8169a build: Move icon to correct location 2025-01-18 13:18:33 +01:00
WerWolv
7405c4b411 build: Updated disassembler library 2025-01-18 13:06:31 +01:00
WerWolv
309ae7b619 build: Fixed disassembler library git messup 2025-01-18 12:38:20 +01:00
WerWolv
64ef56a0df git: Fixed Windows PDB extraction process 2025-01-18 12:04:46 +01:00
WerWolv
fbfe7b0d25 impr: Unlock frame rate for the first few seconds after startup 2025-01-18 11:58:49 +01:00
WerWolv
8c7e1a3b2d impr: Replace icon with Papyrus icon.
Special thanks to @varlesh and @morganist
See https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/issues/3909
2025-01-18 11:55:17 +01:00
WerWolv
bf249cdafe build: Updated disassembler library 2025-01-18 11:07:28 +01:00
WerWolv
59ba6f50cc build: Disable install targets of libfmt to fix Windows WIX installer 2025-01-18 11:03:51 +01:00
WerWolv
8d6e7c7d44 fix: Decompressor compile errors 2025-01-18 10:28:20 +01:00
WerWolv
52934ae166 feat: Make decompress functions return number of read bytes 2025-01-18 10:14:47 +01:00
WerWolv
56c4f2aa47 fix: ID collision with multiple banners on screen 2025-01-17 23:12:09 +01:00
WerWolv
a1d8cbd7ba fix: Properly update window position during resize 2025-01-17 23:11:53 +01:00
Nik
63a219a32b build: Added ARM64 AppImage build (#2073) 2025-01-17 22:55:41 +01:00
WerWolv
14fb256a6a build: Updated dependencies 2025-01-17 21:09:56 +01:00
WerWolv
95df7a23c3 build: Add new SDK files to Fedora package 2025-01-17 20:41:49 +01:00
WerWolv
bb17690cf5 build: Fix cv2pdb extraction errors 2025-01-17 19:56:25 +01:00
WerWolv
a943b02e43 build: Make sure unzip is installed on the CI 2025-01-17 19:50:41 +01:00
WerWolv
199f78347f build: Move PDB extraction to CI 2025-01-17 19:44:33 +01:00
WerWolv
d3d9a42d57 build: Added library plugin files to SDK 2025-01-17 19:32:52 +01:00
WerWolv
1fa45a8c84 fix: Replace bookmark comment Text Editor with multi-line text input
Closes #2056, Closes #2055
2025-01-17 17:28:13 +01:00
WerWolv
0b6316ea23 fix: Added back deleted variable to make web build work again 2025-01-17 17:26:46 +01:00
WerWolv
466a843263 build: Fix backwards compat with older cmake versions 2025-01-17 13:01:40 +01:00
WerWolv
b6ade8b101 fix: Shortcuts not working in detached windows 2025-01-17 12:39:55 +01:00
WerWolv
ff66b97e90 build: Get rid of some cmake warnings 2025-01-17 12:39:39 +01:00
WerWolv
c604ec8fb9 patterns: Updated pattern language 2025-01-16 21:23:22 +01:00
WerWolv
7564651dd5 patterns: Updated pattern language 2025-01-16 19:52:45 +01:00
WerWolv
cad17ddefd fix: Banners being misplaced on macOS 2025-01-16 19:27:22 +01:00
WerWolv
25d2f209e5 patterns: Updated pattern language 2025-01-16 19:15:39 +01:00
WerWolv
8d660c3ffe fix: Missing <numbers> include 2025-01-16 17:37:51 +01:00
WerWolv
209055d0b0 impr: Show a banner about degraded performance in debug mode 2025-01-16 17:09:17 +01:00
WerWolv
599b55965a impr: Improve the shadow of banners 2025-01-16 17:09:04 +01:00
WerWolv
69a9af5322 patterns: Added error pattern to pattern drawer 2025-01-16 17:08:49 +01:00
WerWolv
0303cd0ad0 patterns: Updated pattern language 2025-01-16 17:08:23 +01:00
WerWolv
8eb7e9fb05 fix: ID collision in provider data information section 2025-01-15 20:34:25 +01:00
WerWolv
6a1de5fc4e build: Updated ImGui to v1.91.7 2025-01-15 19:52:24 +01:00
WerWolv
a4af55cb66 build: Rename imgui_custom to imgui_backend 2025-01-15 19:52:19 +01:00
paxcut
1e17422f5e fix: Pattern Editor Find and Replace history (#2064)
The previous implementation seems to have been broken by Imgui updates. 

There is also some improvement in focus handling and also a bug in
replace where the last match was not being replaced has been fixed.

Fixed also slowdown in large files when only one char was typed by not
searching until enter has been pressed.

Added key repetitions for enter and arrows to be able to handle large
number of matches and fixed some formatting problems.
2025-01-15 19:40:12 +01:00
paxcut
8abaafab79 fix: Crash in 3D Visualizer, improved error messages (#2062)
The recently added data checks allowed invalid sized vertex arrays to be
used as if they were valid making ImHex crash.

Moved all the error messages into localization strings for translation.
2025-01-15 19:38:38 +01:00
WerWolv
71e1465524 fix: Image visualizer node trying to create texture in non-main thread 2025-01-15 19:34:58 +01:00
WerWolv
3d2ea3753b fix: Missing <clocale> include 2025-01-15 19:31:33 +01:00
Nik
88530eff8b git: Updated screenshots in readme 2025-01-15 18:31:41 +01:00
WerWolv
df3decf71b build: Updated libwolv 2025-01-15 18:08:45 +01:00
WerWolv
565ee4cb2d fix: Banner positions with multi-viewports enabled 2025-01-15 18:08:05 +01:00
WerWolv
40fc325ba9 fix: Disable bogus Keypad to function key conversions on macOS 2025-01-15 17:59:57 +01:00
WerWolv
6aca16102d impr: Move up the right column on the welcome screen to avoid a scrollbar at default size 2025-01-15 17:54:35 +01:00
WerWolv
cb11b57ab1 feat: Added banners, replace some modals with them 2025-01-15 17:54:07 +01:00
WerWolv
d504937d50 fix: Empty regions in Intel Hex and Motorola SREC files not being displayed correctly 2025-01-14 23:54:07 +01:00
WerWolv
6bfdb7ca4e fix: Make sure provider switch buttons and close button don't overlap 2025-01-14 22:10:58 +01:00
WerWolv
e1637824c6 impr: Make strings in the data information view selectable and copyable 2025-01-14 22:05:29 +01:00
WerWolv
e36f2f2bcb fix: Replace "data processor" text with "data inspector" for the custom data inspector row hint 2025-01-14 17:51:26 +01:00
WerWolv
1a54e08f11 fix: Remove constexpr from functions that really aren't constexpr 2025-01-14 17:50:48 +01:00
WerWolv
ecc86ee429 fix: ImNodes not being deinitialized correctly 2025-01-14 17:50:29 +01:00
WerWolv
185a593bc2 fix: AllowWhileTyping shortcuts only working while typing 2025-01-14 17:50:06 +01:00
WerWolv
4a916ebb89 feat: Added New File option to the GNOME launcher and a --new cli option 2025-01-14 17:49:48 +01:00
WerWolv
1c305ca762 fix: Icons still following custom font size when using default font 2025-01-13 22:34:30 +01:00
WerWolv
17fff56fa0 impr: Make sure Windows title icon is scaled correctly 2025-01-13 22:31:24 +01:00
WerWolv
ec1b1c2b7d impr: More constexpr 2025-01-13 22:31:06 +01:00
WerWolv
7bae22f56f fix: Font selector still saying "Custom Font Path" 2025-01-13 22:20:53 +01:00
WerWolv
21e5eeef16 impr: Reduce default font size slightly, adjust element sizes on welcome screen 2025-01-13 22:17:14 +01:00
WerWolv
bf5eea80f6 impr: Make font size setting use points instead of pixels 2025-01-13 22:04:55 +01:00
WerWolv
9f9a6d9827 impr: Move Jetbrains mono into regular font selector, allow it to be scaled 2025-01-13 22:04:44 +01:00
WerWolv
ae622e6d75 git: Merge WebAssembly build into main build artifacts script, add to releases 2025-01-12 23:08:09 +01:00
WerWolv
68fbff631f git: Fix github pages artifact name 2025-01-12 22:50:39 +01:00
WerWolv
6cdce75095 git: Upload artifact for ImHex Web build 2025-01-12 22:03:50 +01:00
WerWolv
f699e76c56 build: Fix comment causing issues with docker 2025-01-11 21:41:14 +01:00
WerWolv
a729329cd4 impr: Added missing [[nodiscard]]s 2025-01-11 21:40:42 +01:00
WerWolv
d5020ce9bb impr: Rename Jump To option to Follow Selection to avoid confusion with Go To 2025-01-11 21:40:26 +01:00
WerWolv
126868c251 fix: Hang when filtering for a large number of items in the pattern data view 2025-01-11 17:22:53 +01:00
WerWolv
b206e9fc95 fix: Copy-paste error with "Extend selection left" shortcut name 2025-01-11 16:42:00 +01:00
WerWolv
4b6ff68464 git: Fixed CI permissions 2025-01-11 16:28:29 +01:00
WerWolv
b23a0febb5 git: Added build provenance attestation for most artifacts 2025-01-11 16:17:27 +01:00
WerWolv
05ad547341 git: Use zstd to compress .deb builds 2025-01-11 15:57:42 +01:00
paxcut
f10af882a7 fix: Text Editor find option jumping to the wrong location (#2060)
After successfully finding matches and setting the cursor to them, the
screen would jump to the original window location upon closing the
window.

The error was caused by the wrong assumption that the scroll location
should be restored when window is closed. Instead, the right amount of
scrolling needs to be calculated to account for the window no longer
covering part of the text editor. Unused variable was discarded.

Another unrelated error is that the history of search names cannot be
accessed which will be addressed at a later PR.
2025-01-09 18:39:00 +01:00
WerWolv
98f32ebcad impr: Made interactive help api easier to use 2025-01-09 18:34:39 +01:00
WerWolv
e2c302836f feat: Added support for scanning binaries for UTF-8 strings 2025-01-09 18:33:45 +01:00
WerWolv
f1d9642cf6 impr: Better color picker widgets in the settings 2025-01-07 21:46:26 +01:00
WerWolv
5c58e5b545 fix: Selection highlight color setting not working
Fixes #2059
2025-01-07 18:09:56 +01:00
WerWolv
803cb335e1 feat: Added interface accent colors 2025-01-07 00:06:52 +01:00
WerWolv
ae4dde8255 impr: Unlock frame rate in more cases to make the UI feel more responsive 2025-01-06 20:34:00 +01:00
WerWolv
cb34f68b1b patterns: Updated pattern language 2025-01-06 20:15:21 +01:00
WerWolv
96ef983cfb fix: ASCII column not getting highlighted anymore 2025-01-06 20:14:27 +01:00
WerWolv
d8c3d67dfe build: Disable romfs compression in web build 2025-01-05 21:25:28 +01:00
WerWolv
5de5153663 impr: Simplify hex editor class API 2025-01-05 21:24:13 +01:00
WerWolv
1e747b6831 patterns: Updated pattern language 2025-01-05 19:18:46 +01:00
WerWolv
fbe9d16073 build: Updated libromfs 2025-01-05 17:52:04 +01:00
WerWolv
d02c0073a0 build: Ignore pdb copy file errors 2025-01-05 15:27:54 +01:00
WerWolv
1090b9879c build: Make pdb copy operation happen at install time 2025-01-05 15:20:03 +01:00
WerWolv
5a6af976cd build: Rename output pdb file if necessary 2025-01-05 15:14:25 +01:00
WerWolv
55e39a5d30 build: Fix dwarf stripping logic 2025-01-05 15:00:45 +01:00
WerWolv
c9b1ddfb59 build: Updated libromfs 2025-01-05 14:56:16 +01:00
WerWolv
f7dd696ffc build: Silence stupid brew errors 2025-01-05 14:51:03 +01:00
WerWolv
70f210ac5d build: Updated libromfs 2025-01-05 14:37:39 +01:00
WerWolv
cad1c11f8b build: Updated dependencies 2025-01-05 14:17:54 +01:00
WerWolv
f7fa305e82 build: Generate pdb file for libpl, significantly reduce binary size 2025-01-05 12:06:32 +01:00
WerWolv
f96c51e854 impr: Added shortcut for Copy as -> Custom Encoding 2025-01-05 11:12:56 +01:00
WerWolv
c19705d3e5 git: Try to silence brew error messages again 2025-01-05 10:42:29 +01:00
WerWolv
1190511994 impr: Cleanup frame rate unlocking code 2025-01-04 23:43:10 +01:00
WerWolv
69ee7ef63c build: Updated libwolv 2025-01-04 23:42:56 +01:00
WerWolv
fc95e5a9a8 impr: Unlock frame rate when scrolling or focusing 2025-01-04 22:00:26 +01:00
WerWolv
6ecc495d43 feat: Added visibility toggle to hide bookmark highlighting 2025-01-04 21:40:18 +01:00
WerWolv
6e861001cf impr: Allow all highlights to overlap each other 2025-01-04 21:40:03 +01:00
WerWolv
c56af08c7e impr: Allow highlights of multiple overlapping bookmarks to render 2025-01-04 20:46:56 +01:00
WerWolv
e68abefe48 impr: Use info icon for more help hovers 2025-01-04 19:21:22 +01:00
WerWolv
fd0635cb82 fix: Hex editor right click menu not working on macOS 2025-01-04 19:08:37 +01:00
WerWolv
baa3cfb354 fix: User folders being added twice 2025-01-04 18:30:57 +01:00
iTrooz
aea9bab853 build: Make MacOS arm64 build use clang 19 (#2050) 2025-01-04 18:10:48 +01:00
WerWolv
48de609f53 impr: Added telemetry about whether ImHex runs on a corporate machine 2025-01-04 16:11:35 +01:00
WerWolv
71f4f87288 impr: Make sure init tasks always get executed 2025-01-04 16:11:05 +01:00
WerWolv
48b202c56b patterns: Updated pattern language 2025-01-04 15:38:20 +01:00
Nik
d975019a7b impr: Revamp frame rate limiting system to make ImHex feel less laggy in certain cases (#2049) 2025-01-04 15:35:19 +01:00
Nik
6009b5013b feat: Let ImHex use the native menu bar on macOS (#2048) 2025-01-04 15:35:06 +01:00
WerWolv
24979d7fbd impr: Other Providers -> Other Data Sources 2025-01-04 14:06:03 +01:00
WerWolv
b4bf42e377 fix: Unit test build error due to changed Provider::getTypeName() signature 2025-01-04 13:57:48 +01:00
WerWolv
f94819351a impr: Make maximum in-memory file size setting easier to use. Bump value to 512MiB 2025-01-04 13:56:20 +01:00
WerWolv
8da69c11d9 impr: Remove the word "Provider" from places where it doesn't fit 2025-01-04 13:28:35 +01:00
WerWolv
635a825095 fix: Signed/Unsigned comparison error 2025-01-04 13:03:38 +01:00
WerWolv
bbffdbf56f feat: Allow #pragma magic to index from the end of the data with negative addresses
Closes #2047
2025-01-04 12:49:14 +01:00
WerWolv
1c30533d19 fix: Off-by-one when calculating hashes of selected regions
Fixes #2046
2025-01-04 00:15:35 +01:00
WerWolv
dcd80fe6ad impr: Properly scale window on wayland 2025-01-03 15:09:06 +01:00
WerWolv
525ab8d945 fix: Settings not being saved correctly anymore 2025-01-03 14:07:09 +01:00
WerWolv
d8fb3f526a fix: Shortcut migration not working correctly in some cases
Fixes #2045
2025-01-03 10:16:22 +01:00
WerWolv
a55df1d111 fix: Exception being thrown when custom disassembler folders didn't exist 2025-01-03 00:15:52 +01:00
WerWolv
2cf32ba38d fix: Default smooth font not being scaled correctly 2025-01-03 00:15:28 +01:00
AlexGuo1998
c82907153e fix: Set LZMA decompressor memory limit to 1GiB (#2044)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
<!-- Describe the bug that you fixed/feature request that you
implemented, or link to an existing issue describing it -->

See #2033 (`hex::dec::lzma_decompress` reports an error when
decompressing a small buffer).

### Implementation description
<!-- Explain what you did to correct the problem -->

Set the LZMA decompressor memory limit to 1GiB fixed. Print a warning
when exceeded, and abort with returning `false`.

### Screenshots
<!-- If your change is visual, take a screenshot showing it. Ideally,
make before/after sceenshots -->

Normal result when decompressing a small buffer


![image](https://github.com/user-attachments/assets/5b9e6b07-464e-41f6-bdc7-f5b1cd351069)

Warning message when `memlimit` is exceeded: (Set to 64B here for a
demo)
> W: lzma_decompress memory usage 1114168 bytes would exceed the limit
(64 bytes), aborting


![image](https://github.com/user-attachments/assets/04abf3ef-1d29-4846-bb41-214695c7d09c)

### Additional things
<!-- Anything else you would like to say -->

Is the warning wording OK? I'm not a native English speaker so please
change it if you want to.
2025-01-02 08:42:28 +00:00
WerWolv
165403da67 fix: ImHex freezing on AMD GPUs when resizing
Fixes #1842
2025-01-01 20:39:12 +01:00
WerWolv
0e4d94946e fix: Disable recent files on web build since they can't work there 2025-01-01 17:08:31 +01:00
WerWolv
9f9c5abf35 impr: Prevent window from being moved while hovering over items on macOS 2025-01-01 16:45:11 +01:00
WerWolv
6a3b10111f feat: Highlight main menu item when using a shortcut 2025-01-01 16:19:38 +01:00
WerWolv
0a55f4bf83 patterns: Updated pattern language
Fixes #2042
2025-01-01 11:36:04 +01:00
WerWolv
493d66d991 fix: Crash when using hex editor when provider == nullptr 2024-12-31 21:30:05 +01:00
WerWolv
268b495a29 fix: Make capstone use little endian by default 2024-12-31 21:17:19 +01:00
WerWolv
180f4926f8 impr: Make disassembly view contain data per-provider 2024-12-31 21:16:27 +01:00
WerWolv
c853349b78 impr: Force reset window decoration to expected value after exiting full screen mode 2024-12-31 21:04:09 +01:00
WerWolv
ee555e0da9 fix: Make sure WM_NCCALCSIZE never tries to sleep a negative amount of time
#1842
2024-12-31 18:06:31 +01:00
WerWolv
3dec4cc698 fix: Signed/Unsigned integer compare 2024-12-31 17:21:37 +01:00
WerWolv
d7b2b94cec impr: Reduce jittering when changing the number of hex columns 2024-12-31 17:04:32 +01:00
WerWolv
c9e88586aa feat: Added option to fit hex columns to screen width 2024-12-31 11:35:09 +01:00
WerWolv
1d641504b1 fix: Format string issues 2024-12-31 10:01:01 +01:00
WerWolv
655e068b9b impr: Added changed data information to diff view table 2024-12-31 00:47:32 +01:00
WerWolv
67a9f314cc impr: Added icons to more context menus 2024-12-31 00:45:47 +01:00
WerWolv
ff2b58e8a3 fix: Copy paste errors 2024-12-30 23:58:34 +01:00
WerWolv
a1482cb40e fix: Tooltips not being hidden when disabling hex editor highlights 2024-12-30 23:45:48 +01:00
WerWolv
89111059f9 feat: Added setting to disable hex editor highlights entirely 2024-12-30 23:24:59 +01:00
WerWolv
0ae823716a feat: Added a preview to the Edit -> Copy as options
Closes #2026
2024-12-30 23:16:11 +01:00
WerWolv
dab3f722e8 feat: Added "Jump to address" option to data inspector row context menu 2024-12-30 22:32:06 +01:00
WerWolv
0dc1af0747 feat: Added option to change radix of numbers in hex editor view 2024-12-30 21:00:43 +01:00
WerWolv
021206e052 impr: Added icons to pattern editor context menu 2024-12-30 12:18:55 +01:00
WerWolv
cb09cf3734 feat: Added context menu and next/previous buttons to the data inspector 2024-12-30 12:07:21 +01:00
WerWolv
f0525d6463 fix: Building issues with the web build 2024-12-30 10:10:38 +01:00
WerWolv
e22424ffa4 fix: Settings not being saved correctly on the web version 2024-12-29 23:53:23 +01:00
WerWolv
6e666c64e8 patterns: Updated pattern language 2024-12-29 22:42:32 +01:00
WerWolv
5f5f6ac539 feat: Added option to move selection back to hex editor footer
Closes #2024
2024-12-29 21:08:08 +01:00
WerWolv
3024c79f4f impr: Allow the favorite column in the pattern data view to be hidden 2024-12-29 20:38:51 +01:00
WerWolv
ba96d86dc2 impr: Properly align favorite icons inside of the buttons in the pattern drawer 2024-12-29 20:38:25 +01:00
WerWolv
40ec7195d1 patterns: Updated pattern language 2024-12-29 15:20:57 +01:00
WerWolv
f10dfa0c20 patterns: Updated pattern language 2024-12-29 14:40:51 +01:00
WerWolv
6a5473f6fe impr: Moved Windows DPI awareness to manifest file, added detached console allocation
Closes #1543
2024-12-28 23:47:42 +01:00
WerWolv
f79de6fbe8 fix: Web build not starting fully anymore 2024-12-28 22:48:06 +01:00
Nik
ec4ee3132b git: Added note about launching assertion failures when launching the AppImage (#2038) 2024-12-28 22:31:34 +01:00
WerWolv
1298f2b688 impr: Refactor previous commits to work with other environments too 2024-12-28 21:37:45 +01:00
WerWolv
534a2f1d28 impr: Apply framebuffer scaling to SVGs as well 2024-12-28 20:52:49 +01:00
WerWolv
c8e95cf3c3 impr: Keep default font at whole-integer sizes 2024-12-28 20:46:26 +01:00
WerWolv
c4918a963c fix: Default font not being scaled on macOS 2024-12-28 20:45:12 +01:00
WerWolv
bf6f738d2e impr: Make text look super pretty on macOS finally 2024-12-28 20:42:05 +01:00
Nik
1605904eb1 git: Updated more runners to Ubuntu 24.04 2024-12-28 16:49:33 +01:00
Nik
138517f116 git: Updated system requirements and compile info in the readme 2024-12-28 16:48:32 +01:00
WerWolv
d4a4cb2e80 fix: Crash when providing invalid version string to semantic version class
Fixes #2036
2024-12-28 15:59:13 +01:00
WerWolv
9a9dc328e3 build: Switch to custom lunasvg repo to allow offline builds 2024-12-28 13:39:07 +01:00
WerWolv
50eea0a4f1 impr: Replace Firacode with JetbrainsMono font 2024-12-28 12:43:34 +01:00
WerWolv
528a8b5b46 fix: Exception being thrown when getting version parts from invalid version 2024-12-28 11:45:05 +01:00
WerWolv
0db0bc53fa revert: Make pattern editor scroll bar look more like all other scrollbars 2024-12-28 00:39:10 +01:00
WerWolv
0297c267e9 impr: Display "ImHex" in title bar when null provider is open 2024-12-27 23:56:14 +01:00
WerWolv
5af85f24f6 impr: Allow command palette to be closed by clicking on the menu bar 2024-12-27 23:53:55 +01:00
WerWolv
5110a7578e fix: Rendering issues with text editor in bookmark view 2024-12-27 23:36:21 +01:00
WerWolv
5af28670f0 fix: Ctrl sometimes getting stuck when pressing ALT GR and other keys at the same time
#2019
2024-12-27 23:15:20 +01:00
WerWolv
efa2b781dd impr: Better create hash popup size 2024-12-27 23:14:39 +01:00
WerWolv
979f151181 fix: Don't show library plugins in --plugins subcommand 2024-12-27 20:06:17 +01:00
WerWolv
6f125f18c3 impr: Make pattern editor scroll bar look more like all other scrollbars 2024-12-27 20:01:00 +01:00
WerWolv
edba7051f0 impr: Make interactive tutorials select windows when they're highlighted 2024-12-27 19:41:45 +01:00
WerWolv
fa1ae8d746 fix: Tutorial highlights not working anymore correctly 2024-12-27 18:28:22 +01:00
WerWolv
a476617432 build: Fix remaining build issues 2024-12-27 00:02:37 +01:00
WerWolv
ffac13bfef disasm: Updated disassembler library 2024-12-26 23:28:38 +01:00
WerWolv
f877bf21ba fix: Warning on macOS about wrong format argument 2024-12-26 23:01:19 +01:00
WerWolv
4bc4882b1f disasm: Updated disassembler library 2024-12-26 23:00:59 +01:00
WerWolv
084c17dc26 fix: Missing endian setting in ARM64 disassembler 2024-12-26 22:39:57 +01:00
WerWolv
26c39d6822 fix: ImGui_ImplGlfw_InstallEmscriptenCanvasResizeCallback -> ImGui_ImplGlfw_InstallEmscriptenCallbacks 2024-12-26 20:19:55 +01:00
WerWolv
aefc173227 fix: Wrong --reset-settings subcommand description 2024-12-26 20:05:07 +01:00
WerWolv
bf44a1cce6 feat: Added initial support for custom disassemblers 2024-12-26 20:04:45 +01:00
WerWolv
a76c6c653d impr: Refactor disassembler system to make it more modular 2024-12-26 18:41:34 +01:00
WerWolv
f11205bba7 build: Updated more dependencies 2024-12-26 14:41:43 +01:00
WerWolv
72d9c5019c build: Updated dependencies 2024-12-26 14:30:52 +01:00
WerWolv
58d66e3e97 fix: Added migration routine to fix shortcuts 2024-12-26 14:01:54 +01:00
WerWolv
43c88a2fab feat: Added system to handle version migrations 2024-12-26 14:01:46 +01:00
paxcut
9ce64ec6e1 fix: Pattern Editor console scroll jumping. (#2029)
Some issues related to the padding added to scroll past the end for
console that has padding added.
Added a shortcut to scroll editors one pixel at a time.
Fixed whole lines always drawn at the top even if scroll value is chosen
so that only a portion of the top line is visible. This caused errors in
horizontal scrolling.
Fixed Ctrl-F Ctrl-G and Ctrl-H messing the editor display. 
Fixed the end of the line could not be clicked with mouse 
Fixed line numbers and their lines could be displayed at different
heights.
Made numbers that represented lines floats instead of integers to allow
partial line display.
2024-12-25 18:51:58 +01:00
WerWolv
c749d6a7dc fix: Disable ImGui assert that causes random crashes on resize 2024-12-25 18:49:50 +01:00
WerWolv
f3e6d35c98 build: Updated ImGui glfw backend 2024-12-25 18:44:43 +01:00
WerWolv
0be539b8a5 feat: Added option to copy data as escaped string
#2026
2024-12-25 16:45:34 +01:00
WerWolv
0454a369e5 fix: Crashes when disassembling data
Fixes #2025
2024-12-25 16:36:53 +01:00
WerWolv
010025cbfa fix: Wrong localStorage key for achievements 2024-12-25 16:21:38 +01:00
WerWolv
61cae0a9f8 fix: Missing emscripten include 2024-12-25 16:19:50 +01:00
WerWolv
9e83d9e68c fix: Disable browser ctrl + S in web build 2024-12-25 16:17:51 +01:00
WerWolv
248acd5e26 fix: Properly save achievements in web version 2024-12-25 16:17:33 +01:00
WerWolv
42c1f5601a fix: Saving files in web version not working correctly 2024-12-25 15:57:54 +01:00
WerWolv
9c1a673047 impr: Force update all installed content store items after an update 2024-12-25 14:29:41 +01:00
WerWolv
99b90f90ac fix: Unused variable in wasm build 2024-12-25 13:03:55 +01:00
WerWolv
6ead8d8b49 fix: Certain shortcuts not being captured by ImHex Web 2024-12-25 12:36:06 +01:00
WerWolv
9b12232e9f revert: Broken fix for cursor not being set at end of line 2024-12-25 01:41:50 +01:00
WerWolv
c1ed1baaad fix: Shortcuts not working correctly in Web build 2024-12-25 01:34:11 +01:00
WerWolv
ab34312089 fix: Clicking past end of line in text editor putting cursor before last character 2024-12-25 01:33:41 +01:00
WerWolv
a25d92fbb7 build: Bumped version to 1.37.0.WIP 2024-12-25 01:33:36 +01:00
WerWolv
6005af1595 build: Bumped version to 1.36.0 2024-12-24 13:43:04 +01:00
WerWolv
9a4329807a patterns: Updated pattern language 2024-12-24 13:07:26 +01:00
WerWolv
8e01da4c12 lang: Fixed settings language string in hashes view 2024-12-24 13:06:38 +01:00
WerWolv
eb8ea520c7 build: Make ImGui use old CRC algorithm 2024-12-24 11:09:45 +01:00
WerWolv
512fcd361b impr: Modernize the disassembler, hashes and yara view 2024-12-24 10:57:09 +01:00
WerWolv
aad6f6bcbe build: Updated ImGui to v1.91.6 2024-12-24 00:37:04 +01:00
WerWolv
0af21505d7 git: Add retry mechanism for creating dmg on x86 mac 2024-12-24 00:00:22 +01:00
WerWolv
2ae69e8e72 feat: Allow command palette to work with previous results 2024-12-23 23:42:45 +01:00
WerWolv
9274fac8e1 build: Updated libwolv
Fixes #2007
2024-12-23 23:24:38 +01:00
WerWolv
e2f82c60e6 fix: Crash when using text editor as last item in a window 2024-12-23 23:17:19 +01:00
WerWolv
bfddf24204 impr: Added hints to various input fields 2024-12-23 23:16:55 +01:00
WerWolv
382599dcf6 fix: Better icon text input width calculation 2024-12-23 23:16:35 +01:00
WerWolv
5f2c07f2d8 fix: Icon text inputs not being the same length as other items 2024-12-23 21:48:47 +01:00
WerWolv
914024c0b5 impr: Added note about adding new data inspector row 2024-12-23 21:47:16 +01:00
WerWolv
c5d3387962 impr: Replaced centered text notes with overlays 2024-12-23 21:30:31 +01:00
WerWolv
7cc99c6fc9 impr: Added better notes to the settings tabs in the pattern editor view 2024-12-23 21:26:22 +01:00
WerWolv
a29b502a33 impr: Made pattern editor resize separator taller 2024-12-23 20:15:50 +01:00
paxcut
20cb74364f fix: Jumpy text editor scrolling (#2023)
Two major improvements:
1) see through scrollbars when not hovered.
2) un-scrollable line numbers.

Also enlarged display region by eliminating padding. There is still a
problem with lines jumping when the scrollbar is dragged but it is
limited to one line and probably due to floating point error for scroll
bar number. It is much less noticeable than the previous jumping which
could involve several pages.

---------

Co-authored-by: WerWolv <werwolv98@gmail.com>
2024-12-23 20:14:42 +01:00
WerWolv
1c5a50c8d8 impr: Added better file open error messages to the file provider 2024-12-23 14:07:35 +01:00
WerWolv
470523cc86 fix: Jittery scrolling in Text Editor 2024-12-23 11:44:34 +01:00
WerWolv
f6bc3d4650 impr: Replace more assert() calls with IM_ASSERT() 2024-12-23 11:22:20 +01:00
WerWolv
41b1228d31 fix: Make sure all text editor members are correctly initialized 2024-12-23 11:21:39 +01:00
paxcut
2cb4462274 impr: Better top margin handling for text editor. (#2021)
The top margin changes when popups block some portion on the screen.
Previously it was implemented adding blank lines at the bottom which
created problems if the windows was scrolled all the way to the bottom
and the popups were issued. The newer implementation doesn't use spaces
and simply resets the top of the window to be higher making the popup
interaction with the window more natural (no text disappears on the
lines the popup overlaps the text). changes can be identified form the
variables mTopMargin,mOldTopMargin and mNewTopMargin.

Unfortunately those changes revealed problems in cursor navigation that
needed to be addressed. Namely, the window will scroll up and down on
the line before last/second line at the top and similar problems for the
left and right. Those changes correspond to the function
EnsureCUrsorVisible()

Fixing those reveled yet more problems with scrolling past the end of
the file using the keyboard which required adding some more variables
and functions to support the correct handling, You find those changes in
the function MoveDown.

I also renamed some variables that had the wrong casing and fixed the
pasting but that is missing one line.
2024-12-23 10:35:53 +01:00
WerWolv
810cd40ccd impr: Replace strerror with C++ functions 2024-12-23 01:42:06 +01:00
WerWolv
f931beb49a impr: Make inserting bytes at the start of the file with insert mode work better 2024-12-23 01:33:52 +01:00
WerWolv
1c3dfc9b2f fix: ID collision in Jump To menu 2024-12-23 01:00:58 +01:00
WerWolv
a1d4545e29 fix: Don't allow negative regions in region widgets 2024-12-23 01:00:41 +01:00
WerWolv
8865db2007 lang: Added missing memory file rename key 2024-12-23 01:00:13 +01:00
WerWolv
d2056d9409 fix: Crash on exit 2024-12-23 00:59:55 +01:00
Nik
74e74ddc38 git: Make CodeQL CI use ninja 2024-12-23 00:06:59 +01:00
WerWolv
5fcb737559 fix: Only update widgets of settings that were changed
Fixed crashing on exit and speeds up settings writes
2024-12-20 21:23:19 +01:00
Nik
9303025427 git: Just disable coverage generation for now 2024-12-18 22:56:44 +01:00
WerWolv
680985fc13 git: Update gcovr filters 2024-12-18 21:57:40 +01:00
WerWolv
5a360eb614 patterns: Updated pattern language 2024-12-18 20:33:05 +01:00
paxcut
4a74bd78fd fix: Console either printed no newlines or printed extra ones. (#2016)
The reason for the error were the text preprocessor added to deal with
tabs was created to process entire files, not just lines or words. In
that context it cleaned trailing new lines if any existed but in the new
role that's not only unwanted but erroneous.

### Problem description
After that was fixed the console started to add two empty lines between
each output line. When splitting a string using new lines you need to
not add a new line to the last line created. Even if the text ends in an
end line, the split screen code is set to not discard empty lines.

### Implementation description
The fixes are straightforward.
2024-12-18 20:19:18 +01:00
WerWolv
0f53656952 build: Small ImPlot3D fixes to make it build on all platforms 2024-12-18 20:18:27 +01:00
WerWolv
9ca40d3651 build: Added ImPlot3D 2024-12-17 23:51:45 +01:00
WerWolv
ab12503f62 patterns: Drastically improved time it takes to find favorites 2024-12-17 23:37:39 +01:00
paxcut
b446d7fd4a impr: Make scrolling in pattern editor feel less janky (#2009)
I have implemented a fix that makes the scrollbars behave like they do
in VScode. Vertically you can scroll past the end of the file until only
the last line can be seen at the top. The horizontal bar behaves as if
every line was the same length which is the length of the longest line
in the file. Not only this creates a better user experience, but it also
fixes the annoying flicker that occurs when scrolling through large
files. Also, I have switched all the old draw calls to render text to
regular TextUnformatted calls which adds extra stability to the
resulting display.

To implement the behavior I added a dummy widget with the desired
dimensions.
2024-12-17 22:44:40 +01:00
WerWolv
fd46d85762 git: Another attempt fixing gcovr 2024-12-17 22:42:48 +01:00
WerWolv
fa421afb00 git: Ignore all gcov errors related to missing files 2024-12-17 22:07:16 +01:00
paxcut
a79d3e28ca fix: Crashes when getting tabs into text editor (#2008)
This time it may be for good. 


### Implementation description
As requested I added the preprocessing functionality into the pattern
editor. I had to duplicate a few functions and update the c++ library to
version 20. but now I can make sure the pattern editor doesn't see a tab
again. I also removed the preprocessor from where it was before because
it is not needed anymore. The changes were tested using a file that used
tabs for all its white space. The file was pasted into the pattern
editor and imported as well. I both cases no crashes occurred and the
files had no tabs on them.
2024-12-17 21:36:00 +01:00
WerWolv
fbb4f65735 patterns: Updated pattern language 2024-12-17 21:34:18 +01:00
WerWolv
00c62c90f6 git: Try to fix coverage scan 2024-12-17 21:33:53 +01:00
WerWolv
384aa6e6a9 fix: Narrow to wide type compare in loop in timestamp visualizer 2024-12-16 22:17:58 +01:00
WerWolv
1c755249ec git: Use ninja for building everything 2024-12-16 22:10:22 +01:00
WerWolv
2c303b5bf2 build: Actually fixed unit tests 2024-12-16 21:47:40 +01:00
WerWolv
415e3b4a93 impr: Added commit hash and branch to nightly popup on welcome screen 2024-12-16 21:37:34 +01:00
WerWolv
8d9b056c8c build: Fixed building of unit tests 2024-12-16 21:37:11 +01:00
WerWolv
a527a7f0b0 patterns: Updated pattern language 2024-12-16 21:32:19 +01:00
WerWolv
d78d955d11 impr: Better ellipsis usage in menus 2024-12-16 21:27:57 +01:00
BioTheWolff
9375a60cd9 feat: Implement paste behaviour popup when pasting over one-byte regions (#2004)
### Problem description
This PR implements the feature request described in #1995, that
describes a problem with the `Paste` vs `Paste all` commands. Users
could be thrown off by having `Ctrl+V` act as a simple "Paste over
selection", whereas it's generally accepted as a "Paste all".

### Implementation description
<!-- Explain what you did to correct the problem -->
This PR introduces a new setting, called "Paste behaviour" (under the
"Hex Editor" category).
This setting has three values:
- `Paste over selection`: the current implementation for ImHex. Pastes
only over the selection region, in this case pasting only one byte;
- `Paste everything`: allows ImHex's `Paste` to behave like a `Paste
all` when selecting one-byte regions;
- `Ask me next time`: prompts the user for a choice of behaviour
(default value).

*Note: as users generally use `Paste all` when selecting one-byte
regions, calling `Paste` when selecting over two or more bytes is not
affected by this change, and will still behave like the usual `Paste`
command.*

When selecting a one-byte region, and calling the Paste command, users
that have not defined a preferred behaviour in the settings will be
prompted to choose one, using a brand new popup. The popup also allows
the user to cancel, which will not change the settings' value, and will
cancel the paste action altogether.

### Screenshots
The new popup:

![image](https://github.com/user-attachments/assets/2b0fd532-d4e7-4209-9dd7-8a79278692ea)

The new setting:

![image](https://github.com/user-attachments/assets/2644c35e-7332-422e-8fae-ae8ad0507126)

### Additional things
I'm not very good with long descriptions, so I'm open to any suggestions
regarding the text that is included in the popup!
I do think however that we should keep a hint indicating that `Paste
all` is always an option, which could solve the issue altogether for
very new users.

---------

Signed-off-by: BioTheWolff <47079795+BioTheWolff@users.noreply.github.com>
Co-authored-by: Nik <werwolv98@gmail.com>
2024-12-16 20:35:48 +01:00
WerWolv
bb99b9a0ef fix: Shortcuts acting as duplicates in settings 2024-12-16 20:26:04 +01:00
WerWolv
313e59d7f9 fix: Shortcuts applying to multiple views at once 2024-12-16 20:14:26 +01:00
WerWolv
e34e0e62f2 patterns: Fixed json builtin types throwing non-patternlanguage exceptions 2024-12-15 23:13:43 +01:00
paxcut
212f75f1cb fix: Tabs messing up content of text editor (#2005)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
<!-- Describe the bug that you fixed/feature request that you
implemented, or link to an existing issue describing it -->

### Implementation description
<!-- Explain what you did to correct the problem -->

### Screenshots
<!-- If your change is visual, take a screenshot showing it. Ideally,
make before/after sceenshots -->

### Additional things
<!-- Anything else you would like to say -->
2024-12-15 23:08:26 +01:00
WerWolv
a07c79efcb fix: Pattern editor shortcuts being set to use CTRL on macOS 2024-12-15 22:39:24 +01:00
WerWolv
89090b25e3 impr: Various shortcut improvements 2024-12-15 21:44:43 +01:00
WerWolv
721164e562 fix: Deinitialization order 2024-12-15 21:44:36 +01:00
BioTheWolff
b8ba980a20 fix: Chinese (Simplified) translation showing up twice (#2006)
### Problem description
As described in issue #1841, there was a duplicate on the `Chinese
(Simplified)` translation.
After closer inspection, this came from an i18n file (Script loader,
specifically) having a bad ISO code (`zh_CN` instead of the expected
`zh-CN`).

This also caused a big impact on end users, as loading the latter
(`zh_CN`) would cause the whole UI to be displayed in English (the
fallback language), and only the script loader being translated into
Chinese.

### Implementation description
Fixed the i18n code in the Script loader file.

### Additional things
Closes issue #1841

Signed-off-by: BioTheWolff <47079795+BioTheWolff@users.noreply.github.com>
2024-12-15 17:20:04 +01:00
WerWolv
79ded38434 patterns: Updated pattern language 2024-12-15 14:12:27 +01:00
WerWolv
f52db884a9 lang: Update casing of next provider / previous provider options 2024-12-15 12:16:57 +01:00
WerWolv
ee4bb33b0a impr: Display sub menus for shortcut settings 2024-12-15 11:54:10 +01:00
WerWolv
caf8fa8e25 impr: Show byte relationship diagrams side by side if there's enough space 2024-12-15 11:46:54 +01:00
WerWolv
c46dea4c9e impr: Update settings menu values when settings are changed 2024-12-15 11:12:56 +01:00
WerWolv
002b7b4f87 impr: Make Copy as ASCII string use ALT + C to be more consistent 2024-12-15 11:02:34 +01:00
WerWolv
0a6a8c671f impr: Better naming for various menu entries 2024-12-15 11:02:20 +01:00
WerWolv
36014b706d fix: Wrong header location in disassembler view 2024-12-15 10:52:11 +01:00
paxcut
df5e01d4eb impr: Better 3D Visualizer error messages, wrap long visualizer errors (#1969)
### Problem description
Long error messages were forcing the width of the window to span the
entire screen.

### Implementation description
The fix was sending the long message to the log and outputting a short
message to the 3d visualizer window.

---------

Co-authored-by: WerWolv <werwolv98@gmail.com>
2024-12-15 10:12:14 +01:00
WerWolv
c6f1525f55 git: Silence last brew call 2024-12-15 10:01:24 +01:00
WerWolv
5511259f2d git: Updated more workflows 2024-12-15 00:44:32 +01:00
WerWolv
f2ea7ca5d1 git: Silence brew github actions annotations 2024-12-15 00:28:22 +01:00
WerWolv
6184bbeae2 build: Updated libwolv 2024-12-14 23:55:04 +01:00
WerWolv
21506578f5 impr: Removed more instanced of codecvt 2024-12-14 22:39:07 +01:00
WerWolv
f39f395393 impr: Replace codecvt with libwolv conversion functions 2024-12-14 22:20:48 +01:00
WerWolv
ed0a94659e impr: Added load and base address to instruction pl types 2024-12-14 21:52:19 +01:00
WerWolv
7f75706584 impr: Replace hex::unused with std::ignore 2024-12-14 21:35:54 +01:00
WerWolv
3f316e42f2 build: Remove unavailable warning flags from gcc builds 2024-12-14 21:35:42 +01:00
WerWolv
4a331c0331 git: Replace gcc-toolset-12 with gcc-toolset-14 fir EL9 runner 2024-12-14 20:36:32 +01:00
WerWolv
6a28de100c impr: Rename font definition files 2024-12-14 20:36:09 +01:00
WerWolv
992f18b94b impr: Optimize build times a bit 2024-12-14 19:15:49 +01:00
Nik
040a606b39 feat: Added various custom built-in types to the pattern language (#1991) 2024-12-14 16:52:36 +01:00
BioTheWolff
13e079d1b8 feat: Add capability to paste as string literal in files (#1998)
### Problem description
As suggested in #1904, ImHex could benefit from having the capability of
pasting text directly into the editor.
This also complements the "Copy as... ASCII string" capability already
implemented in the software.

### Implementation description
A new shortcut called `Paste all as string` (to resemble the naming of
the `ASCII string` copy option) now allows to paste plaintext directly.
This shortcut is mapped to the `CTRL + ALT + SHIFT + V` keybind.

Internally, a new flag called `asPlainText` has been added to the
`pasteBytes` function, to minimise code changes and streamline code
readability.
The buffer is a simple type cast of the clipboard, without any
modification applied, which is then handed to the provider's `write`
function.

### Screenshots
The new shortcut is visible in the menu, just below the other paste
options:

![image](https://github.com/user-attachments/assets/41a2a512-5c39-4984-bab6-114c58266351)

---------

Signed-off-by: BioTheWolff <47079795+BioTheWolff@users.noreply.github.com>
2024-12-14 16:52:14 +01:00
Roman
d9a7f40eb4 fix: Shortcuts not being disabled correctly when menu items are disabled (#1992)
Fix crash on UNDO/REDO shortcut press when in "title screen"

### Problem description
ImHex crashes when (by default CTRL + Z/Y) undo/redo is pressed when on
"title"/"starting" screen (no file open, tested on Windows release build
and Linux [WSL] from-source build).

This is due to the shortcut's callback being called even if the
`provider` is `nullptr`. (see `createEditMenu` function).
Theoretically, this is prevented by the `enabledCallback` function
passsed to `addMenuItem`. In this case, though,
`addMenuItem` correctly propagates `enabledCallback` to menu item
creation but does not pass `enabledCallback` to
shortcut creation. Thus, when handling shortcuts, `enabledCallback` is
not used at all and the shortcut's callback
can be called in contradiction with its preconditions. (specified by
`enabledCallback`)

### Implementation description
The implementation wraps the callback in a check that decides whether
the shortcut is enabled or not.

(see changed files)
```c++
        auto callbackIfEnabled  = [enabledCallback, function]{ if (enabledCallback()) { function(); } };
```

This function is then passed along instead of the `function` (shortcut's
callback).

Alternatively, we can check for `nullptr` in the callback directly. This
would require modification of `createEditMenu`'s contents.
(I did not choose this implementation because I do not think it
addresses the root of the issue).

### Screenshots
None

### Additional things
I'm not sure how big of a deal it is but I am unsure whether I can
capture (`[enabledCallback, function]`) by reference or not.
2024-12-14 16:51:40 +01:00
paxcut
8d123da847 feat: Added goto line popup to text editors (#1984)
Since the popup is fairly small I opted for a straight addition parallel
to the find/replace. To make code more clear the functions that create
each popup were coalesced and made their interface simpler. That forced
a reorganization of the data processing which translates to a larger
number of changes than usual. Most of those changes are just moving some
action from one function to another.

The old method to identify popups using the size and position of the
window was dropped in favor of one based on child windows and using
their names for a much easier and robust identification.

Added specialized functions to text editor to jump to a line or to given
coordinates with a simple interface that simplifies older code that
performed the same task.

Because this PR modifies heavily the same code as the previous PR (1983)
it is also included here to make merging easier.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-12-14 16:50:45 +01:00
Nik
093310a9e5 git: Updated CI to latest available compilers and distros (#2003) 2024-12-13 00:07:46 +01:00
WerWolv
21b315b97e impr: Added image load and image base address to disassembler
#1994
2024-12-10 20:33:28 +01:00
Nik
c70cc3a6f1 git: Disable AppArmor to make fedpkg not fail anymore (#1997) 2024-12-10 13:34:39 +01:00
WerWolv
1e71d8afc0 feat: Added Disassemble selection option to the Edit menu
#1994
2024-12-09 21:35:08 +01:00
WerWolv
cb6b74b269 fix: Use after free when deleting data processor nodes with errors 2024-12-09 14:40:07 +01:00
WerWolv
a1e399aa1a fix: Use after free in Text Editor when copying ErrorHoverBoxes 2024-12-09 14:39:46 +01:00
WerWolv
e1dfdd9400 fix: Missing include 2024-12-09 00:05:36 +01:00
iTrooz
6ab2e81f1c chore: Add documentation about popup opening 2024-12-06 23:40:05 +01:00
paxcut
cf09029847 feat: Added clickable links to error messages in the pattern editor (#1988)
Errors printed in the console can be clicked to have the cursor jump to
the source code line where the error is at.

The mouse cursor changes its shape to indicate which parts of the error
message can be clicked on the console. When the cursor jumps, the text
editor takes the focus away from the console and it scrolls the window
to make the line with the error is visible if it isn't. This code uses
the function created for the go-to PR but adds code to switch focus to
the target. When the codes are merged please keep both the part that
jumps the cursor and the part that sets the focus.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-12-06 22:45:36 +01:00
WerWolv
d02e170dac fix: Build issue on systems where size_t is not u64 2024-12-06 22:03:12 +01:00
WerWolv
2b715bb0de impr: Batch fills into larger chunks 2024-12-06 10:15:32 +01:00
BioTheWolff
2dcaf2c77b fix: Various achievements issues (Edit the Hex, ROM Hacks) (#1985)
### Problem description
As described in #1846:
- the `Edit the Hex` achievement doesn't unlock when it should
- the `ROM Hacks` achievement is not using event-driven architecture
(the functions call `unlockAchievement` themselves)

### Implementation description
Firstly, for the `Edit the Hex` achievement:
- replaced the old event listener on `EventPatchCreated` with a listener
on `EventProviderDataModified`, which picks up bytes changes
- ensured the provider data change comes from a File provider, else
unlocking the achievement wouldn't make sense
- *Note*: a discovered side effect is that the "Fill" function modifies
the provider byte per byte (with a for loop)
- there is no use in testing the size of the data change, as it is
always 1 byte
- the Fill function could probably be reworked to fill in whole regions
at a time?

About the `ROM Hacks` achievement:
- implemented the new, still unused `EventPatchCreated` event.
- signal signature is `const unsigned char *, u64, const IPSKind`:
buffer pointer, buffer size, and IPS kind (IPS/IPS32)
- make use of the `::post` and `::subscribe` methods on said event to
unlock the achievement
- **WARNING::behaviour change**: the event's `post` signal has been
moved in the success branch of the IPS generation condition, meaning
that achievement will only unlock if IPS patch export has worked. I felt
it would make more sense than unlocking an achievement on an error, if
there was any to raise.

---------

Signed-off-by: BioTheWolff <47079795+BioTheWolff@users.noreply.github.com>
2024-12-06 00:36:42 +01:00
BioTheWolff
1b9f4f33de feat: Added export disassembler results to ASM file (#1987)
### Problem description
<!-- Describe the bug that you fixed/feature request that you
implemented, or link to an existing issue describing it -->
This PR implements the feature request #1781, that suggests adding a
button to export disassembled instructions into an ASM file.

### Implementation description
This adds a button to export the current disassembled instructions to an
ASM file. Said file is suffixed by an `.asm` extension if not specified
at file creation.

*Note: the file is written to for every `Disassembly` item in the
vector, as it was the easiest and most memory-conservative way of doing
it.*

The file creation task is implemented based on IPS patch exports, so it
fits the same pattern.
A `ToastError` is raised when the ASM export could not complete
successfully.

Translations have been implemented for both `en_US` and `de_DE` for the
two new keys:
- `hex.disassembler.view.disassembler.export`: file export button
- `hex.disassembler.view.disassembler.export.popup.error`: error popup
text

### Screenshots
The button is disabled when the disassembler is working, or when the
disassembly vector is empty.

Here is a complete breakdown of the visual changes:

![image](https://github.com/user-attachments/assets/af0ce701-9d77-45f1-9a5a-90d68d00bb0d)

### Additional things
As expected, the exporter writes every item's `mnemonic` and `operators`
to the file, producing an output like this:

`example.asm`
```asm
.byte 0x7f, 0x45, 0x4c, 0x46
andeq r0, r1, r2, lsl #2
andeq r0, r0, r0
andeq r0, r0, r0
eorseq r0, lr, r3
andeq r0, r0, r1
andeq r1, r0, r0, asr #32
andeq r0, r0, r0
andeq r0, r0, r0, asr #32
```

---------

Signed-off-by: BioTheWolff <47079795+BioTheWolff@users.noreply.github.com>
2024-12-05 23:04:38 +01:00
Justus Garbe
3c73f88a52 fix: AES ECB mode in Data processor not working at all (#1986)
Fix the AES ECB mode in the data processor along with some other misc
fixes:
- Fixed nullpointer node not working
- Fixed crypto module incorrectly using mbedtls api
- Fixed crypto module ignoring mbedtls errors
- Fixed silently ignoring of errors in AES node
2024-12-05 20:56:43 +01:00
paxcut
8acdc19be4 fix: Pattern Editor context menus being entries greyed out when they shouldn't be (#1983)
Some context menu entries that were available as shortcuts were greyed
out. This PR aims to fix them and improve how context menus work for the
text editor and the console. The improvements include:
- automatic focus on right click
- automatic selection on right click. If selected text is right-clicked
then copy, cut and find will use the selection, if no selection is
clicked but there is text were right-clicked, then the word will be
selected and used. If right-clicking empty space copy and cut will be
greyed out and find will start empty.
- similar functionality now exists for the console as well except the
menu has fewer options due to it being read-only.
- added esc to close console context menu
2024-12-05 19:34:51 +01:00
WerWolv
22252d9044 fix: Patterns in pattern data view not being editable in providers that are not writable from the start 2024-12-05 16:37:31 +01:00
WerWolv
5948a74ad1 fix: Multiple memory corruption issues 2024-12-05 16:36:27 +01:00
alexkar598
e46d9d7650 fix: HexII visualisation does not allow hex characters in the edit field (#1982)
### Problem description
At the moment, attempting to edit files using HexII data visualization
is impossible as the editing fields only allow numeric characters but is
interpreted as a hex value

### Implementation description
I yoinked the params used for the hex visualization edit field. 

### Screenshots

![image](https://github.com/user-attachments/assets/2d61bf61-9893-4cfb-a2bf-6ff954aef903)

### Additional things
Ideally this should instead accept the format used by HexII, but I have
what scientists describe as a skill issue and this at least makes it
possible to use HexII without switching back to hex for editing.
2024-12-03 23:05:00 +01:00
Justus Garbe
813276c907 feat: Add constant data input to buffer node (#1981)
Added a hex data input field to the buffer node in the data processor.


![image](https://github.com/user-attachments/assets/a98e1174-7d35-4130-b9f7-9ef5d0703bc7)
2024-12-03 23:03:04 +01:00
BioTheWolff
7032473ecf impr: Added MIME types for project files on UNIX systems (#1980)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
<!-- Describe the bug that you fixed/feature request that you
implemented, or link to an existing issue describing it -->
This PR addresses issue #491 regarding the inability to open ImHex
project files (`.hexproj`) directly from various UNIX Desktop
Environments.

_NB: This PR's scope is limited to UNIX systems, as I have no access to
MacOS systems and could not find a way to automatically create file
associations on Windows._

### Implementation description
<!-- Explain what you did to correct the problem -->
In order for project files to be recognised as such, we need to create a
new MIME type. According to [RFC 6838 section
3.2](https://www.rfc-editor.org/rfc/rfc6838#section-3.2), additional
application MIME types should be defined with a vendor prefix.
_NB: This is preferred over the deprecated `x-` prefix, although RFC
6838 states that the vendor should be "a well known producer"_

This PR proposes a new mime type for ImHex project files:
`application/vnd.imhex.proj`, and associates it with the file format
`*.hexproj`.

It also implements small changes in the Arch Linux and RPM builds, in
order to correctly ship the MIME XML file during installation.

### Additional things
<!-- Anything else you would like to say -->
The implemented change has been manually tested in the following UNIX
systems and graphical environments:
- Arch Linux, with Gnome 47.2
- Arch Linux, with XFCE4
- Fedora 41 Workstation Edition, with Gnome 47.0
- Fedora 41 Plasma, with KDE Plasma 24.08.2
- Ubuntu 22.04.5, with Gnome 42.9

Which tests the functionality of the following build types:
- Arch Linux's `.zst` packages
- Debian `.deb` packages
- RPM packages

For Arch Linux and RPM packages, this has been tested to ensure that
post-installation hooks (such as regeneration of the MIME database) is
correctly executed (which it is). No further changes than those
implemented in the PR are needed.

---------

Signed-off-by: BioTheWolff <47079795+BioTheWolff@users.noreply.github.com>
2024-12-03 23:02:40 +01:00
WerWolv
807f1fb561 patterns: Updated pattern language 2024-12-02 21:16:35 +01:00
WerWolv
296f80ffe5 fix: Data information sections getting duplicated in NullProvieders 2024-12-02 21:16:20 +01:00
paxcut
d45e0d1cac impr: Replace all asserts with IM_ASSERT in the Text Editor (#1979)
All asserts in TextEditor.cpp were replaced with IM_ASSERTs so that if
they are hit ImHex won't crash and give a nice popup message instead.
2024-12-02 20:21:57 +01:00
WerWolv
4b8f9984d5 fix: Get rid of ranges again because still not all compilers support it 2024-12-02 20:21:15 +01:00
WerWolv
7623610704 build: Updated dependencies 2024-12-01 23:24:57 +01:00
WerWolv
a7fe384a31 feat: Added entropy drop/spike annotations to the entropy graph 2024-12-01 22:27:04 +01:00
WerWolv
485ce887ea patterns: Updated pattern language 2024-12-01 17:38:59 +01:00
Nik
2a0bb79513 fix: Potential overflow when calculating audio sample index
Fixes
[https://github.com/WerWolv/ImHex/security/code-scanning/223](https://github.com/WerWolv/ImHex/security/code-scanning/223)

To fix the problem, we need to ensure that the multiplication is
performed using a larger integer type to avoid overflow. This can be
achieved by casting one of the operands to `u64` before performing the
multiplication. This way, the multiplication will be done in the larger
type, preventing overflow.

We will modify the line `index += frameCount *
device->playback.channels;` to cast `frameCount` to `u64` before the
multiplication.


_Suggested fixes powered by Copilot Autofix. Review carefully before
merging._

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2024-12-01 16:07:24 +01:00
paxcut
21ae88702f fix: Empty text editor has no cursor. (#1976)
Even if focus is given to the pattern editor the cursor will not show
until the editor contains printable chars.

### Problem description
I was using the wrong condition to enter the loop that skipped the
default empty document.

### Implementation description
The fix was to check if there are lines of text that need to be
processed even if they are empty.
2024-12-01 09:58:37 +01:00
BobSmun
0ff1bb392c fix: CRC64 parameters being limited to 32bit (#1975)
This addresses #1974
2024-11-30 18:35:03 +01:00
WerWolv
01af2f364c patterns: Updated pattern language 2024-11-30 13:49:27 +01:00
paxcut
a639dddd19 impr: Turned static variables into member variable in the Text Editor (#1973)
to avoid potential problems in the future if opening several popup
windows at the same time becomes possible.
2024-11-29 20:44:56 +01:00
WerWolv
71ec6c5061 fix: Separator stride setting displaying incorrect values 2024-11-29 20:44:04 +01:00
WerWolv
8c4c4f5e8b impr: Hide segment number in hex editor when holding down shift 2024-11-29 20:43:37 +01:00
WerWolv
2c2d3b2de3 feat: Display visualizers in pattern tooltips 2024-11-29 20:23:36 +01:00
WerWolv
caae5c9711 fix: Move visualizer drawer to correct library 2024-11-29 17:37:02 +01:00
paxcut
72822d03aa fix: Stereo sound visualizations (#1970)
Even tough the sound visualizer has `channels` as one of its parameters
it wasn't using it properly.

### Problem description
The biggest problem is that at each frame the index was being advanced
per channel frame_count increments. The number of channels also
determines how many graph will be needed to display the graphs of the
visualized sound files. Besides these two problems there were many
others like incorrect playback time, cracking audio, etc. which will not
be mentioned.

### Implementation description
To sample the signal a channel sampler was created based on the one used
previously that returns as many sampled signals as there are channels.
This PR aims hopefully at fixing all the problems encountered, and it
has been tested extensively using `Audacity` exported samples to ensure
the visualizer fidelity on playback and graph appearance.

### Screenshots

![image](https://github.com/user-attachments/assets/03453860-693f-4af4-b6c6-e828a102c389)
2024-11-29 17:22:22 +01:00
paxcut
9de3dd89c5 feat: Added support for inline visualizers in custom data inspectors (#1966)
### Problem description
This PR aims at making inline visualizers work on the data inspector so
that more rgb encodings can be added as custom pattern language
inspector rows. This was never setup to work because the inline
visualizer rendering function was a private member function.

### Implementation description
In order to be accessible from the inspector class the rendering
function was made public.

### Additional things
Missing still is the tooltip to make it behave like other color entries.
2024-11-29 17:20:28 +01:00
dependabot[bot]
bcb69b9855 git: bump dawidd6/action-download-artifact from 3 to 6 (#1972)
Bumps
[dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact)
from 3 to 6.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-29 13:55:41 +01:00
paxcut
6d2761f141 feat: Added multiline search/replace and fixed various crashes. (#1911)
### Problem description
Previous implementation ignored everything after the first newline.
Other changes include:
- Added isEmpty() function that checks if editor has no content.
- replaced asserts with default behavior to avoid unneeded crashes.
- fixed off by one error in DeleteRange()
- some crashes occurred because readily available corrective actions
were not being taken. For example start/end being -1 in DeleteRange().
- At the heart of search/replace is the ability to translate from
indices into the text string to line/column coordinates used for
everything. To this end a function (StringIndexToCoordinates) was added
to do the translation taking utf-8 chars into account. This made the
recently added Utf8BytesToChars function unneeded, so it was removed.
- Removed commented out code that is not useful anymore. Also removed
tooltip code which is also unused.
- Removed unused parameter wrapAround to FindNext().
2024-11-29 09:37:05 +01:00
WerWolv
05c25b6aff patterns: Updated pattern language 2024-11-28 21:27:02 +01:00
WerWolv
9be9eb90f6 feat: Added hex editor segment separators 2024-11-28 21:26:55 +01:00
WerWolv
71f2f3a5fc patterns: Updated pattern language 2024-11-27 20:44:14 +01:00
WerWolv
862b1d407c patterns: Updated pattern language 2024-11-26 21:27:09 +01:00
WerWolv
5da0da48c8 build: Fix building for webassembly 2024-11-25 00:08:08 +01:00
WerWolv
3f1a51e350 patterns: Updated pattern language 2024-11-24 23:48:13 +01:00
WerWolv
d167e43252 impr: Optimization for searching for favorite and group patterns 2024-11-24 23:21:23 +01:00
WerWolv
fe9eecd031 build: Updated ImGui to v1.91.5 2024-11-24 18:55:56 +01:00
WerWolv
ded8cff415 build: Update to macOS 13 in more places 2024-11-24 15:51:22 +01:00
WerWolv
3497716a00 git: Bumped macOS runners to macOS 13 2024-11-24 15:33:55 +01:00
WerWolv
c78b4a3343 patterns: Updated pattern language 2024-11-24 15:16:06 +01:00
WerWolv
17359be58a build: Fixed remaining build issues 2024-11-24 14:16:48 +01:00
paxcut
382a62343d fix: Fixes for breakpoints (#1923)
WARNING: this PR won't compile unless [PR 132 from pattern language
repository](https://github.com/WerWolv/PatternLanguage/pull/132) is
merged first. Some changes here are shared by at least another PR to
this repository but there should not be any conflicts as the shared
changes are identical.

### Problem description
fix: Editing patterns with breakpoints sets behaves unexpectedly. As a
simple example, set a breakpoint and insert a blank line somewhere
before the breakpoint location. The breakpoint will appear to move but
in reality it hasn't. To see this set another breakpoint elsewhere in
the file and the old one will be displayed where it is really located
at.

The reason for this and many other problems with breakpoints is that
currently ImHex keeps two set of breakpoints in text editor and in
evaluator that are independent of each other, ie, changes to one don't
affect the other. This PR aims at synchronizing the two sets through the
per provider breakpoints that exist in view pattern editor.

### Implementation description

It accomplishes this by making the text editor version of breakpoints
the principal source of vectors and the ones in evaluator the effective
version. The first allows one to modify the text around and at the
breakpoint and notify others that the changes have induced changes in
the breakpoint locations. The effective breakpoints allow the insertion
and deletion of breakpoints.

View pattern editor is where breakpoints are updated. It receives
notifications from text editor about changes and then makes sure the
version in evaluator is updated with those changes. View pattern editor
also manages breakpoint addition and deletion so before making changes
it gets a copy of the current ones from text editor, sets the ones in
evaluator, uses the evaluator functions to add or delete breakpoints and
finally sets the text editor version with the new version.
2024-11-24 12:06:44 +01:00
paxcut
7e0f60615b fix: Achievements resetting after restart (#1965)
### Problem description
Loading a file on the command line or using the context menu in windows
was triggering an achievement before the achievements file was loaded.
This resulted on the achievements.json file to be overwritten with all
the achievements reset except for the one to open files.

### Implementation description
This PR fixes the problem by introducing a boolean that is used to check
if the file has been loaded.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-11-24 11:34:44 +01:00
Kirill R.
e1a49b38a7 build: Fix macos blurry flicker (#1956)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
<!-- Describe the bug that you fixed/feature request that you
implemented, or link to an existing issue describing it -->

seem to fix #1809. I couldn't build the app, so hoping that's the right
place to update resulting `Info.plist`

### Implementation description
<!-- Explain what you did to correct the problem -->

### Screenshots
<!-- If your change is visual, take a screenshot showing it. Ideally,
make before/after sceenshots -->

### Additional things
<!-- Anything else you would like to say -->
2024-11-24 11:31:30 +01:00
paxcut
4333b8c351 fix: Text cursor not moving to the correct location with ctrl+c -> ctrl+v (#1951)
This code fixes issue #1950 This PR depends on PR [#27
](https://github.com/WerWolv/libwolv/pull/27) on libwolv repo


### Problem description
See description of the problem on the issue linked above

### Implementation description
The code in the PR uses function added to the libwolv repository to
remove tabs if they exist on the provider. Additionally, any pasted tab
on the pattern editor will be translated to spaces automatically. This
code was tested successfully using the pattern posted in the issue.
2024-11-24 11:31:06 +01:00
paxcut
6464377a89 impr: Added code so that when debugger pauses at a line, the line is highlighted (#1932)
regardless of the method used to pause the evaluation at that line.
2024-11-24 11:29:08 +01:00
Shubhankar Sarangi
4fcf732814 impr: Reserve space to avoid multiple allocations when loading scripts (#1929)
std::forward ensures that the arguments are perfectly forwarded to
loadScript
By reserving space in the features vector based on the size of scripts,
we can avoid multiple memory allocations during the loop. If an
exception occurs, returning an empty vector immediately clarifies that
no scripts were loaded. Without reservation, each call to emplace_back
could potentially trigger a reallocation if the current capacity is
exceeded, which is costly in terms of performance. This leads to more
efficient memory management and can significantly speed up the execution
time when dealing with a large number of scripts.


![image](https://github.com/user-attachments/assets/3e290162-fb8b-4f00-a71b-6009494b2dab)
2024-11-24 11:28:45 +01:00
paxcut
0d4f3e5735 fix: ImHex hangs when pressing F5 while in a breakpoint (#1920)
### Problem description
fix: pressing F5 (start pattern execution ) while being in a break point
hangs ImHex.


The reason for hanging ImHex was that the shortcut procedure was not
checking if the pattern was already running, and it attempted to start
another one. This makes ImHex wait indefinitely for a lock to be
released

### Implementation description

To fix the hanging of ImHex we check the runtime for current evaluation
and if detected we stop it. In all cases the evaluation is started
again.
2024-11-24 11:24:42 +01:00
paxcut
1f2e453e20 fix: Various pattern editor settings not being per-provider (#1917)
### Problem description
Fixes provided for the following unreported bugs.

- Environment variables are set to be per provider but used as if they
are not. When a project is loaded all the environment variables for each
provider are assigned to the first provider making it impossible to add
new ones to the other providers.

- When switching providers, the text editor selection, the text editor
breakpoints, the console text, the console selection and the console
cursor position of the old provider are being assigned to the new
provider

### Implementation description

This PR aims at fixing both errors by:
- using variable defined to be per provider so that they affect their
provider only when necessary.

- creating new per provider variables and using them so that each
provider has their own console, selections and breakpoints.

In order to support the newly added per provided features new functions
were added to the text processor for selections and breakpoints. All the
new per provider variables are defined and used in view pattern editor.
2024-11-24 11:24:14 +01:00
Paulo Casaretto
5236c7b468 fix: Use machine headers to auto select arch for macOS process memory provider (#1910)
Fixes https://github.com/WerWolv/ImHex/issues/1807

### Problem description

Build fails for MacOS x86-64 due to using a wrong architecture header.

### Implementation description

Used the headers for mach that auto select the correct architecture.

### Additional things

This is being used in https://github.com/NixOS/nixpkgs/pull/330303 as a
patch

Co-authored-by: Nik <werwolv98@gmail.com>
2024-11-24 11:21:29 +01:00
Ikko Eltociear Ashimine
1738e8883f fix: Typo in tar.hpp (#1909)
occured -> occurred
2024-11-24 11:20:51 +01:00
paxcut
cc4563afb0 impr: Added back missing runtime error markers (#1907)
### Problem description
Moving error markers to be underwaved created s couple of errors: 
- Markers that were 1 char long and located at the end of the line
didn't show on text editor.
- Markers that had zero length or no stack trace didn't show on text
editor.

### Implementation description

- The first error was caused by an off by one error in the column index.
- There was no implementation for errors that had no location or zero
length. Now errors with no location will be shown at the beginning of
the line where they occur. Errors with zero length will be marked from
their location to the end of the line, therefore, errors with no stack
trace will be marked from the beginning to the end of the line.
2024-11-24 11:20:15 +01:00
paxcut
4b3bf2f358 fix: Textures, uv coordinates and light source not updating properly. (#1872)
### Problem description
The only time textures would update was through the file picker. Once UV
coordinates were used, disabling them didn't have any effect because the
vertex array didn't invalidate the corresponding buffer array. When
`shouldUpdate` is true, the light source needs to know as well,
otherwise it will set the location at 0,0.

### Implementation description

Textures were fixed by creating a member variable that holds the file
name of the texture used in the last model rendering.

Instead of invalidating buffer arrays it is much simpler to define a
default UV coordinate set for the case when no UV is specified. if a
texture is not present then the values of UV will not be used. If there
is a texture it must be a minimum of 1 pixel in size. So we choose the
UV coordinates so that every vertex gets assigned the color at the 0,0
coordinate of the texture.

When `shouldUpdate` is on, we also turn `shouldUpdateLightSource` on.

Also included are some formatting changes that are purely aesthetic.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-11-24 11:18:19 +01:00
WerWolv
80084f5c5a patterns: Updated pattern language 2024-11-24 11:17:29 +01:00
descawed
6d14b3f6bd Fix process memory provider on Linux (#1933)
### Problem description
The process memory provider currently doesn't function correctly on
Linux due to incorrect handling of the special procfs file
`/proc/<pid>/maps`. I don't know if some of this behavior could vary by
distro and/or kernel version, but I've observed the following issues in
my Ubuntu 24.04 environment.

- The current code in master calls `file.readString()` which attempts to
determine the size of the file by [seeking to the
end](https://github.com/WerWolv/libwolv/blob/master/libs/io/source/io/file_unix.cpp#L148).
However, procfs files don't have a defined size, so this fails with a
return of -1. libwolv [interprets this as the file size and attempts to
allocate an enormous
buffer](https://github.com/WerWolv/libwolv/blob/master/libs/io/source/io/file.cpp#L30),
which results in an exception, so ultimately the process memory provider
is unusable on the current code.
- The previous version of the code that went out in 1.35.4 was calling
`readString` with a fixed maximum size of `0xF'FFFF`. This avoids the
seek issue, but when working with special files, a single `read` call
isn't guaranteed to read the requested number of bytes even if that many
bytes are available. In practice, on my machine, this call only ever
reads the first few dozen lines of the file. So the feature works in
this version, but it's unable to see the vast majority of the process'
address space.
- On a more minor note, on rows in the `maps` file that have a filename,
the filenames are visually aligned by padding spaces between the inode
column and filename column. ImHex includes these spaces as part of the
filename, resulting in most of the path being pushed out of the visible
area of the window.

### Implementation description

- To ensure the entire `maps` file is read, I've changed the code to
read from the file in a loop until we stop getting data. I've also set a
fixed limit on the maximum number of bytes to read in one go to avoid
issues with trying to determine the file size.
- I've added a `trim` call to remove any padding around the filename.

### Screenshots
Exception in `file.readString()` in current code (for some reason this
also causes the window to become transparent):

![mem_regions_exception](https://github.com/user-attachments/assets/ac9f472b-3d60-446d-be9c-b028b041e547)

Abridged memory region list in 1.35.4:

![mem_regions_truncated](https://github.com/user-attachments/assets/44e60b23-49f8-41b9-a56b-54cb5c82ee72)

Complete memory region list after this PR:

![mem_regions_working](https://github.com/user-attachments/assets/bdb42dc6-bcd3-42b1-b605-a233b98e8d2e)

### Additional things
I was focused on fixing this ImHex feature here, but I wonder if some of
this should be addressed in libwolv. Maybe `readBuffer` in file_unix.cpp
should read in a loop until it has the requested number of bytes or
encounters EOF/error?

---------

Co-authored-by: Justus Garbe <55301990+jumanji144@users.noreply.github.com>
2024-11-07 13:41:04 +01:00
iTrooz
592f613a61 fix: re-enable C/C++ languages in CMake (#1942) 2024-10-24 08:14:07 +02:00
WerWolv
3739bcc40c fix: Multiple race conditions with pattern sorting 2024-10-22 16:20:08 +02:00
WerWolv
101c7a36fb patterns: Updated pattern language 2024-09-18 23:54:56 +02:00
WerWolv
21be959cba fix: Another text editor merge issue 2024-09-15 16:14:43 +02:00
WerWolv
b3a0ebe7b6 fix: Some merge issues 2024-09-15 15:55:21 +02:00
paxcut
96a588bd86 fix: F3 failed to locate the correct set of matches if file was edited after doing a search (#1867)
### Problem description
The bug can be reproduced as follows:
1) Using Ctrl-F do a search for a term that occurs several times in the
file. and press F3 to visit them.
2) Go back to the fop of the file and insert 3 blank lines. 
3) Pressing F3 once or many times will not find the term entered above.


### Implementation description
The reason for this bug is that the positions of the matches are not
being reset when changes can potentially move them.
The fix consists on resetting the search locations when changing the
contents of the file and redoing the search after the changes are made.
The bug was specially problematic when doing replace because the
replacement position would be identified as a match. This PR fixes
replace as well.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-09-15 15:32:10 +02:00
paxcut
866b956680 feat: Added per provider cursor position for the Pattern editor (#1861)
### Problem description
Currently, the pattern editor does not remember where the cursor is
located in each provider. For example, suppose you have 2 providers in
your project, and you scrolled down to line 200 in the first pattern to
make some changes and remembered that the code you want to insert is in
the second provider. Then you switch to the second provider, look for
the code and find it in line 235. Switch back to the first one, and you
are at the beginning of the file. So you again look for the line to edit
paste it to realize that it needs code a few lines before the place you
found it. You switch to the second provider, and you are at the top
again. This gets annoying very fast.

### Implementation description

This PR ensures that, when you return to the pattern in the editor for
any of the opened providers, the cursor will still be at the same place
it was when you switched to a different one. Each provider pattern saves
its cursor position and returns to it when you switch to that provider.
It does that by creating a PerProvider variable and using it when
providers are first opened to set it to the origin and when switching
providers it first saves the position of the old provider and then loads
and sets the saved position of the new provider.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-09-15 15:28:37 +02:00
paxcut
d88252c6fd fix: Unable to resize 3d-visualizer window in x-direction (#1860)
changes needed were:
1) add an extra dummy empty widget so that width of child and parent are
not always the same. 2) Width of reset button needs to be adjusted when
the width of the child is decreased so that the parent is decreased too.

<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
<!-- Describe the bug that you fixed/feature request that you
implemented, or link to an existing issue describing it -->

### Implementation description
<!-- Explain what you did to correct the problem -->

### Screenshots
<!-- If your change is visual, take a screenshot showing it. Ideally,
make before/after sceenshots -->

### Additional things
<!-- Anything else you would like to say -->
2024-09-15 15:27:39 +02:00
paxcut
414e7d36a0 fix: Double-clicking a string selects the closing double quotes (#1862)
This is a simple fix for a simple issue. Just check if the last char in
the selection is a double quote and if it is, make the selection one
char shorter.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-09-15 15:27:24 +02:00
paxcut
e0b4931a54 fix: 3D visualizer running very slowly with energy saving enabled (#1866)
### Problem description
The bug described in #1663 was caused by an optimization of the display
rendering that uses drawlists to detect changes. The changes in the 3-d
visualizer don't contain drawlists when axes are turned off.

### Implementation description
The fix is to identify the 3d visualizer among the command lists of the
main window and, if found, avoid skipping frames regardless of the
result of the comparison of drawlists.

Closes #1663
2024-09-15 15:23:58 +02:00
paxcut
a587c5ff74 feat: Added a quarter precision (8 bits) button to IEEE 745 tool (#1868)
Per discussions on Discord.
2024-09-15 15:22:35 +02:00
paxcut
0b2eca3066 fix: LZMA decompressor memory errors (#1873)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
I was unable to use the LZMA de-compressor even though 7zip was able to
identify them as LZMA compressed and decompress them without a problem.
Under the debugger the `lzma_code()` call was returning
`LZMA_MEMLIMIT_ERROR`.
### Implementation description
I found online that the error can be fixed using `lzma_memlimit_set()`
using a value obtained with `lzma_memusage()`. I tried to avoid having
to call `lzma_code()` twice but if the functions are called before the
first `lzma_code()`the values of memory obtained fall short and error
occurs again.

I suspect that there are better ways to deal with this other than the
code proposed in this PR, but I haven't been able to find any.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-09-15 15:20:17 +02:00
paxcut
fa28052958 fix: Avoid crashing ImHex when passing invalid data to the 3D visualizer (#1874)
### Problem description
There are some obvious constrains in the various array data sizes that
we can use to determine if their sizes and in some cases their values
are correct.

### Implementation description
To test their validity, the most important of the various arrays are the
indices, so their definition and use has been simplified a great deal.
In order to treat all variables in a similar manner the changes to the
uv variable posted in an earlier PR were also added here.

With this one, all the recently opened PR's combined should contain
exactly the same changes and fixes as the older 3-d visualizer PR #1850
which I will close shortly after this one is opened.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-09-15 15:19:41 +02:00
paxcut
54f5bd1d80 feat: Added underwaved text functions (#1889)
### Problem description
Currently when errors are found the entire line where the error occurred
is highlighted and one has to look at the error message in order to find
where the error is located on the line. With this PR the line will no
longer be highlighted and the location of the error will be marked with
an red waved line under the error location. Hovering over the text where
the error occurred produces an error overlay so if several errors occur
on the same line they can all be seen separately.

### Implementation description
The definition of error marker was switched to include column and size
as well as line and message like before.
This change required changing the way view pattern editor draws the
error markers because the errors themselves don't have size information.
Also, a new errorHoverBoxes type was defined to help in the detection of
the floating error messages when error is hovered.

Note that the underwave code depends on having a monospaced. If font is
not monospaced the underwaved text can be short/long or displaced.


### Screenshots

![image](https://github.com/user-attachments/assets/f0b08e10-612c-404a-8863-d4f00054d198)


![image](https://github.com/user-attachments/assets/911fcacb-2a1e-431f-bbc8-8e05bcd61341)
2024-09-15 15:19:04 +02:00
paxcut
4b3bbb4a97 impr: Moved pattern editor shortcuts to the Shortcut manager (#1892)
### Problem description
There are some recent issues about Mac keys not configured properly for
the pattern editor. This PR moves all the shortcuts to the shortcut
manager, so they can be edited at will. Even if the key is not
identified correctly it should be possible to use preferred keys for any
action.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-09-15 15:18:50 +02:00
xtex
187d90e8f2 lang: Update Chinese (Simplified) translations (#1894)
Co-authored-by: JustFor <35858818+zhongqingsong@users.noreply.github.com>
2024-09-15 15:17:25 +02:00
rockisch
2f60f61c15 impr: Add streaming decompression to zstd_decompress (#1898)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description

https://github.com/WerWolv/ImHex/issues/1895

### Implementation description

Added code that handles streamed zstd data. It is based around the
[official
documentation](http://facebook.github.io/zstd/zstd_manual.html) and the
[example](https://github.com/facebook/zstd/blob/dev/examples/simple_decompression.c)
provided at the main zstd repo.

The loop around the non-streamed version was also removed because I
don't think it was doing anything (no `continue`s, `sourceSize` was
always being set to 0).

### Additional things

To test, I generated streamed zstd data with this python script:

```py
import io; import pyzstd;
with open("data.zstd", "wb") as f:
    pyzstd.compress_stream(io.BytesIO(b'ab' * 100), f)
```

And then I ran this pattern script:
```
import std.mem;
import hex.dec;

u8 data[while(!std::mem::eof())] @ 0x00;
std::mem::Section data_sec = std::mem::create_section("data_sec");
hex::dec::zstd_decompress(data, data_sec);
```

Inspecting the section shows the correct data:

![image](https://github.com/user-attachments/assets/83fc9d4c-e6fa-49ee-9923-29dc0c280739)

Co-authored-by: Nik <werwolv98@gmail.com>
2024-09-15 15:16:57 +02:00
paxcut
057543da15 feat: Extended bitmap visualizer to handle indexed colormaps (#1901)
### Problem description
Older image format use to store color values in a small lookup table so
that the image could simply store an index to the table. The pattern
language is not designed to handle this sort of operation which makes
this extension necessary to be able to visualize images of this type.

### Implementation description

The changes add an optional parameter to the bitmap visualizer which
holds the color lookup table. If the image contains values that are
outside the range of possible colors then the first color in the map is
chosen. The dimensions of the image can be equal to or smaller than
rows*columns depending on how the indices to the color map are stored.
For example, you can use 4 bit indices which would make the image half
the size (in bytes) but that limits the number of colors to 16. To store
colors in sizes larger than one byte use an array of the appropriate
sized integers.

### Screenshots


![image](https://github.com/user-attachments/assets/d068cb7e-3ff3-450d-8ac2-1bfc6e38043f)
2024-09-15 15:16:36 +02:00
paxcut
3c060cc57a fix: Finding utf-8 strings failed to select their location. (#1902)
other separate, but closely related fixes are:

- fix: The previous fix also solved the (unreported) bug of being unable
to select utf-8 works by double-clicking.
- fix: The move to next/previous word (Ctr-arrow) behaved differently
depending on the direction. I made both the move left/right functions
share a much simpler algorithm and rewrote the find start/end of word
functions share the same code structure.


### Problem description
The code was using the byte index of the match into the utf-8 string to
store the match locations, but the code that sets the selection uses the
char index into the utf-8 string instead. Another problem was that the
search uses the byte index to determine if it needs to find more
matches.

### Implementation description
Both problems were solved by introducing two functions to switch from
coordinates in units of bytes to coordinates in units of chars and vice
versa.

Co-authored-by: Nik <werwolv98@gmail.com>
2024-09-15 15:16:19 +02:00
paxcut
928b4c6c4c fix: Reset cursor blink when moving selection (#1903)
### Problem description
When this feature was implemented the text editor handled all the
keyboard input so the blink reset function could be called in one place
for all the key presses. Now that shortcuts are done in the shortcut
manager we need to reset the blink state inside all the functions that
can affect cursor movement.

### Implementation description
Every function that moves the cursor now calls the blink state reset
function at the very start. There may be more functions that need this
that haven't been merged but git should show merging conflicts so it
should be easy to deal with.
2024-09-15 15:15:14 +02:00
WerWolv
871a0d535c build: Fix building issues on macOS with clang 18 2024-09-08 10:45:38 +02:00
WerWolv
87db9def32 build: Updated libwolv 2024-09-03 11:09:01 +02:00
WerWolv
04763eaeea patterns: Updated pattern language 2024-08-23 21:37:46 +02:00
JustFor
b6c08a1a11 lang: Updated zh_CN language definition (#1827)
### Problem description
1. Old Chinese text json, the order is chaotic. It doesn't compare well
with English.
2. Missing a batch of new English strings.

### Implementation description
1. Synchronize the key sequence of English files.
2. Added a missing batch of text, and translate to CN.

### Screenshots
None

### Additional things
None
2024-08-20 20:31:33 +02:00
xtex
811c995047 build: Find boost with name "Boost" (#1840)
On many distributions like AOSC OS, Alpine Linux, Arch Linux, etc.,
boost should be searched with name "Boost".

This should fix the packaging issue on AOSC OS.

### Problem description
CMake fails to find system boost when `USE_SYSTEM_BOOST` is set to ON.

### Implementation description
Find Boost.

Signed-off-by: xtex <xtexchooser@duck.com>
2024-08-20 20:29:03 +02:00
WerWolv
7011df2ced fix: Reading entire file content of base64 file into memory not working 2024-08-20 20:27:08 +02:00
WerWolv
a24692b4be fix: Revert ndf-extended changes for now to fix file dialogs on Linux 2024-08-20 20:08:01 +02:00
WerWolv
0e7a32470b patterns: Updated pattern language 2024-08-20 20:04:52 +02:00
WerWolv
212d2f9db4 patterns: Updated pattern language 2024-08-10 09:17:41 +02:00
Colin Snover
0263d3538e fix: Don't supress stderr anymore (#1822)
### Problem description

Typing `--help` causes ImHex to exit without outputting anything.
Diagnostic messages from glib, ASan, other libraries that might have
something important to say, etc. are also suppressed.

### Implementation description

This effectively reverts 7c1e33dde6, which
was partially reverted only on Windows by code that was left commented
out in f114239f51.

Allowing other libraries to print to stderr may make the output ‘ugly’,
but lots of things print to stderr that are important for figuring out
why something is bugged, like ASan and glib.

### Additional things


![image](https://github.com/user-attachments/assets/fa6771e2-da2e-45ea-93cd-06c3f6bfd3bf)
2024-08-09 22:15:34 +02:00
WerWolv
63c6028522 build: Updated ImGui to v1.91.0 2024-08-03 23:49:47 +02:00
WerWolv
075ece2da7 impr: Clean up windows window code 2024-08-03 22:18:16 +02:00
WerWolv
e9fb02285e impr: Allow tasks to be created without getting the task handle as parameter 2024-08-03 22:01:18 +02:00
WerWolv
5dfd8c89a3 feat: Display pattern descriptions in file chooser and pattern popup 2024-08-03 22:00:47 +02:00
WerWolv
e9f7908afb git: Increase stale issue operations to 200 2024-08-03 20:10:09 +02:00
WerWolv
fafce72c01 fix: Errors causing #pragma magic to not work as expected 2024-08-03 20:09:10 +02:00
WerWolv
c3d15157ad git: Silence brew commands spewing errors into the CI log 2024-08-03 18:41:17 +02:00
WerWolv
e0712f73c2 git: Better build CI script formatting 2024-08-03 18:40:56 +02:00
WerWolv
3dd5b2365a git: Increased stale issue operations per run to 100 2024-08-03 18:39:26 +02:00
WerWolv
b523f55984 git: Kill XProtect on git runners to work around race condition 2024-08-03 18:32:45 +02:00
Nik
79b8b77b25 git: Allow inactive issues ci to be triggered manually 2024-08-03 18:24:31 +02:00
WerWolv
c6065808a7 git: Skip codecov CI step if token isn't set 2024-08-03 18:22:15 +02:00
Justus Garbe
d69ae39b6f git: Added stale issues action (#1836)
Added stale issues action:
- Runs on cron every 30 days
- Marks issues as stale after 11 months
- Closes issues marked as stale after 1 month
2024-08-03 18:22:11 +02:00
WerWolv
35739d6d0d feat: Display pattern description on the accept pattern popup 2024-08-03 18:15:30 +02:00
WerWolv
e726fce360 patterns: Updated pattern language
Fixes #1835
2024-08-03 17:56:13 +02:00
WerWolv
0a038fecff impr: Re-parse patterns only when the user stopped typing 2024-08-03 17:00:23 +02:00
WerWolv
0184bf9a7d impr: Only mark providers dirty when they're not dirty already 2024-08-03 17:00:09 +02:00
WerWolv
60663babc8 impr: Optimize hovering over patterns in the hex editor 2024-08-03 16:50:30 +02:00
WerWolv
a7115d4300 fix: Race condition during data processor execution 2024-08-03 15:17:35 +02:00
WerWolv
29558c9910 impr: Remove superfluous concatenation operators for Lang strings 2024-08-03 11:35:36 +02:00
WerWolv
7c1d643f97 patterns: Updated pattern language 2024-08-03 11:33:15 +02:00
WerWolv
b2fc80f970 impr: Fix various issues with runtime-generated language strings 2024-08-03 11:32:17 +02:00
WerWolv
efee128c1c patterns: Updated pattern language 2024-07-28 10:43:15 +02:00
WerWolv
c3ddd68866 fix: Correct more language strings 2024-07-27 16:54:05 +02:00
WerWolv
3cde4472c8 impr: Jump to selection in main hex editor as well when clicking on diff entries 2024-07-27 16:52:15 +02:00
WerWolv
4c38fe261d feat: Make diff table resizable 2024-07-27 16:51:43 +02:00
WerWolv
33f7191c0d fix: Copy paste error 2024-07-27 16:46:10 +02:00
WerWolv
cda9ad3b30 patterns: Updated pattern language 2024-07-27 16:33:37 +02:00
WerWolv
1a7bd49361 impr: Make all task names properly translatable 2024-07-27 16:29:06 +02:00
WerWolv
cf2e189049 fix: Building issues on Fedora 2024-07-27 15:55:59 +02:00
WerWolv
d5f5ba941a patterns: Updated pattern language 2024-07-27 14:16:01 +02:00
WerWolv
9a973be7ba fix: Background service thread names 2024-07-27 14:15:51 +02:00
WerWolv
d8e1284946 fix: Task names not displaying correctly anymore 2024-07-27 14:09:52 +02:00
WerWolv
ce26fe1db7 impr: Move language string interpretation to compile time 2024-07-27 11:23:21 +02:00
WerWolv
a8ad045248 fix: Parent offset calculation with non-zero base addresses 2024-07-26 19:43:15 +02:00
WerWolv
d097f6ada0 impr: Make pattern tooltips more appropriately sized 2024-07-26 19:38:21 +02:00
WerWolv
1b26db40f7 feat: Added parent offset to pattern hover tooltip 2024-07-26 19:38:01 +02:00
WerWolv
602b946fc9 patterns: Updated pattern language 2024-07-24 19:52:03 +02:00
WerWolv
48fc1a7a1e fix: Allow ImHex to build under wayland again 2024-07-24 19:41:34 +02:00
WerWolv
416889f49d impr: Optimize time it takes to find favorites in patterns 2024-07-24 19:41:12 +02:00
WerWolv
5ca3222e5b patterns: Updated pattern language
Fixes #1828
2024-07-24 19:40:27 +02:00
WerWolv
d49d82e982 fix: Building with latest pattern language changes 2024-07-23 20:32:16 +02:00
WerWolv
a4d5679219 fix: Crash when opening hex editor popups 2024-07-23 20:32:04 +02:00
WerWolv
bead103f3d patterns: Updated pattern language 2024-07-23 18:29:37 +02:00
Jean-François Nguyen
e50b6733c4 fix: Segfault when hashing regions spanning multiple MiBs (#1804)
### Problem description

Attempting to do an MD5 hash of a large region (e.g. 2 MiB, ``u8
data[0x200000]``) crashes with a segfault.

### Implementation description

In ``hex::plugin::hashes::hashProviderRegionWithHashLib()``,
``hashFunction->TransformBytes()`` is called with an offset of 0,
because it iterates over ``data`` and not the entire region.
2024-07-21 20:35:38 +02:00
xndcn
75e5dbaaa4 build: Fix incorrect name case in FindmbedTLS.cmake (#1817)
Corrected MBEDTLS_FIND_REQUIRED to mbedTLS_FIND_REQUIRED, since the
package name is "mbedTLS" for case sensitive environment
2024-07-21 20:34:23 +02:00
xndcn
965113c2b4 fix: Fix lzma stream end constant name (#1818)
Corrected BZ_STREAM_END to LZMA_STREAM_END.
Also removed redundant condition of LZMA_STREAM_END for error checking.
2024-07-21 20:33:46 +02:00
checkraisefold
3bddaf509d fix: Textures provided through the pattern language not rendering in the 3D visualizer (#1819)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
Because of `s_drawTexture` never being set to true, textures rarely or
never drew in the 3D visualizer.

### Implementation description
Set `s_drawTexture` to true when correct (valid texture file/object).
2024-07-21 20:33:05 +02:00
Colin Snover
c1c51e0baf feat: Enumerate fonts on Linux using Fontconfig when available (#1821)
### Problem description

The fonts list on Linux does not show all system fonts, and does not
show font names at all.

### Implementation description

Use Fontconfig to make the list less bad if Fontconfig headers are
available.

### Additional things

I like fonts.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-07-21 20:28:37 +02:00
WerWolv
09b6c2ab5b fix: Error log spamming when viewing invalid regions in process memory provider on linux 2024-07-21 20:24:26 +02:00
Colin Snover
13fd956039 fix: Do not connect to api on startup when server contact setting is disabled (#1823)
### Problem description

ImHex asks users whether they wish to opt-in to network connections on
start (excellent!), then ignores that and tries to connect to the
network anyway when the welcome screen loads (less excellent!).

### Implementation description

Also don’t connect to the network on the welcome screen if it is
supposed to not do that.
2024-07-21 20:14:02 +02:00
WerWolv
b6f0ee90af fix: Sidebar panels not being resizable anymore properly 2024-07-16 18:15:28 +02:00
WerWolv
90e11e1c5d fix: Crash when parsing process memory provider regions 2024-07-16 18:11:06 +02:00
WerWolv
fc40e8ba70 fix: Process memory provider region parsing skipping unnamed regions 2024-07-16 17:58:49 +02:00
WerWolv
7652b4a5b8 fix: Compiling on Linux with older glfw versions 2024-07-16 17:58:19 +02:00
Colin Snover
fb249767f1 fix: Crash on exit when using custom font from file (#1815)
### Problem description
WerWolv/ImHex#1814

### Implementation description
1. Remove the flag that wrongly tells `ImFontAtlas` that it owns font
data, and remove that parameter from the function signature entirely
since now it is always `false`.
2. Rename `takeAtlas` to `getAtlas` since it no longer transfers
ownership as of b652565b57.
2024-07-15 22:22:02 +02:00
WerWolv
d7ed311bcf impr: Don't auto-scale the framebuffer on Linux 2024-07-12 17:34:20 +02:00
WerWolv
8422965d0b impr: Run data processor in a worker task 2024-07-11 23:30:54 +02:00
WerWolv
7975edade4 feat: Added loop data processor node 2024-07-11 20:38:33 +02:00
WerWolv
1e18935513 impr: Handle demangling of identifiers without leading underscore 2024-07-11 20:38:22 +02:00
WerWolv
c311b5315f patterns: Updated pattern language 2024-07-11 18:02:48 +02:00
WerWolv
26a73e0fba patterns: Updated pattern language 2024-07-11 17:40:18 +02:00
WerWolv
07c259c9c1 fix: Multiple issues causing visualizers to crash when used _slightly_ incorrectly 2024-07-10 20:50:58 +02:00
WerWolv
9e1c2d5a2c build: Fix copy-paste bug 2024-07-10 20:50:20 +02:00
WerWolv
d7fb1b737f fix: Occasional crash when closing providers 2024-07-09 19:01:49 +02:00
iTrooz
84c9c69fa3 fix: Remove DSA key from AUR deploy action (#1806) 2024-07-09 09:23:33 +00:00
WerWolv
12ca4e29cf fix: Multiple definitions errors with plugin features 2024-07-08 21:34:47 +02:00
WerWolv
27b1a5dc98 impr: Make highlight hovering more efficient 2024-07-08 21:34:27 +02:00
WerWolv
de36cc8445 impr: Disable pattern debug mode after evaluation has finished 2024-07-08 19:49:31 +02:00
WerWolv
03d344c0a2 build: Streamline definition on plugin features 2024-07-08 18:12:46 +02:00
WerWolv
39f01538c7 git: Update Mesa3D link for Windows NoGPU version 2024-07-07 16:17:03 +02:00
WerWolv
28c57cf666 patterns: Updated pattern language 2024-07-07 15:47:58 +02:00
WerWolv
59d120537d feat: Added non-frame lz4 compression support to the pattern language 2024-07-07 15:23:18 +02:00
WerWolv
66d18e9475 patterns: Updated pattern language 2024-07-07 13:59:56 +02:00
WerWolv
1f5e4ceb0c feat: Added basic support for lz4 decompression to the pattern language 2024-07-07 10:26:24 +02:00
Sébastien Szymanski
0cbc65a52f build: Fix Gentoo ebuild (#1787)
### Problem description
Ebuild is invalid, i.e:
```
# ebuild ImHex-9999.ebuild manifest
Error(s) in metadata for 'app-editors/ImHex-9999':
  RDEPEND: Invalid atom (dbus), token 5
```

### Implementation description
* mbedtls is in net-libs category
* RDEPEND must contain atoms (category/packagename)

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Co-authored-by: Nik <werwolv98@gmail.com>
2024-07-07 10:25:10 +02:00
WerWolv
2b0367cca6 impr: Better handling of the scaling warning when using custom fonts 2024-07-06 11:30:59 +02:00
WerWolv
1f01f480e0 impr: Enable native scaling by default again 2024-07-06 11:29:52 +02:00
WerWolv
7a167962d6 fix: Font scaling not always being applied consistently 2024-07-06 11:29:14 +02:00
WerWolv
dae028d25d fix: Build issue due to uncaptured this pointer 2024-07-05 21:03:24 +02:00
WerWolv
88e2fa04e7 fix: Crash on macOS when dirtying or undirtying a provider from a thread
Fixes #1799
2024-07-05 20:59:20 +02:00
WerWolv
bb0a8047ea fix: Hex editor popups getting transparent when hovering over combo box popup 2024-07-05 19:26:08 +02:00
WerWolv
b652565b57 feat: Added DPI awareness on Windows, added FiraCode as optional default font 2024-07-05 17:39:07 +02:00
WerWolv
9aaf6f3105 web: Trigger right click when long touching area 2024-07-04 23:15:33 +02:00
WerWolv
c26eccfe28 web: Fix canvas to the top left of the screen 2024-07-04 21:37:51 +02:00
WerWolv
9fd547112d impr: Only handle SIGINT on release builds so IDEs can fast-kill ImHex 2024-07-04 21:28:43 +02:00
WerWolv
14bfc8af72 fix: Remove unnecessary touch padding 2024-07-04 21:18:46 +02:00
WerWolv
20f3458e37 patterns: Updated pattern language 2024-07-04 21:18:34 +02:00
WerWolv
6326e2d141 web: Improve logo size on mobile 2024-07-03 22:35:47 +02:00
WerWolv
23ca3c1d2d patterns: Updated pattern language 2024-07-03 22:35:47 +02:00
WerWolv
0656ab4b88 fix: Make sure welcome screen always stays in the background 2024-07-03 22:35:47 +02:00
WerWolv
90bb5d187c web: Fix touch input 2024-07-03 22:35:47 +02:00
WerWolv
75a62e2bde fix: Wrong start/end offset and size for static array entries in pattern data view 2024-07-03 16:58:56 +02:00
WerWolv
7cd36b80eb impr: Added tooltips to toolbar buttons 2024-07-03 16:58:25 +02:00
Bernard Teo
dd607621d7 build: Update nativefiledialog and keep dialogs on top (#1771)
This PR updates the nativefiledialog submodule and uses its new feature
to set the ImHex main window as the parent of the dialog window. This
ensures that the dialog stays on top of the main window. This is
currently supported by NFDe on Windows, macOS, and Linux/X11.
Linux/Wayland behaves as it did previously due to limitations in NFDe.

Note that macOS file dialogs have already been parented properly as NFDe
previously used the key window (the window currently receiving keyboard
events) on macOS. However, it's probably better to do the correct thing
and pass the main window to NFDe even on macOS.

### Problem description
The file dialog go behind the main window if the main window is clicked
while the file dialog is open.

### Implementation description
Update nativefiledialog and pass the `GLFWwindow*` of the main window to
the library function.

### Screenshots
Before:


https://github.com/WerWolv/ImHex/assets/6948096/589c3401-702a-4b0a-99ed-02d3e4d9080e

After:


https://github.com/WerWolv/ImHex/assets/6948096/8fef4900-eedc-48d5-8a4e-7bd81e37e3c0

### Additional things
I have tested this on Windows and Linux/X11, but did not test this on
macOS. It would be ideal if someone can help with this. (But as far as
NFDe is concerned, macOS `NSWindow*` handles have been tested (with
SDL2) and works.)

Co-authored-by: Nik <werwolv98@gmail.com>
2024-07-03 05:53:55 +00:00
WerWolv
2595febf14 patterns: Updated pattern language 2024-07-02 23:46:06 +02:00
WerWolv
dc058c4cf3 fix: Remove interactive help debug code 2024-07-02 23:17:12 +02:00
WerWolv
25824e1821 patterns: Updated pattern language 2024-07-02 23:16:32 +02:00
WerWolv
381c2d52ee web: Improved canvas webgl creation logic 2024-07-02 23:16:19 +02:00
WerWolv
4020ac9843 impr: Added nicer console warning when .NET runtime isn't installed 2024-07-02 23:15:54 +02:00
WerWolv
b3b7a19df4 fix: Wrong end address for bitfield fields in pattern data view 2024-07-02 17:38:53 +02:00
WerWolv
313e3e748f impr: Improved size display in pattern data view 2024-07-02 17:38:39 +02:00
WerWolv
09b9f26e6f patterns: Updated pattern language 2024-07-02 17:37:47 +02:00
WerWolv
01b9cc64d6 impr: Disable tab overlines 2024-07-01 23:53:14 +02:00
WerWolv
97bf1dc850 fix: Potential race condition with sorting in the pattern drawer 2024-07-01 23:36:17 +02:00
WerWolv
f94794fe3e patterns: Updated pattern language 2024-07-01 22:14:51 +02:00
WerWolv
68e528dd3a impr: Added Boost.Regex to about page 2024-07-01 22:01:28 +02:00
WerWolv
06ab1d34aa build: Updated ImGui, libfmt and libyara 2024-07-01 22:00:08 +02:00
WerWolv
2f2717e9aa impr: Completely eradicate Window resize flickering on Windows 2024-07-01 20:50:10 +02:00
WerWolv
88d24c2a03 web: Fix ImHex logo and progress bar default fill 2024-07-01 20:36:55 +02:00
WerWolv
ec2a2a6fbb git: Improve GPU information in the readme 2024-07-01 20:09:30 +02:00
WerWolv
60b81e714b impr: Prevent canvas flickering in web build 2024-07-01 20:09:16 +02:00
WerWolv
2cd8b13c1d build: Use ninja to build web version 2024-07-01 20:07:21 +02:00
Ikko Eltociear Ashimine
4afedb5131 chore: Fixed typo in cmake script (#1783)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
<!-- Describe the bug that you fixed/feature request that you
implemented, or link to an existing issue describing it -->
Accomodate -> Accommodate
### Implementation description
<!-- Explain what you did to correct the problem -->

### Screenshots
<!-- If your change is visual, take a screenshot showing it. Ideally,
make before/after sceenshots -->

### Additional things
<!-- Anything else you would like to say -->
2024-07-01 08:24:59 +02:00
WerWolv
71880ad2ad git: Checkout correct repositories in plugin test CI 2024-06-30 22:35:15 +02:00
WerWolv
a30cce4cbc git: Checkout ImHex main repo in plugin template test runner 2024-06-30 22:25:09 +02:00
WerWolv
08b4f60ead git: Added CI runner to test plugin template building 2024-06-30 22:15:04 +02:00
WerWolv
11498bd09b build: Properly look for boost and libimhex library in sdk again 2024-06-30 21:55:29 +02:00
Nik
7384c88ad6 git: Update resource requirement in readme 2024-06-30 10:46:00 +02:00
WerWolv
6f22d70d59 fix: Updater executable not being launched correctly when path had spaces in it
Fixes #1780
2024-06-30 07:59:25 +02:00
WerWolv
adc279d681 impr: Further try to improve window resize flickering on Windows 2024-06-29 23:32:44 +02:00
WerWolv
f90dc5d619 fix: ImHex hanging at startup in certain cases 2024-06-29 21:13:04 +02:00
WerWolv
6fd594c1f4 fix: Don't delete font atlas after passing it to ImGui 2024-06-29 20:26:46 +02:00
WerWolv
b94a4288bf fix: Standard magic file not getting bundled into executable correctly 2024-06-29 19:43:24 +02:00
WerWolv
cbf415256b fix: Default folders still not being created correctly on Linux 2024-06-29 19:15:09 +02:00
WerWolv
4b1884944d fix: Exception when opening a null provider 2024-06-29 18:49:23 +02:00
WerWolv
5ff752c9af build: Bumped version to 1.36.0.WIP 2024-06-29 18:48:36 +02:00
WerWolv
0e331a7cd1 build: Bumped version to 1.35.1 2024-06-29 13:01:53 +02:00
WerWolv
10970d170c fix: Default folders not being created correctly anymore 2024-06-29 13:01:25 +02:00
WerWolv
ac1a28311c build: Bumped version to 1.35.0 2024-06-29 11:27:24 +02:00
WerWolv
01d1938fea git: Update macOS version requirement in readme
#1647
2024-06-29 10:34:41 +02:00
WerWolv
802694ec68 build: Silence macOS CI build warnings 2024-06-28 22:29:38 +02:00
WerWolv
2aef5e4eef build: Lock install path in rpath behind an option 2024-06-28 22:21:10 +02:00
WerWolv
9a0a4d47dc build: Disable source_date_epoch_from_changelog 2024-06-28 21:53:34 +02:00
WerWolv
96b7366d53 build: Try fixing fedora build spec again 2024-06-28 21:29:49 +02:00
WerWolv
90ac96298a impr: Only re-render frame once during window resize or move operations 2024-06-28 21:27:35 +02:00
WerWolv
a6e5040e8f fix: Build issues on Fedora due to missing Changelog value 2024-06-28 18:29:24 +02:00
WerWolv
19e5aafc85 fix: String truncating being completely borken 2024-06-28 18:29:10 +02:00
WerWolv
77301fd018 impr: Swap some items between File and Edit menu to fit better 2024-06-28 11:13:03 +02:00
WerWolv
ed56b3dd12 impr: Limit string length by cutting out part of the middle instead 2024-06-28 11:12:41 +02:00
WerWolv
91f6aae9ef impr: Make Win32 API properly use unicode support 2024-06-28 11:12:17 +02:00
WerWolv
b642c493d7 fix: Opening files with unicode paths in external program/explorer not working 2024-06-27 23:12:20 +02:00
WerWolv
a950796306 fix: Recent file entry name encoding being broken 2024-06-27 22:40:19 +02:00
WerWolv
8672a2cfe0 fix: Content store downloads getting stuck sometimes 2024-06-27 19:54:45 +02:00
WerWolv
301e8c5a96 impr: Improve contrast of text in pattern data table when hovering 2024-06-27 19:45:49 +02:00
WerWolv
699a91c46b fix: Path in pattern tooltip wrapping too quickly 2024-06-27 19:27:54 +02:00
WerWolv
e43016735d fix: Open file in containing folder not working 2024-06-27 19:25:02 +02:00
WerWolv
d9cecbbb5f impr: Don't flash bang people when the ImHex main window appears 2024-06-27 17:11:28 +02:00
WerWolv
6e186e7d6a impr: Clean up .NET script loader error messages 2024-06-27 17:11:28 +02:00
WerWolv
af3680649c patterns: Updated pattern language 2024-06-27 17:10:48 +02:00
WerWolv
82f1d08dd7 fix: Race condition when loading projects while other providers are loaded already 2024-06-27 17:10:42 +02:00
WerWolv
b1b54a5fe7 impr: Drastically optimize event handler 2024-06-27 17:10:01 +02:00
WerWolv
ced3af3935 fix: Revert pattern include path back to the original paths 2024-06-27 17:09:48 +02:00
WerWolv
e5c782ebe9 impr: Further optimize ImGui text rendering 2024-06-27 17:09:20 +02:00
WerWolv
7d42742684 fix: Properly check return value of std::fgets 2024-06-26 22:46:01 +02:00
FireNX70
41820311cc fix: Off-by-one error in "Export selection to file" (#1774)
### Problem description
Export selection to file would never finish and wouldn't export the last
byte.

### Implementation description
It was just a simple off by one when using the selection's end address
to calculate the remaining data size. Add one to the remaining size
calculation.

### Additional things
Fixes https://github.com/WerWolv/ImHex/issues/1733,
https://github.com/WerWolv/ImHex/issues/1619 and
https://github.com/WerWolv/ImHex/issues/1597.
2024-06-26 22:44:10 +02:00
WerWolv
e132adad5d impr: Add short delay before a hover tooltip appears 2024-06-26 20:38:06 +02:00
WerWolv
2132e5adbf feat: Added tooltip to nightly icon on welcome screen 2024-06-26 20:37:39 +02:00
WerWolv
e2d55446fe impr: Get rid of more unnecessary ImGui::Text() calls 2024-06-26 19:41:06 +02:00
WerWolv
1dfce6a5c2 feat: Added --reset-settings command 2024-06-26 19:38:25 +02:00
WerWolv
a84db9821c impr: Optimize default hex cell visualizer 2024-06-26 19:15:49 +02:00
WerWolv
ec080ad69f fix: Indentation and wrapping of pattern hex editor tooltips 2024-06-26 19:14:43 +02:00
WerWolv
75cc9e4d84 fix: Pattern data filtering not applying correctly after rerunning pattern 2024-06-26 19:14:23 +02:00
WerWolv
d241a3ed5f impr: Make PageUp and PageDown not move the selection anymore 2024-06-26 19:14:01 +02:00
WerWolv
682aab8b23 feat: Allow faster hex editor scrolling by holding down CTRL or SHIFT + CTRL 2024-06-26 19:13:42 +02:00
WerWolv
474862b4af impr: Replace hardcoded pattern syntax highlighting colors style colors 2024-06-26 19:13:15 +02:00
WerWolv
dd02ec7a8e impr: Make the highlights minimap visualizer the default 2024-06-26 19:12:20 +02:00
WerWolv
1eadb77722 fix: Item tooltips being sized incorrectly 2024-06-26 19:11:59 +02:00
WerWolv
95f71bcb10 fix: Sub windows being used incorrectly 2024-06-26 19:11:31 +02:00
WerWolv
e1a4707569 impr: Make sure assertion handler doesn't get called too often 2024-06-26 19:10:43 +02:00
WerWolv
5a10613dd2 build: Add lib folder to all plugin's RPATH 2024-06-25 23:17:15 +02:00
WerWolv
c6a569ed88 impr: Don't reconstruct toolbar items list every frame 2024-06-25 23:14:05 +02:00
WerWolv
de24453fb9 impr: Open windowing menu on mouse down instead of on mouse up 2024-06-25 22:59:46 +02:00
WerWolv
d7c5c84110 build: Don't link plugins with plugin test library except in the test CI 2024-06-25 21:54:48 +02:00
WerWolv
95166ccfb8 impr: Further cleanup hex editor footer 2024-06-25 21:19:59 +02:00
WerWolv
c56667b0dd patterns: Updated pattern language 2024-06-25 20:57:45 +02:00
WerWolv
f754560bca patterns: Allow bitfield fields to be edited properly, improve type formatting 2024-06-25 16:14:28 +02:00
WerWolv
b54bb6cd56 patterns: Updated pattern language 2024-06-25 14:30:03 +02:00
WerWolv
b03b159907 impr: Better UI/UX for pattern drawer 2024-06-25 14:29:27 +02:00
WerWolv
bb7e6c9775 patterns: Updated pattern language 2024-06-25 13:54:55 +02:00
WerWolv
4bc724791d impr: Optimize frame times 2024-06-25 13:54:46 +02:00
WerWolv
ba7c10f4b1 feat: Fix sub menus, allow recent items to be collapsed 2024-06-25 13:54:29 +02:00
WerWolv
c1561c7b6a impr: Only allow scaling factors between 0.1x and 4.0x with slider
The old scaling values can still be entered by ctrl-clicking the slider and entering it manually
2024-06-24 23:04:20 +02:00
WerWolv
91a0be2d78 impr: Better UI/UX for interactive help 2024-06-24 23:01:46 +02:00
WerWolv
1f27530241 impr: Optimize event processing 2024-06-24 22:53:45 +02:00
WerWolv
e236872af3 feat: Added simple interactive help system 2024-06-24 22:53:25 +02:00
WerWolv
3d301c4202 fix: Don't automatically create directories in read-only locations
Fixes #1767
2024-06-24 21:51:37 +02:00
WerWolv
a5aaa60d29 fix: Build error due to uninitialized variable in web builds 2024-06-24 21:49:59 +02:00
WerWolv
d4a2de3b23 patterns: Updated pattern language 2024-06-24 14:27:32 +02:00
WerWolv
e85746ddba fix: Data paths being stored in config paths instead 2024-06-24 14:27:24 +02:00
WerWolv
a002eb1bc1 fix: Mixed path separators in default paths 2024-06-23 15:03:36 +02:00
WerWolv
7d4486f407 fix: Remove accidentally committed test code 2024-06-22 23:03:54 +02:00
WerWolv
a9915579a0 impr: Better detection of Intel GPUs with really bad driver bugs 2024-06-22 22:58:58 +02:00
iTrooz
65dfd4da0f feat: log stacktrace implementation used (#1769) 2024-06-22 21:33:52 +02:00
WerWolv
b93fd523aa fix: Remove last remaining getDefaultPaths 2024-06-22 12:57:13 +02:00
WerWolv
24621e6612 fix: Build issues on Linux due to unused parameter 2024-06-22 12:02:19 +02:00
WerWolv
1b383bdcf1 patterns: Updated pattern language 2024-06-22 11:56:17 +02:00
WerWolv
f47b357b23 impr: Reset unicode loading and scaling factor values if fonts fail to load 2024-06-22 11:25:32 +02:00
WerWolv
f9b778ecb8 impr: Use 1.0x scaling by default 2024-06-22 11:25:07 +02:00
WerWolv
f36d9831bb patterns: Updated pattern language 2024-06-22 10:45:03 +02:00
WerWolv
b60a262b58 fix: Replace old defaults path system with a new one
#1767
2024-06-22 10:44:55 +02:00
WerWolv
beef0fff33 impr: Better background opacity for the digital signal visualizer 2024-06-20 22:33:55 +02:00
WerWolv
24f535474a fix: Sidebar background and separator line overlapping footer 2024-06-20 22:33:42 +02:00
WerWolv
2e3f523f32 feat: Added digital signal pattern visualizer 2024-06-20 14:04:05 +02:00
WerWolv
c5f5973a9d feat: Added per-byte highlights to the hex editor minimap 2024-06-20 11:21:20 +02:00
WerWolv
5d59b8599d fix: Loading of file providers from UNC paths 2024-06-20 11:11:01 +02:00
WerWolv
3bfb0096e6 fix: Undefined behaviour when sending empty arguments to main instance 2024-06-20 11:09:57 +02:00
WerWolv
ca5763650b patterns: Updated pattern language 2024-06-19 13:59:58 +02:00
WerWolv
bf7beab0ab impr: Make auto backups not remove dirty status from project 2024-06-19 13:51:36 +02:00
SparkyTD
9b594d81bd feat: Added CSV, TSV and JSON as export options for Find results (#1673)
### Problem description
The default result export functionality of the Find tool is limited to
only exporting data in a nonstandard text format. This PR adds support
for exporting the results in CSV, TSV or JSON format. The PR also
removes the old format.

### Implementation description
I added the classes `ExportFormatter`, `ExportFormatterCsv`,
`ExportFormatterTsv` and `ExportFormatterJson`, with similar
implementations to the pattern data exporters.

~~I also moved the `ViewFind::Occurrence` class into
`hex/helpers/types.hh`, so the exporters can access it.~~

### Screenshots

![image](https://github.com/WerWolv/ImHex/assets/45818400/c7a1016b-6494-416d-a963-86484952837c)

### Additional things
Another small change I made is moving the "{} entries found" line on the
same line as the Search and Reset buttons. I think it looks cleaner this
way, but if anyone disagrees, I can revert it.

---------

Co-authored-by: WerWolv <werwolv98@gmail.com>
2024-06-18 20:57:55 +00:00
WerWolv
6a26c6002b git: Added ImHex pronunciation to readme 2024-06-18 22:12:01 +02:00
WerWolv
4fa64500af impr: Make sure footer items all start at the same height 2024-06-18 22:11:43 +02:00
WerWolv
085737af15 fix: Opening files on network drives (using UNC paths) crashing ImHex on startup 2024-06-18 22:11:26 +02:00
WerWolv
3e347fb6d4 impr: Improve icon scaling a bit 2024-06-18 22:10:02 +02:00
WerWolv
80cb126200 build: Cleanup configure step logging 2024-06-18 22:09:38 +02:00
WerWolv
f49715c7a0 impr: Better font loading logic 2024-06-16 22:41:16 +02:00
WerWolv
deee76e455 patterns: Updated pattern language 2024-06-16 15:42:04 +02:00
WerWolv
33885b863a fix: Disassembler always using little endian, no matter the setting
Fixes #1763
2024-06-16 15:06:30 +02:00
WerWolv
3ce9dbb278 fix: Alt and Ctrl being swapped in the text editor on macOS 2024-06-16 14:59:48 +02:00
WerWolv
bee4b906fb fix: Crash when closing providers 2024-06-16 14:48:31 +02:00
WerWolv
b3b79b3ee8 impr: Show document edited icon in close button on macOS 2024-06-12 19:51:12 +02:00
iTrooz
bd085dd495 git: Remove Fedora 38 and add Fedora 40 (#1755)
Fedora 38 is EOL
2024-06-12 09:21:35 +02:00
WerWolv
bf518b3590 fix: Pattern data view filter text box being too wide 2024-06-09 21:36:25 +02:00
WerWolv
32a8fcb84d fix: ImGui ID Push/Pop mismatch when disabling inspector rows 2024-06-09 21:18:29 +02:00
WerWolv
4fd65403c0 impr: Don't show separator in bookmark drag tooltip if no comment is present 2024-06-09 21:01:22 +02:00
WerWolv
ecf871a6f1 impr: Allow files to be switched between memory loaded and direct access 2024-06-09 20:59:06 +02:00
WerWolv
531c049bb0 impr: Improve bookmark drag-n-drop logic
Fixes #1745
2024-06-09 20:11:55 +02:00
WerWolv
99716eff1e impr: Make sure floating windows don't get reopened after restart 2024-06-09 20:11:21 +02:00
WerWolv
74205d5438 impr: Make sure icon input text boxes are the expected width 2024-06-09 14:56:56 +02:00
WerWolv
0136877978 fix: Bookmark "Open in View" tooltip not being displayed
Fixes #1749
2024-06-09 14:56:40 +02:00
Murmele
fb7d40ddbe fix: Allow bookmark region to be set to 1 Byte length (#1747)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
<!-- Describe the bug that you fixed/feature request that you
implemented, or link to an existing issue describing it -->
When entering for the end value the same value as the start it is not
recorgnized as valid region, because end must be strictly greater than
begin. Due to the +1 in the Region constructor this is not correct,
because the end is included in the range.

### Implementation description
<!-- Explain what you did to correct the problem -->

### Screenshots
<!-- If your change is visual, take a screenshot showing it. Ideally,
make before/after sceenshots -->
After:

![image](https://github.com/WerWolv/ImHex/assets/10099533/c45d2001-8790-430a-8f1a-4b65130f4d01)


### Additional things
<!-- Anything else you would like to say -->
2024-06-09 10:54:09 +02:00
WerWolv
c761054805 feat: Allow view providers to be renamed
Closes #1746
2024-06-09 10:51:59 +02:00
WerWolv
55e24b5e23 fix: Bookmarks not being correctly reorderable anymore
Fixes #1745
2024-06-09 10:28:58 +02:00
WerWolv
9cff5b8af4 fix: Release notes in about page not working in nightly builds 2024-06-08 14:07:52 +02:00
Justus Garbe
41b2523005 impr: Refactor various view drawing code (#1698)
Refactored:
- ViewDatainspector
- ViewAbout

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-06-08 13:56:48 +02:00
WerWolv
2ef256ee74 impr: Show full error message for custom data inspector row errors 2024-06-08 13:40:39 +02:00
WerWolv
e954d49c29 feat: Handle SIGINT 2024-06-08 00:57:56 +02:00
WerWolv
041bf47ff4 fix: Title bar height on non-macOS platforms 2024-06-08 00:56:52 +02:00
WerWolv
53ced98529 impr: Enable auto project backup by default 2024-06-08 00:52:27 +02:00
WerWolv
cb475c471d build: Updated libwolv 2024-06-08 00:39:12 +02:00
WerWolv
bf82690c80 fix: Build and drawing of title bar buttons on macOS 2024-06-08 00:28:17 +02:00
WerWolv
72a3a1acab build: Updated libwolv 2024-06-07 23:48:57 +02:00
WerWolv
18e2b0eaa2 fix: Regex crashes with too long input strings 2024-06-07 23:12:18 +02:00
WerWolv
b80a6152b3 fix: Unifont being blurry again 2024-06-07 22:50:47 +02:00
WerWolv
ffe3dae7b2 build: Updated ImGui to v1.90.8 2024-06-07 22:12:50 +02:00
WerWolv
d7845ec690 fix: Build issues 2024-06-07 21:57:39 +02:00
WerWolv
8531a67519 fix: Don't unload background .NET scripts 2024-06-07 21:27:01 +02:00
WerWolv
af59b9d2ca fix: Infinite loop when doing forwards/backwards searches in some cases
Fixes #1734
2024-06-07 21:00:55 +02:00
Tsukasa OI
08bb69c048 fix: Wrong query path when saving layouts (#1735)
### Problem description

At least on Windows (I have tested), it fails to save a layout on the
non-portable version of ImHex (unless we have an administrator
privilege).

The log (after an attempt to save a layout as "sample") will look like:

| Component | Message |
| --------- | ------- |
| `libimhex` | `Failed to save layout 'sample'. No writable path found`
|

But the underlying problem is platform-agnostic. It can be also a
problem on other platforms in other ways.

### Implementation description

The layout manager incorrectly queried whether the empty path
(effectively the current working directory) is writable before saving
the layout (not each "layouts" directories it queried earlier).

This is the snippet of the root cause.

```cxx
std::fs::path layoutPath;
for (const auto &path : hex::fs::getDefaultPaths(fs::ImHexPath::Layouts)) {
    if (!hex::fs::isPathWritable(layoutPath))
        continue;

    layoutPath = path / fileName;
}
```

Look at the argument we are passing to `isPathWritable`. `layoutPath` is
a default (empty) `std::fs::path` object and will not be updated until
the directory describing itself is confirmed to be writable.

That caused a problem on non-portable version of Windows because:

1. The current working directory is usually the one of the executable
(`imhex-gui.exe`) and
2. That directory (`C:\Program Files\ImHex` by default) is usually not
writable unless ImHex is executed with an Administrator privilege.

The argument to `isPathWritable` should be `path` (containing one of the
`layouts` directories) and this PR fixes so that.

### Screenshots

### Additional things

This issue is hard to notice when developing because, to reproduce this
bug, the current working directory MUST NOT BE writable (usually
writable when we develop, even when we are working on the non-portable
Windows builds).
2024-06-07 20:33:43 +02:00
WerWolv
6fb32d20b3 fix: Don't try to compile process memory provider into Web build 2024-06-07 20:32:04 +02:00
WerWolv
ea09bfe8ea feat: Highlight patterns in pattern data view that are fully selected
Fixes #1741
2024-06-07 19:59:11 +02:00
WerWolv
c0dde570e4 feat: Highlight patterns in hex editor when hovering over pattern data row
Fixes #1742
2024-06-07 19:48:10 +02:00
WerWolv
6fd3fa77ed impr: Don't scroll hex editor view when jumping to a region that's on-screen already
Fixes #1743
2024-06-07 19:29:55 +02:00
WerWolv
ff20f81cfd impr: Added back selection size in hex to the footer 2024-06-07 19:21:38 +02:00
WerWolv
de8465a8f4 feat: Added limited support for the process memory provider to macOS 2024-06-07 19:17:14 +02:00
WerWolv
4540e1b561 impr: Select second to last provider when last one is selected and closed 2024-06-05 23:21:15 +02:00
WerWolv
789d469477 impr: Make providers close instantly 2024-06-05 23:02:38 +02:00
WerWolv
4797512207 fix: Variable naming style in splash window 2024-06-05 22:24:00 +02:00
WerWolv
348fe27a3c impr: Added small moon icon to the welcome screen of nightly builds 2024-06-05 22:23:43 +02:00
WerWolv
c217b1b100 build: Replace -WIP version suffix with .WIP 2024-06-05 20:59:48 +02:00
WerWolv
0e757e5fb1 build: Bumped version to 1.35.0-WIP 2024-06-03 23:06:28 +02:00
WerWolv
72d5707d33 build: Bumped version to 1.34.0 2024-06-03 22:22:33 +02:00
WerWolv
a491b85737 build: Added simple script to generate release notes 2024-06-03 22:14:08 +02:00
Alexander Wilms
d9d85cbfcc impr: Added keywords to .desktop file (#1732)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
<!-- Describe the bug that you fixed/feature request that you
implemented, or link to an existing issue describing it -->
This adds a list of strings which may be used in addition to other
metadata to describe the application. This can be useful e.g. to
facilitate searching through entries.

Reference:
https://webcache.googleusercontent.com/search?q=cache:https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

(The original site is currently down due to a Gitlab upgrade)

These keywords are used by
[Flathub](https://docs.flathub.org/docs/for-app-authors/metainfo-guidelines/#launchable),
[KDE
Discover](https://discuss.kde.org/t/does-kde-discover-parse-the-desktop-file-for-categories-and-keywords/7041)
and [Gnome
Software](https://blogs.gnome.org/hughsie/2016/01/07/the-importance-of-keywords-for-the-software-center/).

### Implementation description
<!-- Explain what you did to correct the problem -->
Add a `Keywords` entry to the .desktop file.

### Screenshots
<!-- If your change is visual, take a screenshot showing it. Ideally,
make before/after sceenshots -->

Here's how the tags are displayed for TeXstudio on its Flathub page: 

![image](https://github.com/WerWolv/ImHex/assets/3226457/35e00272-433e-46cd-9a9e-c42913aefe3f)


### Additional things
<!-- Anything else you would like to say -->
2024-06-03 19:44:05 +02:00
iTrooz
283fe46230 git: Replace Ubuntu 23.04 with 24.04 LTS (#1731) 2024-06-03 17:25:50 +02:00
iTrooz
2c00aa5def fix: Do not use custom repo gcc 13 for Ubuntu because it doesn't run on vanilla Ubuntu (#1730) 2024-06-03 08:06:49 +00:00
iTrooz
984438e98d feat: show Linux distribution information on startup (#1729) 2024-06-03 10:02:29 +02:00
WerWolv
cf34c4bd95 fix: The font atlas does not own the custom font data 2024-06-01 13:55:06 +02:00
WerWolv
bab1d2e27e fix: Loading custom fonts from paths with unicode characters not working
Fixes #1727
2024-06-01 13:52:41 +02:00
WerWolv
d1b6a21e86 fix: Missing localization 2024-05-31 17:06:18 +02:00
WerWolv
3049590b68 feat: Added full pattern path to hex editor hover tooltip 2024-05-31 17:02:46 +02:00
WerWolv
8a289d2e4f impr: Make hex editor faster to render 2024-05-31 17:02:22 +02:00
WerWolv
7a81fa7ac5 fix: Mutliple potential nullptr derefes with shortcuts 2024-05-31 17:02:08 +02:00
WerWolv
fbf59b6f0b build: Updated ImGui 2024-05-31 16:59:52 +02:00
WerWolv
0ab200f77f fix: Hex editor popups closing when opening sub-popups 2024-05-30 22:01:18 +02:00
WerWolv
a91e40d731 lang: Fixed typo 2024-05-30 21:49:40 +02:00
WerWolv
e553fbc86c patterns: Updated pattern language 2024-05-30 21:49:08 +02:00
WerWolv
b4a810c374 fix: Build error on some platforms due to unused variables 2024-05-30 21:49:01 +02:00
WerWolv
0e97914d94 build: Updated libwolv 2024-05-30 16:57:57 +02:00
WerWolv
a5c250c811 fix: Byte type annotations not being reset correctly 2024-05-30 16:57:28 +02:00
WerWolv
08c2f3fc15 impr: Make window less prone to flickering during resizes on Windows 2024-05-30 16:57:07 +02:00
WerWolv
63f66662ce fix: Workspaces not being deletable correctly in all cases 2024-05-30 16:56:39 +02:00
iTrooz
89eee104ab chore: disable codecov PR comments (#1724) 2024-05-28 13:51:09 +02:00
iTrooz
92b1234ddb build: Reduce debug info produced (#1720) 2024-05-27 16:33:15 +02:00
iTrooz
0b0bf90e0b build: Compress debug info (#1719)
This PR compress the debug info in the ELF files built.

This has no impact on the packages (e.g. .deb files) because they themselves have compression, but once installed in the filesystem, they this compression will be beneficial

The compression is opportunistic, happens automatically when possible

For some reason, the web version doesn't work with this (most compiler tests after this seem to fail ?) so it is disabled there

More information: https://github.com/WerWolv/ImHex/issues/1714#issuecomment-2131373826
2024-05-26 20:48:14 +02:00
iTrooz
974c4ba040 git: remove unused name matrix parameter from Ubuntu builds (#1701) 2024-05-23 15:57:44 +02:00
iTrooz
4e2c1d20b4 git: change key used for web cache 2024-05-23 14:44:01 +02:00
iTrooz
e5b83d0ddf chore: add comment about IMHEX_COMMON_FLAGS 2024-05-23 14:44:01 +02:00
David Mentler
bdaf1e4151 build: Xcode accomodating CMake setup (#1688)
### Problem description
This PR implements some rudimentary Xcode support for building and
editing ImHex.

### Implementation description

#### Problem 1: Xcode is a multi-configuration buildsystem
The project is already rather CMake generator independent, thus it did
not need to change much to support Xcode's multi-configuration paradigm:

By default, CMake generates a `.xcodeproj` in which targets build their
artifacts into the specified `<>_OUTPUT_DIRECTORY`, postfixed by the
currently active configuration. To better fit the existing paradigm, I
instead opted ot introduce `IMHEX_MAIN_OUTPUT_DIRECTORY`. This variable
is equal to the previously used `RUNTIME_OUTPUT_DIRECTORY` when using
other generators, and is changed to include a configuration specific
_prefix_ when used with Xcode.

The result is different output directories when using Xcode, and no
changes when using any other generator.

#### Problem 2: ImHex does not support AppleClang
To allow building the codebase with Xcode, I have introduced
`IMHEX_IDE_HELPERS_OVERRIDE_XCODE_COMPILER`. Specifying this option to
`ON` will force CMake to honor the user specified compiler settings,
even when using the Xcode generator.

In practice this can be used together with the new "xcode" CMakePreset
to build the project with mainline clang using `xcodebuild`, or Xcode
itself by generating a buildsystem like so:
```
cmake --preset xcode -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/llvm@17
```

This solution is of course not without flaws. The inner workings are a
particularly ugly hack, and mainline clang does not implement the
necessary extensions to allow Xcode to index the code. Regardless this
option is useful to enable future work in terms of bundling/signing
macOS applications in the "intended" way using Xcode without additional
source modifications.

#### Problem 3: Vanilla CMake + Xcode = Bad developer UX 
By default, the CMake generated `.xcodeproj` is a mess. Tons of targets
are scattered about, and source files are not organized beyond grouping
them into a "Source Files" and "Header Files" group.

Even "Header Files" is missing, because the ImHex build system does not
regard private header files of libraries as sources of a target, and
Xcode does not try to guess this information.

The solution is twofold:
* Additional code has been added which organizes the targets into a neat
folder structure
* Additional code was added behind a configuration flag
`IMHEX_IDE_HELPERS_INTRUSIVE_IDE_TWEAKS` which automatically creates
source file trees in Xcode targets, and discovers the non-declared
header files via the folder convention.

### Screenshots
N/A

### Additional things

As a bonus: `IMHEX_OFFLINE_BUILD` assumes that ImHex-Patterns is cloned
into the source tree. I have added an additional fallback that tries to
locate it as a sibling folder of `${CMAKE_SOURCE_DIR}`, as this meshes
better with my filesystem setup.

The setup was tested with `CMake 3.29.2`, `Xcode 15.2`, and `llvm@17`
from homebrew.
2024-05-20 10:12:57 +00:00
David Mentler
751eff0edf impr: Restore native macOS title bar double click gesture in borderless mode (#1689)
### Problem description

#### Problem 1
In borderless mode ImHex disables the standard macOS titlebar rendering
and input processing. As a result double clicking the titlebar does not
trigger the native macOS behavior set in `System Settings -> Desktop &
Dock -> Double-click a window's title bar to [Zoom/Minimize/Do
nothing]`.

#### Problem 2
The ImHex window shows up as blank/transparent when de-minimizing it
from the dock.

#### Problem 3
Widgets experience ghost hover inputs from the past position of the
cursor during live resizing.

### Implementation description
ImGui elements consume input events in the order they are drawn. As a
result by "drawing" an `InvisibleButton` over the content area of the
titlebar we can catch unprocessed clicks in the titlebar area.
Connecting this button's double clicks to the native window is then a
trivial endeavour.

The blank windows was caused by the rendering stack clearing the GL
buffer, but proceeding to draw nothing in it. I have short circuited
this path.

Ghost hover inputs were squelched by consistently moving the ImGui
cursor to `0, 0` during a live resize. The OS will dispatch a cursor
positioning event once the resizing ends, restoring normal behavior.

### Screenshots
N/A

### Additional things
N/A

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-05-20 11:27:57 +02:00
WerWolv
666dc7dccb fix: Build when multisampling isn't available 2024-05-20 10:18:03 +02:00
WerWolv
a172e89620 fix: Don't restore toolbar items when they're empty 2024-05-20 10:16:14 +02:00
iTrooz
ecb9537c4e git: remove mock cache for Fedora because it seems to be duplicated with ccache 2024-05-20 01:35:12 +02:00
WerWolv
bba4cf9578 impr: Keep a safety backup of the last crash backup around 2024-05-19 23:13:46 +02:00
WerWolv
bfdb9b4019 impr: Allow views to opt out of having their open state saved 2024-05-19 21:51:55 +02:00
WerWolv
bad37d0940 fix: Crash when having path set in user folder settings page 2024-05-19 21:41:18 +02:00
WerWolv
62f5640678 patterns: Updated pattern language 2024-05-19 16:41:29 +02:00
WerWolv
71c1bcde0d feat: Added option to specify max file size to load into memory 2024-05-19 15:10:22 +02:00
SparkyTD
e9b492a287 lang: Added Hungarian translations (#1683)
### Problem description
ImHex didn't support Hungarian :(

### Implementation description
I translated ImHex to Hungarian :)

### Translation Coverage
| Plugin        | Percentage |
|---------------|------------|
| builtin       | 99%        |
| diffing       | 100%       |
| disassembler  | 100%       |
| hashes        | 95%        |
| script_loader | 100%       |
| ui            | 100%       |
| visualizers   | 100%       |
| windows       | 100%       |
| yara_rules    | 100%       |

### Additional Notes
There are four Hungarian "special" characters that fall outside the
default Unicode ranges loaded by ImHex, resulting in them being replaced
with the "�" character. These letters are Ő (U+0150), ő (U+0151), Ű
(U+0170) and ű (U+0171), all included in the Latin Extended-A Unicode
block.

The easy fix for this is to include the "Unicode Latin Extended-A" range
when loading the font glyphs in
[init_tasks.cpp:189](99abc4e78a/plugins/builtin/source/content/init_tasks.cpp (L189)).
This change would also unlock the full character range of Bosnian,
Croatian, Czech, Estonian, Latvian, Lithuanian, Maltese, Polish,
Romanian, Slovak, Slovene and Turkish. I can add the commit to this PR
if maintainers are okay with it. **EDIT:** Added a commit that loads
Latin Extended-A by default.

Also note that some words are longer than their English counterparts,
resulting in certain UI labels overflowing from their parent containers,
and being cut off. I might change some of the longer labels to be more
compact in the future, but the container size limitations will have to
be addressed eventually (e.g. with horizontal scrollbars).

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-05-19 14:33:33 +02:00
FireNX70
9b9b1aa6cc fix: Multisampling trying to use larger sample count than supported (#1670)
### Problem description
https://gitlab.freedesktop.org/mesa/mesa/-/issues/11135
It turns out LLVMpipe only supports 4x multisampling. Checking
GL_MAX_SAMPLES seems like the right thing to do.

### Implementation description
~~Right now, I only check GL_MAX_SAMPLES. Depending on the format, we
might need to check GL_MAX_INTEGER_SAMPLES. I don't know how likely it
is that you might want to use a different format in the future,
glGetInternalformativ might be a safer option to retrieve the max number
of samples we can use.~~

Ended up implementing it with glGetInternalformativ.

### Additional things
I guess I could merge the ```if```s at lines 95, 99 and 103 in
imgui_imhex_extensions.cpp while we're at it.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-05-19 14:18:12 +02:00
David Mentler
2cb673fd81 impr: Stop rubber banding while resizing on macOS (#1690)
### Problem description
On macOS `glfwSetWindowSizeCallback` is invoked early during window
resizing, rendering a frame in that callback leads to wonky results as
the new framebuffer is swapped before the OS has the chance to actually
resize the window:


https://github.com/WerWolv/ImHex/assets/1068675/46336419-3fc2-4aa1-b16f-68b0c00e3584

### Implementation description
Window contents are redrawn only from `glfwSetWindowRefreshCallback`
during resizing, fixing the issue:


https://github.com/WerWolv/ImHex/assets/1068675/3acc5d4a-b2a5-42f0-9015-5e7172a027cf
2024-05-19 14:14:57 +02:00
WerWolv
d5eb6b5bbc impr: Added data size widget 2024-05-19 10:21:54 +02:00
WerWolv
1e48277566 impr: Removed [Project] prefix from recent project entries 2024-05-19 10:21:30 +02:00
WerWolv
ec748f4a64 impr: Allow full magic analysis, removed unidentified data from magic report 2024-05-19 10:21:02 +02:00
iTrooz
22f1713739 fix: actually generate coverage data when compiling/running program (#1686) 2024-05-18 20:35:49 +02:00
WerWolv
f0e135530a impr: Add warning about using fractional scaling with default font 2024-05-18 20:32:57 +02:00
WerWolv
125d6a3e2a fix: Settings not being written anymore after restart 2024-05-18 20:32:34 +02:00
WerWolv
d078f9d847 fix: Icon size being off when using fractional scaling with default font 2024-05-18 19:39:29 +02:00
WerWolv
6b6a6ae5f0 impr: Added support for returning results from scripts 2024-05-18 12:57:29 +02:00
WerWolv
1d6676f059 fix: Empty tooltip showing when hovering over search bar in welcome screen 2024-05-18 11:58:25 +02:00
WerWolv
1e91505e6e fix: .NET script loader not initializing correctly on macOS 2024-05-18 11:10:55 +02:00
WerWolv
9e2f228d9a fix: Providers not being closable 2024-05-17 23:51:34 +02:00
WerWolv
7a1d163450 fix: Insert mode cursor not being visible 2024-05-17 23:51:26 +02:00
WerWolv
22e717d778 fix: Don't capture the editor pointer by reference 2024-05-17 23:19:28 +02:00
WerWolv
2546c042dc fix: Crash when clicking on Advanced search in find popup 2024-05-17 23:16:49 +02:00
WerWolv
b54f46de30 fix: Crash when setting selection in a hex editor instance without provider 2024-05-17 22:43:35 +02:00
WerWolv
94bc279bd8 impr: Improved colors of toggle switches 2024-05-17 22:20:56 +02:00
WerWolv
2f7c2e79d2 impr: Remove ugly dark edges around light theme backdrop image 2024-05-17 22:18:44 +02:00
WerWolv
2ed5381f5a impr: Make menu bar items collapse less quickly 2024-05-17 22:14:15 +02:00
WerWolv
964d98dd7b impr: Remove frame borders in more cases 2024-05-17 22:05:32 +02:00
WerWolv
0571dae9b7 impr: Added frame borders in light theme 2024-05-17 21:58:16 +02:00
WerWolv
563bf78f03 impr: Allow providers to be closed quicker after being opened 2024-05-17 21:56:43 +02:00
WerWolv
cf480d95db build: Updated dependencies 2024-05-17 21:08:54 +02:00
iTrooz
44331506b2 test: Add code coverage support with CodeCov (#1681) 2024-05-17 19:08:22 +00:00
WerWolv
f6953fd829 impr: Merge in script loader structure improvements from python branch 2024-05-17 21:01:35 +02:00
WerWolv
663b99ed64 impr: Remove border from (?) hover button 2024-05-17 20:47:22 +02:00
WerWolv
0ef3be1851 fix: Look of some buttons and text fields with frame borders turned on 2024-05-17 20:38:30 +02:00
WerWolv
0453a23b12 impr: Cleanup .NET script library and API 2024-05-17 20:38:30 +02:00
WerWolv
7a14e3dac4 fix: Wayland error discarding build errors with older GLFW versions 2024-05-17 20:22:55 +02:00
WerWolv
275774a10a fix: C# OnLoad method not being run correctly 2024-05-17 09:27:00 +02:00
WerWolv
a6277533e8 impr: Better Intel GPU log warning 2024-05-17 09:26:41 +02:00
WerWolv
1426424899 fix: Window scaling defaulting to 1.0x instead of Native 2024-05-17 09:26:28 +02:00
WerWolv
85fa1b2122 fix: Log spam on Wayland 2024-05-17 09:26:13 +02:00
WerWolv
c28522b7ef fix: Settings sometimes being reset on shutdown 2024-05-16 19:00:31 +02:00
WerWolv
d90a04990b fix: Section button tooltips being visible even when not hovering buttons 2024-05-15 18:31:27 +02:00
WerWolv
027ff793ed fix: Icon text input boxes being wider than expected 2024-05-15 18:27:09 +02:00
WerWolv
c69d3bc7f4 fix: Visual glitches with highlights and selections in the hex editor view 2024-05-15 18:27:09 +02:00
WerWolv
ca17054a1e impr: Store settings and achievements immediately 2024-05-15 18:27:09 +02:00
WerWolv
6a9e07729f impr: Make pattern data filter behave more intuitively 2024-05-15 18:27:09 +02:00
iTrooz
ceeda6de3b doc: remove hex.builtin.provider.memory name (#1675) 2024-05-14 12:17:36 +00:00
iTrooz
17ab059b12 fix: fix Pattern::callUserFormatFunc() (previously Pattern::formatDisplayValue() with 3 args) sharing cache with Pattern::getFormattedValue() (#1674) 2024-05-14 09:26:34 +00:00
WerWolv
dedd99f30c patterns: Updated pattern language 2024-05-12 23:19:59 +02:00
WerWolv
add94c5926 fix: Loading of custom data processor nodes 2024-05-12 23:19:39 +02:00
WerWolv
a239edc759 fix: Locking layout not working correctly 2024-05-12 23:19:29 +02:00
iTrooz
ff569417fc test: Add plcli integration tests (#1671) 2024-05-12 00:19:20 +00:00
iTrooz
240bb299f0 fix: Fix CI failure with ImGui::SetTooltip() (#1672) 2024-05-11 21:52:33 +02:00
iTrooz
e2dd12416c git: run CI on tests/** branches 2024-05-11 21:42:27 +02:00
SparkyTD
2a726c7136 fix: TextEditor line numbers were still partially rendered despite mShowLineNumbers being set to false (#1669)
### Problem description
TextEditor line numbers were still partially rendered despite
mShowLineNumbers being set to false

### Implementation description
I wrapped the line no. rendering code in `if (mShowLineNumbers) { ...
}`.

### Screenshots
Before:

![image](https://github.com/WerWolv/ImHex/assets/45818400/58a2cfdd-1ee0-484b-ba05-6e886ad4fd65)

After:

![image](https://github.com/WerWolv/ImHex/assets/45818400/5d204e2b-12a5-4fc9-bcfc-da6b8e6359e1)
2024-05-11 18:11:14 +02:00
SparkyTD
62aea46c61 impr: Ensure that Text Editor's cursor blink state is never invisible after a keyboard event (#1664)
### Problem description
By default, the cursor's blinking cycle is independent from user
actions, which feels unconventional while editing pattern code. This
change ensures that the blinking cycle is reset, and the cursor is made
visible every time the editor receives a keyboard event like character
entry, or arrow navigation.


### Implementation description
I moved the hard-coded blink timing numbers to their dedicated static
constant fields since now they are referenced from multiple different
places.

I added the function `void ResetCursorBlinkTime()` to `TextEditor.cpp`
that will reset the blink cycle to `currentMillis() -
sCursorBlinkOnTime`, ensuring that the cursor is visible. This function
is called for every keyboard and mouse click event.

### Screenshots
Before:


https://github.com/WerWolv/ImHex/assets/45818400/668c6802-79a3-450b-80d3-d6abf2ce27be

After:


https://github.com/WerWolv/ImHex/assets/45818400/ee7f60e0-a75f-416d-b86d-8d12b5cdadf2

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-05-11 15:58:55 +02:00
SparkyTD
09bffb6745 impr: Add a link to the "Find" view in the search popup (#1665)
### Problem description
This PR adds a shortcut link on the Search (Ctrl+F) popup to the more
advanced "Find" view that is normally accessible at the `View > Find`
menu.

### Implementation description
I added a simple `ImGuiExt::IconHyperlink` link to the `draw()` function
of the `PopupFind` class to display the hyperlink. Clicking the link
will open the Find view, bring it into focus and close the current
popup.

### Screenshots
Before:

![image](https://github.com/WerWolv/ImHex/assets/45818400/0961f594-0548-426a-8622-20093d4a165e)

After:

![image](https://github.com/WerWolv/ImHex/assets/45818400/d40d78f4-1a5d-4bf6-97a4-ff7ab40d0cef)


### Additional things
- Localization keys were added to all .json files, but only `en_US` is
populated for now.
2024-05-11 10:15:17 +02:00
SparkyTD
3c91cb09e3 fix: Crash caused by missing ImGui::BeginDisabled() (#1667)
### Problem description
Merging my previous PRs, #1660 and #1658 has resulted in a conflict
causing an application crash due to a missing `ImGui::BeginDisabled();`
in the `PopupSelect` class. Specifically, none of the code related to
offset validation made it into the final merge. This PR fixes the crash
by reintroducing the deleted lines.

### Additional things
The nightly release build seems to be unaffected by the crash, most
likely because ImGui's `DisabledStack` assertions are only enforced in
Debug mode. The offset validation was still missing before this fix.
2024-05-11 00:52:43 +02:00
WerWolv
881a379fb4 fix: Compile error due to un-unpacked expected value 2024-05-10 23:02:39 +02:00
WerWolv
90a67af887 impr: Added better error messages to intel hex and motorola srec providers 2024-05-10 23:01:36 +02:00
WerWolv
d727100304 impr: Added tooltips for section view and export buttons 2024-05-10 22:54:55 +02:00
WerWolv
543fcf5447 impr: Make in variable values persistent between parser runs again 2024-05-10 22:51:53 +02:00
WerWolv
e9b140b75c impr: Make out variable values selectable and copyable in pattern editor 2024-05-10 22:41:12 +02:00
WerWolv
92a9843ef7 patterns: Updated pattern language 2024-05-10 22:40:53 +02:00
WerWolv
12528d6e6e fix: Edit -> Jump To -> Current Pattern not always resetting request correctly 2024-05-10 22:18:21 +02:00
WerWolv
8fae55487a fix: Closing providers not clearing selection correctly 2024-05-10 22:10:59 +02:00
SparkyTD
973af4650c impr: Convert all hex editor popups to floating, movable windows (#1658)
### Problem description
In previous versions of ImHex, all tool windows were implemented as
static popups fixed in the upper left position of the hex view. This PR
refactors all tool popups to use floating windows that can be dragged
around by the user, or closed with a dedicated close button on the title
bar. These popup also support a stylable transparency when the user is
not hovering their mouse over the window.

### Implementation description
I rewrote the logic in `ViewHexEditor::drawPopup()` to use a custom
`ImGuiExt::BeginHoveringPopup` function for rendering the popup windows.
This new function is an almost exact replica of the built-in
`ImGui::BeginPopupModal`, except it does also displays the default
window title bar with a close button.

A second custom function, `ImGuiExt::PopupTitleBarButton` was also added
for rendering small icon-based buttons into the title bar of the parent
popup window. This new function was used to implement an optional
"Pinning" feature that individual popup implementations can specify. If
a window is pinned, it won't close automatically when its main action is
executed. For example, the "Select" button on the Select dialog will
close the popup by default, unless the window is pinned.

### Screenshots
Popup dialogs before:

![image](https://github.com/WerWolv/ImHex/assets/45818400/7c253181-8284-4076-a066-089403554f0f)

Popup dialogs after:


https://github.com/WerWolv/ImHex/assets/45818400/99d1a628-8ac1-40ac-9146-9062091bb0db



### Additional things
- When the user stops hovering their mouse over a popup window, it
becomes semi-transparent, making it easier to see the content behind it
- This PR also introduces the `styles.imhex.popup-alpha` style, making
the transparency effect configurable, including the ability to disable
the effect completely by setting `popup-alpha` to `1.0`.
- Fixed a bug that caused some popup windows to ignore the Enter and the
KeypadEnter keys. With this PR, all tool windows will execute their main
action when the user presses either one of the two Enter keys, and will
also close automatically unless the window is pinned.

### Possible changes and improvements
- Should the transparency effect be disabled if a window is pinned?
- Should the transparency factor be modifiable on the Settings/Interface
page?
- A keyboard shortcut could be added for quickly pinning / unpinning the
current window.
- Can the pin icon stay on the left, or should it be moved next to the
close button, with a similar circular background?

---------

Co-authored-by: WerWolv <werwolv98@gmail.com>
2024-05-10 21:21:19 +02:00
SparkyTD
5f192d5dc7 impr: Don't move hex editor scroll position when jumping to address that's on-screen (#1660)
### Problem description
This PR offers two improvements:
1) When selecting / jumping to an offset that falls within the current
viewport of the scroll view, the scroll offset will no longer force the
selected byte to the top of the view. Instead, the scroll offset will
only be changed if the selected byte is outside the current view.

2) In case a wrong offset is entered into the Select or Goto dialog
(e.g. and offset beyond EoF), the dialog's button will be disabled.

### Implementation description
For the first change, I modified the logic that recalculates the
`m_scrollPosition ` based on the current byte offset.

For the second change, I added validation logic to both popups to ensure
that the entered offsets are valid (using `provider->getActualSize()`).
In case of the Select popup, I wrapped the button into an
`ImGui::Begin/EndDisabled` to enforce the validation check.
2024-05-10 21:20:10 +02:00
WerWolv
ec39546fed patterns: Updated pattern language 2024-05-10 11:14:53 +02:00
SparkyTD
ea0cafa229 fix: Not being able to close certain modal popups with the close button on the title bar (#1659)
### Problem description
When the close button is clicked, `ImGui::BeginPopupModal()` sets the
bool passed into the second parameter (p_open) to false. However, the
closing logic did not take this into account, making it difficult to
actually close modal popups.

For example, closing the "Export pattern File" modal took several clicks
on the "X" button, now it closes instantly.

### Implementation description
I added an additional check for the `open` variable being `false` in the
logic that checks the closing condition.
2024-05-09 17:49:31 +02:00
WerWolv
978fa17932 impr: Make accept pattern popup open faster and close correctly 2024-05-08 23:54:09 +02:00
WerWolv
6602e800ac fix: Make sure texture multisampling framebuffer is being unbinded in all cases
#1653
2024-05-08 23:08:53 +02:00
WerWolv
fdf9209605 build: Updated ImGui to v1.90.6 2024-05-08 22:56:20 +02:00
WerWolv
8a3739ee1c impr: Display background scripts in about page 2024-05-08 22:30:53 +02:00
WerWolv
89f360d1a7 fix: Texture multisampling being used on OpenGL < 3.2
#1653
2024-05-08 22:09:47 +02:00
WerWolv
d7ddf991a9 fix: Missing includes 2024-05-08 21:44:30 +02:00
WerWolv
19c02be673 impr: Only store paths with forward slashes in project files
Fixes #1657
2024-05-08 21:30:20 +02:00
SparkyTD
adbcc48de7 fix: Multiple file reload popups stacking on top of each other (#1654)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
This PR aims to address #1645 that caused the built in file provider's
change monitor to trigger the notification popup dialog multiple times
in a row after multiple external file changes.

### Implementation description
I added an additional boolean field
`m_changeEventAcknowledgementPending` that tracks whether there are any
pending or unacknowledged change notification dialogs to prevent further
dialogs from being opened. The flag is only reset to its initial value
once the user has acknowledged the first `PopupQuestion` dialog.

Since the file is reloaded only after the user clicks 'Yes', it is
unnecessary to ensure that only the latest popup is acknowledged.
2024-05-07 23:43:20 +02:00
WerWolv
a5eb031401 fix: Pattern data view rendering of bitfields within bitfields being broken 2024-05-07 23:32:51 +02:00
WerWolv
10351c5bdc fix: Text editor cursor not showing up anymore 2024-05-07 23:32:27 +02:00
WerWolv
5bc60d4b63 build: Updated dependencies 2024-05-07 23:32:12 +02:00
WerWolv
32a659a477 fix: Command palette losing focus when pressing Alt
Fixes #1651
2024-05-04 21:30:21 +02:00
WerWolv
40c4dbc20e impr: Make main menu bar not collapse completely when there's not enough space 2024-05-04 21:23:18 +02:00
WerWolv
f2b4e49ff3 fix: Crash when loading oobe screen 2024-05-04 19:54:57 +02:00
WerWolv
39dd67af78 patterns: Updated pattern language 2024-05-03 21:57:57 +02:00
WerWolv
337ec6bca6 impr: Better OpenGL texture load error messages 2024-05-03 21:41:02 +02:00
WerWolv
2994e69c08 impr: Refactor GLFW window hints into individual window files 2024-05-03 21:39:31 +02:00
WerWolv
49987b8793 impr: Indent license information in about page slightly 2024-05-03 21:38:35 +02:00
WerWolv
0f5e125992 impr: Added back multisampling with proper detection logic 2024-05-03 19:27:12 +02:00
WerWolv
57857559f5 fix: Disable texture multisampling for now as it causes issues on certain platforms 2024-05-03 14:02:43 +02:00
WerWolv
4eba620bee fix: Web version not starting due to unsupported texture multisampling 2024-05-02 09:40:39 +02:00
WerWolv
964a2e990e git: Fix broken .gitmodules 2024-05-01 20:51:44 +02:00
WerWolv
761bc941a8 impr: Make right click menus open faster 2024-05-01 20:50:35 +02:00
xtex
aa5a3ed080 lang: Refactored langtool, updated chinese translation (#1623)
- Better argument parsing
- Allow processing all language folders at the same time
- Allow an optional reference language when translating
- Save translations on KeyboardInterrupt
- Fixes a ooold input issues by importing readline
(https://github.com/kovidgoyal/kitty/issues/6560)
- Add untranslate mode to remove translations by a key regex

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-05-01 20:49:55 +02:00
daver32
6fbbf899b0 fix: Frame rate getting unlocked when inputs are being processed (#1632)
### Problem description
The framerate limiter doesn't work when inputs are being sent (eg mouse
cursor moving over the window), because `glfwWaitEventsTimeout` returns
early when it encounters an event.

### Implementation description
I made it sleep for the remaining time when that happens.
2024-05-01 20:48:41 +02:00
WerWolv
1df0eea6c6 impr: Added support for SVG loading, improved texture loading API 2024-05-01 20:36:10 +02:00
WerWolv
ef99e9d6f8 fix: Selectable text behaving weirdly when selecting 2024-04-29 21:20:54 +02:00
WerWolv
a685d2e97d impr: Make integer node accept math expressions 2024-04-29 21:20:38 +02:00
WerWolv
df04acc1b9 impr: Allow specifying buffer size in integer to buffer cast node 2024-04-29 21:20:22 +02:00
WerWolv
f510faa1da impr: Make integer, float and buffer visualizers selectable, added more radixes to integer node 2024-04-29 21:19:54 +02:00
WerWolv
3ad2c74519 impr: Make right click menu in data processor feel less sluggish 2024-04-29 20:43:25 +02:00
WerWolv
0e58204501 impr: Remove underline from hyperlinks if they're not hovered 2024-04-29 20:06:50 +02:00
WerWolv
f847807df5 fix: Buffer display data processor node being way too wide
#1644
2024-04-29 19:48:02 +02:00
WerWolv
81982aa821 impr: Make windows always fully opaque when they're not docked 2024-04-27 20:19:45 +02:00
WerWolv
08fc393451 build: Get rid of liblibimhex 2024-04-27 20:19:26 +02:00
Nora
a7033b68f7 feat: Support DWM immersive dark mode on Windows (#1636)
### Problem description
Implements support for DWM immersive dark mode.  
Closes #1635.

### Implementation description
Uses the DwmSetWindowAttribute API to enable this feature.

Documentation can be found
[here](https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/apply-windows-themes#enable-a-dark-mode-title-bar-for-win32-applications).

### Screenshots
Before:

![image](https://github.com/WerWolv/ImHex/assets/51166756/a2be204f-aa2d-44d7-8628-643a903d6679)

After:

![image](https://github.com/WerWolv/ImHex/assets/51166756/f6c9ab41-c811-45f7-826f-401dd712674b)

### Additional things
Nothing.
2024-04-27 10:03:44 +02:00
WerWolv
3794aa425d feat: Display destination address in goto popup 2024-04-23 23:26:58 +02:00
WerWolv
a1ea8dfd84 fix: Build issue again when GLFW_WAYLAND_APP_ID isn't defined 2024-04-23 21:03:04 +02:00
WerWolv
79e1df1af2 fix: Exporting selection doesn't export last byte 2024-04-23 21:02:16 +02:00
WerWolv
fd61e757f0 impr: Make unsaved changes popup behave more like in other applications 2024-04-23 21:02:16 +02:00
WerWolv
7ec245925a fix: Lockup when changing themes in some cases 2024-04-23 21:02:16 +02:00
WerWolv
f913cd742f impr: Added new ImHex Banners 2024-04-23 21:02:16 +02:00
Nik
cc7a0db35c fix: Build issue when GLFW_WAYLAND_APP_ID isn't defined 2024-04-21 17:04:56 +02:00
Integral
6f11873d7e fix: Missing window icon under wayland (#1633)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
When running ImHex under Wayland, the window icon is missing.

### Implementation description
Setting
[```GLFW_WAYLAND_APP_ID```](https://www.glfw.org/docs/latest/group__window.html#gafbf1ce7a4362c75e602a4df9e1bdecd3)
to fix the issue.

### Screenshots
Before:

![Screenshot_20240420_162144](https://github.com/WerWolv/ImHex/assets/71180087/3318970f-6ed7-4161-b686-c2eaa28a0739)


After:

![Screenshot_20240420_161920](https://github.com/WerWolv/ImHex/assets/71180087/e9e35fb6-e3c1-44a8-b7a5-b145dfe225d9)


### Additional things
<!-- Anything else you would like to say -->
2024-04-21 12:24:20 +02:00
WerWolv
4b1b52caf0 fix: Cell highlighting in hex editor view overlapping at non-integer scale factors 2024-04-13 15:34:12 +02:00
WerWolv
e9ebfe36b0 build: Updated ImGui to v1.90.5 2024-04-12 22:56:10 +02:00
WerWolv
43149498cf fix: Main window being hard to resize when bytes are selected in the hex editor view 2024-04-12 22:55:54 +02:00
FireNX70
43070a1f5b fix: Diff table in diffing view displaying incorrect end address (#1627)
Trivial fix for #1617 .
2024-04-11 23:49:58 +02:00
WerWolv
f135bd86ac patterns: Updated pattern language 2024-04-11 22:59:09 +02:00
WerWolv
0bd8c5d115 fix: Color vector in 3D visualizer not getting assigned the correct size 2024-04-10 22:53:51 +02:00
WerWolv
9de10df90d fix: Store hanging when updating all entries in some cases 2024-04-10 22:52:21 +02:00
WerWolv
46ed6e2487 patterns: Updated pattern language 2024-04-10 22:52:06 +02:00
WerWolv
d81d409051 impr: Modernize ImHex logo 2024-04-10 21:05:38 +02:00
WerWolv
5f75c8684f impr: Better UI for the case when no plugins could be loaded 2024-04-10 21:04:57 +02:00
WerWolv
5d08499d20 impr: Use sidebar for settings categories instead of tabs 2024-04-10 19:55:37 +02:00
WerWolv
4115184952 patterns: Updated pattern language 2024-04-05 18:49:40 +02:00
WerWolv
e6a14977b9 fix: Highlight and tooltip flickering when hovering over highlighted patterns 2024-04-05 18:49:19 +02:00
WerWolv
a449f7a5e3 build: Updated libwolv 2024-03-30 13:36:02 +01:00
WerWolv
51302cfd88 build: Lock libmagic to latest release in M1 macOS docker file 2024-03-30 11:03:45 +01:00
WerWolv
696612385a fix: Use std::ranges::find instead of std::ranges::contains for now 2024-03-29 16:34:01 +01:00
WerWolv
edf047dde8 impr: Cleanup bookmark UI 2024-03-29 15:40:15 +01:00
WerWolv
166cd6c426 patterns: Updated pattern language 2024-03-29 15:38:13 +01:00
WerWolv
51010096bb feat: Added provider information to search bar hover tooltip 2024-03-29 15:38:03 +01:00
WerWolv
4e5a7ba483 fix: Closing providers still appearing in the provider list 2024-03-29 15:37:34 +01:00
WerWolv
92803c1536 feat: Added simple insert mode to hex editor 2024-03-29 13:22:28 +01:00
RoboSchmied
cc593fb6c4 fix: Misspelling of Endianness (#1609)
### Problem description
fix 40 typos

### Implementation description
`endianess` => `endianness`

Signed-off-by: RoboSchmied <github@roboschmie.de>
2024-03-28 22:25:28 +01:00
York Waugh
aeabc0c436 lang: Updated Simplified Chinese translation (#1610)
Thank you for an outstanding program! I have updated the Simplified
Chinese translation. Hope you can adopt it.
2024-03-28 22:24:51 +01:00
Kihau
32ad8ddb53 build: Added dependency download script for OpenSUSE Tumbleweed (#1612)
## Add dependency download script for OpenSUSE Tumbleweed.

### Testing
After installing the dependencies, I have managed to successfully
compile the project as described in the building instructions:
https://github.com/WerWolv/ImHex/blob/master/dist/compiling/linux.md

I have tested the script on a fresh installations of the OpenSUSE:
- Tumbleweed Server
- Tumbleweed Generic Desktop

### Note
Dependencies added in the script are based off of scripts for other
Linux distributions.
Because of that, some download dependencies might not be necessary (or
could be already included by other packages), so it is very much
possible that some of them could be removed.
2024-03-28 22:24:10 +01:00
WerWolv
f084bc4147 fix: View registers causing crashes when being deleted 2024-03-28 22:21:00 +01:00
WerWolv
cb1dcc2c9f impr: Disable achievement popups if tutorial is skipped 2024-03-28 22:15:48 +01:00
WerWolv
8030de7af2 fix: Icons not being fractionally scaled anymore 2024-03-28 22:15:30 +01:00
WerWolv
dd5ddbcc0f fix: Settings being overwritten sometimes on crash 2024-03-26 19:49:10 +01:00
WerWolv
f587710d1c fix: Multiple memory corruption issues 2024-03-26 19:49:10 +01:00
WerWolv
99142525b6 patterns: Updated pattern language 2024-03-26 19:47:45 +01:00
WerWolv
2d9ef1142d build: Updated dependencies 2024-03-26 19:47:39 +01:00
WerWolv
547169ea78 fix: Missing includes 2024-03-26 19:46:25 +01:00
WerWolv
8d08ab20ec fix: Added missing ImHex paths to about page 2024-03-26 19:18:34 +01:00
WerWolv
966a780432 impr: Updated contributors list 2024-03-25 21:02:55 +01:00
WerWolv
99abc4e78a fix: Unifont characters being scaled wrongly
Fixes #1616
2024-03-25 20:41:39 +01:00
WerWolv
ce1d581c3f fix: Settings values being uninitialized by default 2024-03-25 20:41:05 +01:00
WerWolv
b31ae6e690 impr: Optimize includes in logger 2024-03-25 20:37:19 +01:00
WerWolv
e984fde966 fix: Crash on some platforms due to empty main menu bar
#1600
2024-03-23 12:26:23 +01:00
WerWolv
5d0b474a7e build: Move renaming of the macOS bundle to the CI 2024-03-23 00:33:46 +01:00
WerWolv
d09f2c4f26 build: Fix creating the macOS bundle from within the M1 docker 2024-03-22 23:47:24 +01:00
WerWolv
dd20a16d3a git: Fix macOS bundle upload path 2024-03-22 22:35:44 +01:00
WerWolv
7d22b71e86 git: Fix bundle path for signing 2024-03-22 22:24:25 +01:00
WerWolv
567ccbfc3a build: Don't postprocess libimhex.dylib 2024-03-22 22:18:18 +01:00
WerWolv
ca40775678 git: Make sure CI bundles correct macOS bundle into dmg 2024-03-22 21:57:33 +01:00
WerWolv
4916e5542a fix: Splash screen being scaled incorrectly 2024-03-22 17:52:10 +01:00
WerWolv
ac8ec2b622 fix: Icons not being scaled correctly anymore 2024-03-22 17:52:00 +01:00
WerWolv
9b9f7e2a1d fix: Decompress functions not extracting full data
Thanks a lot to tocklime
2024-03-22 17:34:49 +01:00
WerWolv
28ea91e6c3 build: Move macOS rpath fixing to install step 2024-03-22 17:31:53 +01:00
WerWolv
0d58307e82 build: Fix bundling issues on macOS 2024-03-22 17:24:44 +01:00
WerWolv
c8ca84ede9 fix: Prevent view providers from pointing to themselves and being saved as recent provider
#1607
2024-03-22 00:16:28 +01:00
WerWolv
ed2939c39e impr: Better UI and UX for the hex editor footer 2024-03-21 23:50:34 +01:00
WerWolv
d36bd253e8 feat: Allow shift-selecting multiple find view occurrences 2024-03-21 23:50:13 +01:00
WerWolv
4615dce0a9 build: Try fixing packaging issues with macOS bundles 2024-03-21 21:56:27 +01:00
WerWolv
7ce8aa3638 impr: Added better error logging in script loader init 2024-03-21 21:39:29 +01:00
WerWolv
9236b92dc1 fix: Memory leak when closing ImHex 2024-03-21 21:39:29 +01:00
Nobutaka Mantani
05ffcab911 build: Added support patches for FreeBSD (#1584)
This pull request fixes build on FreeBSD. The changes are conditioned
with `#if defined(__FreeBSD__)` preprocessor macro and they should not
affect build for other operating systems.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
Co-authored-by: iTrooz <hey@itrooz.fr>
2024-03-21 21:31:17 +01:00
WerWolv
61b9c0970b impr: Load unifont at correct size
Fixes #1604
2024-03-21 21:27:50 +01:00
paxcut
3b3701135f impr: Various fixes and an enhancement for the pattern editor (#1528)
Fixed console error messages using doc comment syntax highlights. Fixed
results of find not updating when march case was toggled. Fixed syntax
highlights of nested ifdefs. Fixed editor cursor blinks if OS focus goes
to another window. Fixed Highlights of "\\\"" was incorrectly handled.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-03-21 12:58:20 +00:00
iTrooz
f5987fde5a git: Fix MacOS packaging workflow in PRs (#1601)
Fix GeekyEggo/delete-artifact failing in PRs

https://github.com/GeekyEggo/delete-artifact/issues/25
2024-03-21 13:33:46 +01:00
iTrooz
e56b34f174 build: Mark tryDemangle as [[maybe_unused]] (#1606) 2024-03-21 13:33:23 +01:00
iTrooz
0fb43ccc2b fix: Use find_library() instead of find_file() to find system yara library (#1581)
Discord discussion:
https://discord.com/channels/789833418631675954/789840633414025246/1213564050848485427
2024-03-19 20:23:33 +01:00
WerWolv
48db4df028 build: Updated libromfs 2024-03-17 13:31:03 +01:00
WerWolv
86a0693081 fix: Crash when trying to open unopenable file 2024-03-17 13:20:02 +01:00
WerWolv
6295c1d0c3 feat: Added table pattern visualizer 2024-03-17 13:19:37 +01:00
WerWolv
35d29c8e30 patterns: Updated pattern language 2024-03-16 14:59:26 +01:00
WerWolv
ca78c4c2fc fix: Build errors when stacktrace headers are not present 2024-03-16 14:59:05 +01:00
WerWolv
f276409cde patterns: Updated pattern language 2024-03-16 10:03:23 +01:00
WerWolv
682f7bee72 patterns: Updated pattern language 2024-03-15 21:11:36 +01:00
WerWolv
43bec6a636 fix: Make sure pattern runtime is always properly configured 2024-03-15 21:08:03 +01:00
WerWolv
6eb9c750a7 fix: File open achievement not triggering when dropping a file onto ImHex 2024-03-15 21:07:45 +01:00
WerWolv
31c93c8c5c impr: Properly clear pattern editor when closing last provider 2024-03-15 21:07:21 +01:00
WerWolv
5aa1046541 fix: Potential crash when log file is unavailable 2024-03-15 21:06:47 +01:00
WerWolv
0f4504476a fix: File changed popup showing up when saving memory mapped file 2024-03-15 17:57:12 +01:00
WerWolv
3897245a7e fix: Control characters ending up in log files 2024-03-15 17:57:12 +01:00
WerWolv
373db3de95 fix: Potential crash on Linux when loading external libraries 2024-03-15 17:54:09 +01:00
WerWolv
a1437658af impr: Generate more useful stack traces on Linux 2024-03-15 17:53:12 +01:00
WerWolv
f4ec69021d impr: Manually implement VSync because GPU manufacturers are terrible at writing drivers 2024-03-14 21:18:57 +01:00
WerWolv
6012f20fb3 fix: Remove unused member variable in script loader provider wrapper 2024-03-14 20:56:08 +01:00
WerWolv
95da957f73 impr: Try to improve framerate limiting once more 2024-03-14 19:56:09 +01:00
WerWolv
642722bdb1 build: Enable cimgui on web builds again 2024-03-14 18:58:39 +01:00
WerWolv
cbc31f3c18 feat: Added short forms for commonly used commands 2024-03-14 18:24:31 +01:00
WerWolv
f2309ba079 impr: Make export selection task cancelable 2024-03-14 18:24:01 +01:00
WerWolv
246ed15d6d fix: Infinite loop when exporting selection to file 2024-03-14 17:52:44 +01:00
WerWolv
88756c83c7 fix: Right clicking reverse selected regions deselecting it 2024-03-14 17:49:46 +01:00
WerWolv
cf320266df fix: Linux build issues 2024-03-14 17:49:04 +01:00
WerWolv
47e7e80afe fix: Various issues with the virtual file system 2024-03-14 13:26:53 +01:00
WerWolv
0d880babfb fix: Advanced data information not showing up correctly 2024-03-13 22:39:21 +01:00
WerWolv
28ba34f1bf fix: Diffing option popup flickering when opening 2024-03-13 22:39:00 +01:00
WerWolv
e786cb8180 feat: Added option to create menu items from scripts 2024-03-13 19:50:05 +01:00
WerWolv
458584d778 feat: Added logger module to script loader 2024-03-13 19:49:48 +01:00
WerWolv
2c711ea206 feat: Load additional libraries from ImHex's /lib folder 2024-03-13 19:49:04 +01:00
WerWolv
7b25be51a5 fix: Base address issues with the data inspector and copy as array option
Fixes #1595
2024-03-13 16:38:44 +01:00
WerWolv
45b05a4846 fix: Denying server contact leaving crash upload option enabled
Fixes #1594
2024-03-13 09:41:04 +01:00
WerWolv
6972736abf fix: Remaining build issues 2024-03-13 09:40:37 +01:00
WerWolv
3798654f92 fix: Unix build issues with dladdr 2024-03-13 08:38:40 +01:00
WerWolv
fdf01dfb50 impr: Get rid of cimgui shared library by hooking pinvoke handler 2024-03-12 23:17:49 +01:00
WerWolv
876f091244 build: Make cimgui a shared library again 2024-03-12 19:44:21 +01:00
WerWolv
2988561f01 build: Try fix building issues with web build and Fedora 2024-03-12 19:09:01 +01:00
WerWolv
fbfc319ac1 build: Make dotnet script loader initialize properly with newer SDK version 2024-03-12 19:08:14 +01:00
WerWolv
9b1417f32d fix: ImHex using a ton of CPU power on Linux 2024-03-12 09:06:58 +01:00
WerWolv
c727762940 impr: Added AxCut to the about page 2024-03-11 21:26:03 +01:00
WerWolv
e3565d5bcb feat: Added support for creating views and drawing ImGui elemts from C# 2024-03-11 21:09:56 +01:00
WerWolv
a3f550c585 fix: Toasts not printing their message to the console correctly 2024-03-11 21:09:56 +01:00
WerWolv
c610d804b1 build: Added cimgui 2024-03-11 21:09:56 +01:00
WerWolv
3d592dbc79 fix: Highlighting not updating correctly when changing bookmark region
Fixes #1591
2024-03-11 14:00:52 +01:00
WerWolv
0186f2f456 feat: Added support for adding custom providers through C# 2024-03-10 22:05:26 +01:00
WerWolv
d817a813b0 fix: Update all task progress not increasing correctly 2024-03-10 18:59:35 +01:00
WerWolv
1d219ba511 build: Updated libwolv 2024-03-10 17:32:46 +01:00
WerWolv
285afb6d4b build: Updated libwolv 2024-03-10 15:58:57 +01:00
WerWolv
ca3708df71 fix: std::bind_front not supporting member functions everywhere 2024-03-10 15:40:32 +01:00
WerWolv
c2aafb14c2 fix: View provider not saving top-level data to project file 2024-03-10 15:32:01 +01:00
WerWolv
d4d1acb555 feat: Added --verbose command line option to enable debug logs 2024-03-10 15:22:14 +01:00
WerWolv
d1a59f8c1b fix: View provider not correctly saving its state to a project file 2024-03-10 15:17:15 +01:00
WerWolv
2fd17f97b6 build: Updated libwolv 2024-03-10 14:38:28 +01:00
WerWolv
45a3bdffe0 impr: Load small files into memory, open larger files as read-only by default
#841, #1585
2024-03-10 14:31:39 +01:00
iTrooz
f050c69ccd fix: fix ui plugin linking to pl when libimhex already does it (#1583) 2024-03-03 15:31:40 +00:00
WerWolv
c31a2551f1 git: Update release actions 2024-03-02 17:42:19 +01:00
WerWolv
90e93492a7 fix: Updater not working correctly on Windows 2024-03-02 17:42:02 +01:00
WerWolv
54266bf63b fix: Remove debug popup function in release mode to avoid build errors 2024-03-02 14:23:52 +01:00
WerWolv
ba12f7aec9 impr: Added testers to About screen 2024-03-02 11:57:30 +01:00
WerWolv
deafb6fe08 build: Allow precompiled headers to be turned off 2024-03-02 11:51:33 +01:00
WerWolv
091be1440a build: Added option to disable precompiled headers 2024-03-02 11:28:24 +01:00
WerWolv
030aee17f5 build: Disable precompiled headers in plugins again 2024-03-02 10:57:51 +01:00
WerWolv
bbbf836374 fix: Race condition when downloading multiple elements from the content store 2024-03-02 10:57:37 +01:00
WerWolv
f1b91ef360 fix: MIME based auto loading not working correctly 2024-03-02 10:57:13 +01:00
WerWolv
f6c59b456f impr: Move selection information to the top of the hex editor footer 2024-03-02 09:52:40 +01:00
WerWolv
8f3f941600 impr: Prevent ImHex from getting stuck in an infinite crash loop 2024-03-02 09:52:09 +01:00
WerWolv
e561f49e80 impr: Make welcome screen background look more interesting 2024-03-01 20:57:07 +01:00
WerWolv
2ff884fd11 feat: Replaced debug button functions with full debug menu 2024-03-01 20:56:46 +01:00
WerWolv
296af748ee fix: Platform window not being updated when recovering from a crash 2024-03-01 20:55:03 +01:00
WerWolv
0cb10fcc34 fix: Endless loop when throwing exception in deferred tasks 2024-03-01 20:54:27 +01:00
WerWolv
4a67ea0b29 patterns: Updated pattern language 2024-03-01 18:38:11 +01:00
WerWolv
8e94acc98f fix: Compile error 2024-03-01 18:37:28 +01:00
WerWolv
39cda3764b patterns: Updated pattern language 2024-03-01 18:23:45 +01:00
iTrooz
97f5175c84 impr: Better recovery from exceptions thrown in main thread (#1577)
This PR improves many things which can be seen by the commit name, but
the most important thing is the addition of a popup telling the user
when an exception is thrown


![image](https://github.com/WerWolv/ImHex/assets/42669835/db796416-9cce-4aa5-ad60-c22f05b5fc73)
2024-03-01 18:21:15 +01:00
WerWolv
78f8e5055e impr: Show hint if advanced data information section doesn't yield any result 2024-03-01 16:51:02 +01:00
WerWolv
735d896260 git: Run workflows on release branches 2024-02-29 22:28:29 +01:00
WerWolv
cb7a6596ba patterns: Updated pattern language 2024-02-29 22:23:34 +01:00
WerWolv
fdaa56fd86 build: Disable unknown pragmas warning 2024-02-29 21:49:36 +01:00
WerWolv
667b940feb fix: Build with precompiled headers for WebAssembly 2024-02-29 21:29:26 +01:00
WerWolv
bb3de7d510 fix: Build with precompiled headers on Linux 2024-02-29 21:15:51 +01:00
WerWolv
7bdde15796 build: Don't add defines to libimhex after precompiling headers 2024-02-29 20:39:14 +01:00
WerWolv
c412ba66d8 git: Updated compile instructions 2024-02-29 20:16:03 +01:00
WerWolv
dd62bee264 build: Added precompiled headers 2024-02-29 19:57:20 +01:00
WerWolv
f886eac7b5 build: Updated libwolv 2024-02-28 23:52:39 +01:00
WerWolv
623079ca40 fix: Pressing buttons while window is unfocused not working 2024-02-28 23:52:07 +01:00
WerWolv
ce9bd796d6 fix: Inserting bytes and resizing files not working correctly 2024-02-28 22:21:14 +01:00
WerWolv
d5f323a2cd feat: Allow workspaces to be deleted the same way as layouts
Fixed #1576
2024-02-28 22:10:48 +01:00
WerWolv
40592a93ac fix: MIME-based pattern loading not working correctly
Fixes #1574
2024-02-28 20:54:51 +01:00
WerWolv
dc1a5a860c fix: Buggy window detachment 2024-02-28 20:36:22 +01:00
WerWolv
f7b431902d fix: Make sure glfw waits properly on Wayland 2024-02-28 20:16:15 +01:00
WerWolv
686d47a59e fix: Frame limiting not working correctly on Linux 2024-02-28 18:48:01 +01:00
WerWolv
eaa4688182 fix: Crash when using CRC hashes 2024-02-27 22:39:18 +01:00
WerWolv
72645aa800 fix: Read-only file toast showing up for all providers 2024-02-27 20:20:28 +01:00
WerWolv
7044fc8004 fix: Import menu being disabled with read-only providers
Fixes #1573
2024-02-27 19:41:33 +01:00
Justus Garbe
9e8c780d66 fix: Use explicit string argument according to -Wformat-security on clang (#1572) 2024-02-27 19:07:44 +01:00
WerWolv
e1795d687f impr: Implement a better algorithm to determine if the frame content has changed 2024-02-27 18:55:18 +01:00
WerWolv
607f7cba8d fix: Yara rules not being read correctly in data information section 2024-02-27 18:01:30 +01:00
WerWolv
2572e23928 impr: Add better error handling when loading projects 2024-02-26 21:48:56 +01:00
WerWolv
60921031bd fix: Opening project files through the command line opening them as regular files 2024-02-26 21:43:28 +01:00
WerWolv
77550d902c feat: Added option to disable annotations in byte type graph 2024-02-26 21:41:43 +01:00
WerWolv
41935781fb fix: Build error due to use of localized strings 2024-02-26 21:13:57 +01:00
iTrooz
47362559ef tests: Add infrastructure for testing plugins (#1538)
This PR adds a test architecture to be able to test plugins

Main infrastructure done by @WerWolv

---------

Co-authored-by: WerWolv <werwolv98@gmail.com>
2024-02-26 20:51:08 +01:00
WerWolv
032ef0722d patterns: Updated pattern language 2024-02-26 20:49:42 +01:00
WerWolv
6e32f03a6b feat: Added plain text and similar bytes regions to byte types diagram 2024-02-26 20:49:35 +01:00
WerWolv
5731dcf135 impr: Make hex editor minimap rows stay a fixed height 2024-02-26 20:49:15 +01:00
WerWolv
66e0f54d0e build: Bumped version to 1.33.0 2024-02-25 21:54:48 +01:00
WerWolv
cadc9cecf1 build: Updated dependencies 2024-02-25 21:21:34 +01:00
WerWolv
491e2dfe56 fix: Parent hover setting name being wrong 2024-02-25 14:38:26 +01:00
WerWolv
29c7b342eb impr: Make file chooser filter bar be focused by default 2024-02-25 14:34:09 +01:00
WerWolv
ea601a7d03 feat: Added option to highlight pattern parents in the hex editor when hovering 2024-02-25 14:30:56 +01:00
WerWolv
dac45659c0 patterns: Updated pattern language 2024-02-25 12:35:09 +01:00
WerWolv
4f72c60eb0 fix: Text editors highlighting doc comments when they shouldn't 2024-02-25 12:35:01 +01:00
WerWolv
7434fdec6f impr: Move advanced analysis yara rules to the patterns repo 2024-02-25 11:32:05 +01:00
WerWolv
c4f3ea901a feat: Added more yara detection rules for languages, compilers and envs 2024-02-25 11:20:35 +01:00
WerWolv
58ad9f2ca8 impr: Small code layout improvements for diagrams 2024-02-25 11:20:04 +01:00
WerWolv
3fa06cc7c0 build: Remove compression from sdk again 2024-02-25 01:57:42 +01:00
WerWolv
d551e39a1c build: Handle install prefix being absolute when installing sdk package 2024-02-25 01:27:48 +01:00
WerWolv
afede0ff9c fix: Yara rule matching not working properly with non-zero base addresses 2024-02-25 00:16:14 +01:00
WerWolv
d51b065723 fix: Yara information task not being interruptable 2024-02-25 00:09:06 +01:00
WerWolv
752a2d2e8d fix: Magic information querying being wrong with non-zero base address 2024-02-24 23:53:34 +01:00
WerWolv
b57eaca365 build: Try to fix sdk packaging 2024-02-24 23:41:22 +01:00
WerWolv
859574c014 impr: .0f -> .0F 2024-02-24 23:34:29 +01:00
WerWolv
0505b123a0 impr: Remove weird spinner from data information view 2024-02-24 23:34:18 +01:00
WerWolv
00b3d7809c fix: Various issues with the digram and layered distribution diagrams 2024-02-24 23:23:53 +01:00
Nik
ec69849749 feat: Added font picker to the settings (#1570) 2024-02-24 22:46:52 +01:00
WerWolv
8bf7aa9ceb build: Respect DISTDIR env var when packing SDK 2024-02-24 22:46:16 +01:00
WerWolv
ca0b6f2c6d fix: Digram sample size being too low and filter options inverted 2024-02-24 19:04:58 +01:00
WerWolv
5182a61fcc fix: Interacting with popups that extend past the edge of the window 2024-02-24 18:59:01 +01:00
WerWolv
2f7b949bd1 impr: Split out digram and layered distribution in their own section 2024-02-24 18:54:35 +01:00
WerWolv
4100e48fe2 impr: Render digram and layered distribution to texture to improve frame rate 2024-02-24 18:07:20 +01:00
WerWolv
132b211796 impr: Add interactive tutorials button to the welcome screen 2024-02-24 16:10:05 +01:00
WerWolv
0d4d8efe4e build: Compress SDK package 2024-02-24 16:09:48 +01:00
WerWolv
393bea6d4b impr: Don't pass unique_ptr by const reference 2024-02-24 15:06:28 +01:00
WerWolv
b2edb0441a build: Make external plugins build again 2024-02-24 15:06:10 +01:00
WerWolv
9d02379583 impr: Don't allow opening the same file twice
Fixes #1569
2024-02-24 12:06:06 +01:00
WerWolv
3c365d65a4 impr: Nicer looking logger output colors 2024-02-24 11:28:47 +01:00
WerWolv
2049852a80 impr: More consistent naming for information sections 2024-02-24 10:06:56 +01:00
WerWolv
be6a7490fd build: Better formatting for main CMake file 2024-02-24 10:06:21 +01:00
WerWolv
222d0b74d0 patterns: Updated pattern language 2024-02-24 09:37:55 +01:00
WerWolv
cdde0dedc8 impr: Make crash restore popup not show up if there's nothing to restore 2024-02-24 00:37:17 +01:00
WerWolv
6b14facd29 impr: Cleanup task progress handling 2024-02-23 22:09:57 +01:00
WerWolv
a7d6a4968e fix: Certain language strings not loading correctly 2024-02-23 20:33:39 +01:00
WerWolv
2173707925 fix: Building with older libyara versions 2024-02-23 20:20:27 +01:00
WerWolv
75c03d56d2 fix: Opening files on macOS through the Open with... option
Fixes #1070
2024-02-23 20:17:33 +01:00
WerWolv
85ec807417 fix: Localization issue with script loader 2024-02-23 18:57:29 +01:00
WerWolv
e7df0d201f fix: Byte type distribution and entropy slider not updating 2024-02-23 18:44:41 +01:00
WerWolv
026713750d impr: Implement better string limiting algorithm 2024-02-23 18:32:12 +01:00
WerWolv
d19d62b1fc impr: Remember find popup input per provider
Closes #1567
2024-02-23 18:31:58 +01:00
WerWolv
1f9d0181c9 impr: Allow opening multiple files at once
Closes #1566
2024-02-23 18:03:37 +01:00
WerWolv
4d91e7f347 impr: Handle read-only files more gracefully 2024-02-23 17:59:37 +01:00
WerWolv
9bfdfa149e feat: Added search bar to file chooser popup, allow for custom naming functions 2024-02-23 17:52:42 +01:00
WerWolv
214e542da4 impr: Make sure lots of yara matches doesn't lag out the editor 2024-02-23 17:49:20 +01:00
WerWolv
daf74347a3 fix: Try to make menu bar always appear 2024-02-23 17:48:56 +01:00
WerWolv
61fd327aa1 fix: Focus restoring not working correctly 2024-02-23 17:48:37 +01:00
WerWolv
91dcfefc5c fix: Crash when recovering from a thrown exception in the main thread 2024-02-23 17:48:23 +01:00
WerWolv
8059f22a32 impr: Make sure that highlight invalidation doesn't happen more than once per frame 2024-02-23 17:47:59 +01:00
WerWolv
a271658154 impr: Added once execution and task progress increment helpers 2024-02-23 17:47:40 +01:00
WerWolv
e6854d6a6a fix: String limiting slicing unicode characters 2024-02-22 23:44:49 +01:00
WerWolv
1ede41c778 fix: Compile issues using GCC 2024-02-22 23:11:59 +01:00
WerWolv
ed905aa0ff build: Updated ImGui to v1.90.4 2024-02-22 22:32:18 +01:00
WerWolv
e28b72e356 feat: Added a basic C++ and MSVC detector yara signature 2024-02-22 21:31:53 +01:00
WerWolv
daf007fae7 fix: Added missing translations 2024-02-22 21:31:26 +01:00
WerWolv
684c339309 tests: Ignore files in plugins folder when checking languages 2024-02-22 21:31:05 +01:00
WerWolv
3a44b840be impr: Restructure yara rule handling again 2024-02-22 20:49:21 +01:00
WerWolv
5db041adb7 impr: Make sure crashes during logging cannot cause a deadlock 2024-02-22 20:48:35 +01:00
WerWolv
ce704a7d92 git: Update Linux and macOS build instructions to use Ninja 2024-02-22 20:48:15 +01:00
WerWolv
0a9dca5be7 impr: Save data information view settings to projects 2024-02-21 23:21:24 +01:00
WerWolv
5ccb7a7b9a feat: Added simple yara data analyzer 2024-02-21 23:17:12 +01:00
WerWolv
4bd24a4ffe impr: Refactor Yara view 2024-02-21 22:08:26 +01:00
WerWolv
56e7c15064 impr: Refactor and modularize data information view 2024-02-21 00:06:52 +01:00
WerWolv
a2ffac9424 impr: Reorder achievement save routine to never accidentally clear the file 2024-02-20 00:10:05 +01:00
WerWolv
ca35c90cbb fix: Main menu not appearing for the first 200ms 2024-02-19 22:23:17 +01:00
WerWolv
74d59705ad fix: Issues where files are only being partially overwritten instead of truncated 2024-02-19 22:22:59 +01:00
WerWolv
adc51d3773 fix: Crash when restarting ImHex more than once 2024-02-19 22:06:46 +01:00
WerWolv
218946d5de fix: Crash when opening the interface settings tab 2024-02-18 22:45:54 +01:00
Nik
6b32fcef0f git: Remove ugly underlines between banners in readme 2024-02-18 22:32:11 +01:00
WerWolv
016d47b9d7 web: Make sure settings are loaded correctly 2024-02-18 14:02:21 +01:00
WerWolv
1bf1a56b01 git: Add more visible download banners to readme 2024-02-18 13:52:07 +01:00
WerWolv
0413302470 feat: Added setting to disable command palette button 2024-02-18 11:38:22 +01:00
WerWolv
01c934f53a impr: Rework setting change listeners 2024-02-18 11:29:18 +01:00
WerWolv
c1aac6c85e fix: Data inspector showing double negative signs sometimes
Fixes #1534
2024-02-18 10:06:51 +01:00
WerWolv
ed292a1e7a impr: Implement basic exception catching in main thread 2024-02-18 02:12:57 +01:00
WerWolv
61b164a183 feat: Added option to export table in find view 2024-02-17 21:42:41 +01:00
WerWolv
d196169bea fix: Additional folder paths not being loaded from config correctly 2024-02-17 21:30:23 +01:00
WerWolv
a2284a5143 fix: Crash when specifying invalid hash parameters
Fixes #1555
2024-02-17 21:28:30 +01:00
WerWolv
7486468537 fix: Localization issue with custom CRCs 2024-02-17 21:26:31 +01:00
Nik
e475e763db build: Hopefully fix macOS x86 build issues (#1556)
#1109
2024-02-17 21:01:57 +01:00
WerWolv
dfdd06b24c impr: Set name of background service thread 2024-02-15 22:10:11 +01:00
WerWolv
510ed25509 fix: Crash when saving a new file to disk 2024-02-15 22:09:58 +01:00
WerWolv
9f2f01c17d fix: Modification highlighting not working correctly when provider data was moved 2024-02-15 22:09:37 +01:00
WerWolv
12ba05385b fix: Saving not removing red highlighting 2024-02-15 21:54:41 +01:00
WerWolv
f113a2befe build: Only do dynamic linking of libpl on Windows 2024-02-15 16:10:16 +01:00
WerWolv
cc8a1ccc8b git: Try signing x86 macOS build _again_ before packaging
#1500
2024-02-15 15:40:58 +01:00
WerWolv
2f88994c37 fix: Data inspector not updating correctly when data has changed
Fixes #1545
2024-02-15 13:01:34 +01:00
WerWolv
e016c8a702 fix: Double clicking pattern data row not selecting the editing textbox
Fixes #1546
2024-02-15 13:01:03 +01:00
WerWolv
982d367b11 patterns: Updated pattern language 2024-02-15 11:54:59 +01:00
Sten Feldman
d70f7422b7 feat: Support Copy/Paste on WASM build outside the application border (#1542)
### Problem description
WASM build does not support copy/paste beyond the application. Meaning,
there's no practical way of sending text back and forth across the
application border.

There are lengthy threads why this is a technical challenge in
WASM/Browser world, e.g:
- https://github.com/pthom/hello_imgui/issues/3
- https://github.com/emscripten-core/emscripten/pull/19510

### Implementation description
Implements a workaround solution as Header only C++ library, as proposed
and implemented at:
https://github.com/Armchair-Software/emscripten-browser-clipboard

Maybe there are cleaner ways of achieving the functionality. Definitely
would like to have some discussion around this. 👀

ℹ️ The proposed PR "works for me" on Windows, using CTRL-C/V shortcuts
to copy text from and to the application. On MacOS the system shortcut
to Paste is different from what ImHex has defined. This results in
system Paste shortcut of command-V triggering the browser callback to
synchronise the application clipboard, but no actual Paste takes place
within ImHex.

If there would be a clean way to trigger the paste command, that would
be wonderful (or get the context and references to write the data to the
cursor, but I was unable to find a clean solution). The only proposed
solutions in the referenced threads were about triggering paste event
internally via Key events. This seemed wonky 🙃 , so is not currently
implemented. At the moment the paste on MacOS is command+V followed by
control+V.

### Additional things
This is definitely a stopgap solution before the ImGui and Emscripten
take a more proper solution in enabling Copy/Paste outside the
application borders. However, I feel like this is a must have capability
to make the WASM build more useful, not just for trying out ImHex.

Cheers! 🍻

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-02-13 20:30:18 +01:00
reggie
56b2e09b01 build: Fix zstd not being linked in correctly (#1544)
Prior to this, at least on Linux/MacOS/etc, I guess it was not possible
to compile with Zstd included for `hex::dec::zstd_decompress()`:


![image](https://github.com/WerWolv/ImHex/assets/56618074/008dbb3d-eeaf-4f49-a918-4751ec69f00c)

Every other target lib for the decompression plugin would compile,
**except for** Zstd. Additionally, the target name `zstd` caused CMake
to not be able to find `Find(ZSTD).cmake` due to case-sensitivity
differences between Windows and Unix-based file paths, of course.
With that said, I'm not too sure if this will break building w/ Zstd on
Windows... Hopefully not 😄
2024-02-13 20:22:28 +01:00
WerWolv
ee3d6ec24b feat: Made sum hash calculation more useful 2024-02-13 20:20:48 +01:00
WerWolv
03beca1099 fix: Broken editing view column rendering in pattern drawer 2024-02-12 19:40:21 +01:00
WerWolv
588f8af966 impr: Remove separator line in view menu if fullscreen and always on top are disabled 2024-02-11 23:02:34 +01:00
WerWolv
eee5e9cd7f fix: Missing translation string in pattern drawer 2024-02-11 23:00:17 +01:00
WerWolv
27a78a00fd patterns: Updated pattern language 2024-02-11 20:44:21 +01:00
WerWolv
0aae605ac4 fix: Processing and drawing of diffs 2024-02-11 19:29:02 +01:00
WerWolv
5cfcca0bc4 feat: Allow switching off borderless window mode 2024-02-11 14:12:14 +01:00
WerWolv
daf4e5cad6 refactor: More cleanup of the main file 2024-02-11 13:46:06 +01:00
WerWolv
27b5d13733 impr: Store default setting when setting couldn't be loaded 2024-02-11 11:44:58 +01:00
WerWolv
5d405b4d10 build: Updated GLFW and OpenGL3 ImGui Backends 2024-02-11 11:44:44 +01:00
WerWolv
4519e24297 impr: Make corner icon stick out a bit less 2024-02-11 11:21:06 +01:00
WerWolv
2fd81c7ffd impr: Better UI for the main about screen page 2024-02-11 00:35:10 +01:00
WerWolv
106c35344b fix: Fade in and out of language text in oobe screen being broken 2024-02-11 00:18:20 +01:00
WerWolv
12f64e5fde build: Updated ImGui to the latest release 2024-02-11 00:11:56 +01:00
Nik
bcbcb1f23c impr: Various web build improvements, API cleanup (#1541) 2024-02-10 23:31:05 +01:00
WerWolv
4b20e35fd2 fix: macOS window missing decoration after restart 2024-02-10 10:17:15 +01:00
iTrooz
f332963c75 build: remove IMHEX_COMMIT_HASH_SHORT cmake flag (#1539) 2024-02-10 01:40:33 +00:00
WerWolv
a5f6756659 impr: Hide window immediately after render loop finishes 2024-02-09 19:42:47 +01:00
WerWolv
ebe0276141 impr: Add small gap between window frame and title bar buttons 2024-02-09 19:39:26 +01:00
WerWolv
9d47ba9031 impr: Cleanup pattern drawer, added comment column 2024-02-09 18:37:05 +01:00
iTrooz
09dd25dc0a fix: Remove debug package created by makepkg (#1537) 2024-02-08 15:49:28 +00:00
WerWolv
dfc249135f build: Make plugin RPATH on Linux point to the plugins folder 2024-02-07 21:51:59 +01:00
WerWolv
c3d755a3e2 fix: Decoding of Windows error messages being broken 2024-02-07 21:51:37 +01:00
WerWolv
1195d2f2e4 patterns: Updated pattern language 2024-02-05 18:49:51 +01:00
WerWolv
b05f478207 patterns: Updated pattern language 2024-02-04 21:45:53 +01:00
WerWolv
1c28d4f610 fix: Error message formatting 2024-02-04 20:59:33 +01:00
WerWolv
77baf6f522 fix: Native error message formatting on Windows 2024-02-04 20:21:16 +01:00
WerWolv
f583df6c7d impr: Improve overwriting individual characters in the hex editor editing mode 2024-02-04 17:19:08 +01:00
WerWolv
4093fadcae fix: Revert Windows title bar changes since window wasn't draggable anymore 2024-02-04 14:59:33 +01:00
WerWolv
16adacb722 fix: Footer height being wrong 2024-02-04 14:18:20 +01:00
Nik
5e5714baeb patterns: Merged in new pattern language refactor (#1533) 2024-02-04 14:03:42 +01:00
WerWolv
f60986de8e fix: Window title bar not looking correct on Windows 2024-02-04 13:55:15 +01:00
WerWolv
a6f4d0cdec impr: Unfocus ImGui windows when main window loses focus 2024-02-03 23:56:08 +01:00
WerWolv
64d147bf96 fix: Window footer being way too narrow 2024-02-03 22:43:06 +01:00
WerWolv
fe3facfc95 impr: Implement borderless window mode for macOS 2024-02-03 22:39:31 +01:00
WerWolv
3555fc01c5 impr: Allow closing menus by clicking on title bar on Windows 2024-02-03 20:19:45 +01:00
WerWolv
ab02cb0a19 build: Bundle libpl into rpm packages 2024-02-03 19:59:58 +01:00
WerWolv
24815c0370 fix: libpl not being installed correctly 2024-02-03 14:43:41 +01:00
WerWolv
a03e8dd879 impr: Harden settings system to not crash ImHex when having outdated configs
Fixes #1514
2024-02-03 12:16:36 +01:00
WerWolv
2ea0bbe5ca fix: Window title not always updating correctly 2024-02-03 11:29:04 +01:00
WerWolv
21e1d01394 patterns: Updated pattern language 2024-02-03 11:14:08 +01:00
WerWolv
ab842cbd73 build: Fix pattern language shared library ending up in the wrong folder on Linux 2024-02-03 10:41:11 +01:00
WerWolv
e864c1aaac fix: Crash due to libmagic bug when using MAGIC_COMPRESS with magic_buffer
#1529
2024-02-02 23:22:46 +01:00
WerWolv
a80f9e9ca7 build: Don't re-sign macOS bundle unless requested 2024-02-01 23:56:14 +01:00
WerWolv
959a404e1c fix: Don't pass nullptrs to libmagic
#1485
2024-02-01 22:35:24 +01:00
iTrooz
7546655695 fix: Fix detected wasm file size being wrong (#1525) 2024-02-01 14:03:33 +00:00
WerWolv
be0e50f983 web: Fix progress bar overflowing 2024-02-01 12:40:37 +01:00
WerWolv
baaf84298c impr: Disable console color output in web version 2024-02-01 12:09:43 +01:00
WerWolv
dfeb9dbc84 web: Allow setting language through URL parameters 2024-02-01 11:57:26 +01:00
WerWolv
4fd4b3dfad fix: Using cli arguments with statically linked plugins not working 2024-02-01 11:40:27 +01:00
WerWolv
7709f4e307 feat: Allow setting language through the command line 2024-02-01 10:58:45 +01:00
WerWolv
26eec66f89 web: Make progress bar prettier 2024-02-01 10:18:54 +01:00
iTrooz
e3c3233b3a feat: Add progress bar to web version (#1523) 2024-01-31 21:15:23 +00:00
WerWolv
f0a44e54d0 feat: Add export selection to file option 2024-01-31 22:07:08 +01:00
WerWolv
7a6ee756b8 patterns: Updated pattern language 2024-01-31 15:40:29 +01:00
WerWolv
944b3a5b6c fix: Selection valid check not working correctly 2024-01-31 15:31:51 +01:00
WerWolv
4a9bac3cd5 fix: Crash when opening file picker 2024-01-31 15:31:23 +01:00
WerWolv
2e630a48f7 build: Downgrade and lock emsdk version for now 2024-01-31 14:36:36 +01:00
iTrooz
baf1e88689 doc: fix --build flag in web docker compose (#1522) 2024-01-31 11:19:26 +00:00
WerWolv
80953a2286 feat: Allow jumping from hex editor to patterns and from patterns to source line 2024-01-31 11:26:22 +01:00
WerWolv
6393bfda37 build: Updated libwolv 2024-01-30 23:36:52 +01:00
WerWolv
d0bdfcd20b git: Update more github actions 2024-01-30 22:31:04 +01:00
WerWolv
e7b615c7e7 fix: Memory leak in event manager 2024-01-30 22:00:42 +01:00
WerWolv
2fd370f4ae tests: Clear events after tests ran 2024-01-30 21:24:26 +01:00
WerWolv
6b86ef3015 fix: Missing include 2024-01-30 21:20:53 +01:00
WerWolv
10f6aa3e4e fix: Default magic database not being bundled correctly 2024-01-30 21:19:43 +01:00
WerWolv
d5365fbf0c git: Update more actions due to NodeJS 16 deprecation 2024-01-30 21:19:25 +01:00
WerWolv
66d4034a4e build: Fix issues with large Windows builds 2024-01-30 21:19:04 +01:00
WerWolv
f4d1049be4 fix: More build errors 2024-01-30 16:32:48 +01:00
WerWolv
c2ff6f4e6b fix: Missing includes 2024-01-30 15:50:00 +01:00
WerWolv
79834b9566 impr: Added language selection to oobe screen 2024-01-30 14:57:36 +01:00
WerWolv
5459be46a4 patterns: Updated pattern language 2024-01-30 12:18:03 +01:00
WerWolv
d584edf546 impr: Improve situation where ImHex crashes on exit when resources aren't cleared properly 2024-01-30 11:21:34 +01:00
WerWolv
0cba735eb3 impr: Discard wayland platform errors 2024-01-30 00:47:02 +01:00
WerWolv
62978e5d34 feat: Added setting to always show provider tabs 2024-01-30 00:11:45 +01:00
WerWolv
3ea32212d7 feat: Added ASCII count minimap visualizer 2024-01-30 00:00:51 +01:00
WerWolv
ba6373daa4 fix: Moving Hex Editor cursor downwards jumping entire page at once 2024-01-29 23:29:18 +01:00
WerWolv
18b717594f fix: Rendering issues with Hex Editor Minimap 2024-01-29 23:28:53 +01:00
WerWolv
76e304c34e build: Fix various issues with linking, clang and unity builds 2024-01-29 22:57:39 +01:00
WerWolv
2e74a78f46 build: Improve unity builds 2024-01-29 21:18:32 +01:00
WerWolv
6a146e239a fix: Workspaces not being exported correctly 2024-01-29 20:50:00 +01:00
WerWolv
cecb8b8d31 fix: Linking issues and menu bar not appearing sometimes 2024-01-29 15:44:18 +01:00
Nik
339541a56f impr: Restructure various components much better (#1520) 2024-01-28 22:14:59 +01:00
WerWolv
6709087760 git: Update actions to latest versions 2024-01-28 22:10:37 +01:00
WerWolv
069544eb93 feat: Added Minimap to Hex Editor 2024-01-28 15:28:55 +01:00
iTrooz
17f769c40d feat: separate cmake configure steps + remove CMakeCache cache (#1519) 2024-01-28 11:40:12 +00:00
WerWolv
ba20790ed2 build: Make libpl not being linked twice 2024-01-28 01:09:26 +01:00
WerWolv
cb3bace15e lang: Update German translation 2024-01-27 22:16:50 +01:00
WerWolv
7c6f4d7bff feat: Added many new Hash algorithms 2024-01-27 20:24:53 +01:00
WerWolv
f0a56b4201 fix: Pattern code not being parsed when loaded from project 2024-01-27 17:33:15 +01:00
WerWolv
d2a26017d7 fix: Build error due to mismatching types 2024-01-27 16:56:18 +01:00
WerWolv
61048757e6 impr: Allow custom encodings with only single-byte characters to be displayed immediately 2024-01-27 16:49:31 +01:00
WerWolv
25b4745997 impr: Make zlib decompress function take in a windowSize parameter 2024-01-27 16:12:02 +01:00
WerWolv
7fec97561b git: Updated build instructions for macOS 2024-01-27 15:05:53 +01:00
paxcut
1957d6f432 feat: Added find-replace to pattern editor (#1465) 2024-01-27 14:52:20 +01:00
WerWolv
823881f7f1 fix: Invalid parameters passed to task progress bar formatter 2024-01-27 14:15:08 +01:00
PerikiyoXD
11f75f72ee feat: Add search options for string encoding and endianness (#1490)
Added search options for string encoding (UTF-8, UTF-16, UTF-32) and
endianness (Little, Big) in the hex editor. This enhancement allows
users to customize the search process based on different string
encodings and byte orders.

Affected files:
- `plugins/builtin/romfs/lang/de_DE.json`
- `plugins/builtin/romfs/lang/en_US.json`
- `plugins/builtin/romfs/lang/es_ES.json`
- `plugins/builtin/romfs/lang/it_IT.json`
- `plugins/builtin/romfs/lang/ja_JP.json`
- `plugins/builtin/romfs/lang/ko_KR.json`
- `plugins/builtin/romfs/lang/pt_BR.json`
- `plugins/builtin/romfs/lang/zh_CN.json`
- `plugins/builtin/romfs/lang/zh_TW.json`
- `plugins/builtin/source/content/views/view_hex_editor.cpp`

Resolves: #1325

---------

Co-authored-by: Nik <werwolv98@gmail.com>
2024-01-27 14:13:41 +01:00
WerWolv
5747b72a41 fix: Exit hex editor editing mode when right clicking
Fixes #1499
2024-01-27 13:41:38 +01:00
WerWolv
44510b5b64 impr: Make task progress not display -100% when in no progress state 2024-01-27 11:02:14 +01:00
WerWolv
6a1a991c08 fix: Pattern settings resetting at re-evaluation 2024-01-27 10:49:40 +01:00
WerWolv
33637e92b5 impr: Make changing pattern settings re-evaluate the code 2024-01-26 22:08:46 +01:00
WerWolv
4c06fd2fb8 impr: Allow plugins to be loaded in debug builds 2024-01-26 21:11:56 +01:00
WerWolv
f5c529b2b3 build: Define DEBUG macro again only in debug builds 2024-01-26 21:11:42 +01:00
iTrooz
b7349e42c7 feat: Allow users to open multiple files with the same name in the web version + make web Dockerfile able to run web server by itself (#1518) 2024-01-26 18:52:05 +00:00
iTrooz
a4d6932ed8 fix: remove TODO + show error message when reading/write in process provider (#1516) 2024-01-26 18:44:52 +00:00
WerWolv
d23d382038 impr: Disable the initial oobe screen in the web version 2024-01-26 16:54:27 +01:00
WerWolv
bde476dfb7 build: Make sure libraries are correctly linked in external plugins 2024-01-26 12:36:07 +01:00
Nik
6ae86ce906 build: Get rid of pkgconfig as much as possible (#1517) 2024-01-26 12:13:22 +01:00
WerWolv
b2121b25c1 fix: Set windows drop handler effect to copy 2024-01-26 00:08:15 +01:00
WerWolv
a08afcf11a impr: Add fallback file drop handler to Windows 2024-01-25 23:53:41 +01:00
WerWolv
919110b024 impr: Make data information view have per-provider state 2024-01-25 22:49:56 +01:00
WerWolv
9c25a1609e feat: Add more magic information to the information view 2024-01-25 22:49:22 +01:00
iTrooz
d86bf44e39 git: Add script to check localized texts occurrences in code (#1511)
This script will be executed on every CI run as part of tests, and will
ensure no unlocalised strings are present in the code

Note that texts without the `_lang` suffix will not be checked, e.g.
96fe608d60/plugins/builtin/source/content/views/view_provider_settings.cpp (L10)
2024-01-25 21:23:03 +01:00
iTrooz
e61ee528ff fix: Fix theme detection on Linux (#1512) 2024-01-25 19:46:12 +00:00
iTrooz
82b56613e9 fix: fix build with edlib (#1513) 2024-01-25 19:25:51 +00:00
WerWolv
78723887e1 build: Updated dependencies 2024-01-25 11:33:34 +01:00
WerWolv
920b403ee3 build: Fixed libimhex not finding nlohmann json on some platforms 2024-01-25 11:05:02 +01:00
WerWolv
390c1469b1 build: Fix rpath issues on macOS 2024-01-24 22:30:40 +01:00
WerWolv
b605c463a1 impr: Further improve interfacing with external plugins 2024-01-22 23:35:00 +01:00
WerWolv
00491c8d90 git: Put libimhex and the ui plugin library under LGPLv2.1 2024-01-22 19:05:04 +01:00
WerWolv
cc3a9f1e81 build: Fix finding .NET runtime when there's multiple installed versions 2024-01-22 14:59:23 +01:00
WerWolv
60e7362f4e feat: Allow extra plugin folders to be specified with the --plugins cli option 2024-01-22 12:53:07 +01:00
WerWolv
f2bab005d0 fix: Make screenshots on initial launch screen behave better in web version 2024-01-22 08:25:29 +01:00
WerWolv
7068a883ed feat: Added basic byte sum hash 2024-01-21 23:31:53 +01:00
WerWolv
3783ec6a23 impr: Save settings of all hashes to disk 2024-01-21 23:31:44 +01:00
WerWolv
0aaa02b347 fix: Diffing plugin not registering localization strings correctly 2024-01-21 23:30:05 +01:00
WerWolv
1af3bf5da7 fix: Crash on exit 2024-01-21 21:39:55 +01:00
WerWolv
d5a57564fe fix: Build issues due to unused variables 2024-01-21 21:39:50 +01:00
WerWolv
2d92858193 feat: Allow switching to other providers through command palette 2024-01-21 21:29:03 +01:00
WerWolv
f666751f5f build: Disable edlib unit tests 2024-01-21 19:55:10 +01:00
Nik
58603ed12a impr: Better experience when first starting ImHex (#1510) 2024-01-21 18:39:51 +01:00
Nik
d005b5d2d9 feat: Allow toolbar icons to be modified (#1509) 2024-01-21 18:39:32 +01:00
Nik
a13b5bf8c0 feat: Implement Myers' diffing algorithm (#1508) 2024-01-21 18:39:13 +01:00
iTrooz
9d351317b8 impr: Do not mark memory providers as dirty when creating them (#1506)
This is in an effort to avoid unnecessary popups
2024-01-21 18:38:58 +01:00
WerWolv
f29d784e13 build: Update .NET SDK version on Fedora 2024-01-21 18:04:18 +01:00
WerWolv
2e582e3a45 fix: Ambiguous conversion to UnlocalizedString 2024-01-21 14:31:19 +01:00
WerWolv
566147dfae fix: Popups not always appearing when starting ImHex 2024-01-21 14:22:08 +01:00
WerWolv
3e5967c5a7 fix: Dropping files onto ImHex opening them twice 2024-01-20 21:03:46 +01:00
WerWolv
52fda5aeb7 fix: Build issue on AlmaLinux due to missing include 2024-01-20 10:35:51 +01:00
WerWolv
a657a23aaa fix: Crash when hex editor view got too small 2024-01-20 10:33:11 +01:00
WerWolv
b32055290a fix: Assertion when there's too many hex editor rows on the screen 2024-01-20 10:32:31 +01:00
Ada
cc97c0e525 fix: Segfault when launching ImHex with file arguments (#1501)
d511080814 introduced a regression where
running imhex with arguments (i.e. `imhex blob1.bin blob2.bin`) will
segfault due to a null pointer dereference.

### Implementation description
This patch updates `getSubCommands` to follow the same control flow as
`getFeatures`, where if the function returns a null pointer, it will
return gracefully rather than crash.
2024-01-18 11:11:06 +01:00
WerWolv
ffb324f685 patterns: Updated pattern language 2024-01-16 00:46:01 +01:00
WerWolv
ad53a0bf4c build: Make PDB generation slightly better 2024-01-16 00:31:46 +01:00
WerWolv
2cc07f0e73 build: Add option to not generate PDB files in release builds 2024-01-15 23:33:31 +01:00
WerWolv
b3d3794e1d patterns: Updated pattern language 2024-01-15 21:10:44 +01:00
WerWolv
82a3017629 feat: Added always on top and fullscreen mode toggle 2024-01-15 20:52:08 +01:00
WerWolv
d511080814 impr: Make plugin features and subcommands work in statically linked builds 2024-01-13 00:34:13 +01:00
WerWolv
db1373d572 fix: Compile error due to types not being constexpr everywhere 2024-01-13 00:33:55 +01:00
WerWolv
ea7483f9a7 impr: Get rid of the concept of built-in plugins
#1489
2024-01-12 23:03:13 +01:00
WerWolv
7441720a88 fix: Invalid signedness in comparison 2024-01-12 18:33:18 +01:00
WerWolv
0d0dd7d57c fix: Make syncing pattern code not erase pattern code as often 2024-01-11 21:56:54 +01:00
WerWolv
e5c7e52d72 fix: Don't show info banner if there's nothing to show 2024-01-11 20:11:52 +01:00
WerWolv
72f4331703 feat: Added virtual files to the pattern language 2024-01-11 20:11:22 +01:00
WerWolv
5f02320e8e impr: Make drag n drop overlay localizable 2024-01-11 10:20:39 +01:00
WerWolv
3449525ead feat: Added drag-n-drop overlay for windows 2024-01-10 23:46:50 +01:00
WerWolv
1c17ec5599 fix: Avoid heap allocations in thread local storage 2024-01-10 20:13:53 +01:00
WerWolv
6611c865f7 fix: Missing <codecvt> include
Thanks to pxd
2024-01-10 19:48:26 +01:00
WerWolv
016c93e795 build: Update xdgpp submodule to rehosted github mirror 2024-01-10 15:38:27 +01:00
WerWolv
f518bdadbd fix: Properly clear thread-local thread name 2024-01-09 21:46:54 +01:00
WerWolv
b408baf254 impr: Make window management tools work better 2024-01-09 17:24:27 +01:00
WerWolv
58441634d6 fix: Provider information in information view always showing info from current provider 2024-01-09 16:48:49 +01:00
WerWolv
d5c8021b41 fix: Use a thread-local storage for thread names instead 2024-01-09 16:16:20 +01:00
WerWolv
929b5176ce impr: Fallback to old thread name API when new one isn't available 2024-01-09 13:43:34 +01:00
WerWolv
179a65ed8b fix: Crash on exit 2024-01-09 11:49:49 +01:00
WerWolv
dd9a2e1818 fix: Errors being thrown during library init 2024-01-09 11:38:56 +01:00
WerWolv
0b5656dcc4 fix: Manually initialize library plugins 2024-01-09 11:31:56 +01:00
WerWolv
037d77f28e impr: Improve plugin unload logging 2024-01-09 10:54:53 +01:00
WerWolv
301e95b708 impr: Move plugin unload logging to plugins 2024-01-09 10:53:50 +01:00
WerWolv
874bac7de2 impr: Include thread name in log 2024-01-09 10:39:06 +01:00
WerWolv
4668f429fb fix: RGBA8 node not setting outputs correctly, added buffer output 2024-01-09 09:49:07 +01:00
WerWolv
d43f25ec70 impr: Remove spaces from fill command input 2024-01-09 01:26:47 +01:00
WerWolv
bdee628360 fix: Views not being openable 2024-01-09 00:24:17 +01:00
WerWolv
a35530f63b fix: Menu bar being hidden by default in the web version 2024-01-08 23:41:28 +01:00
WerWolv
21d6c1326c fix: Invalid address bound check for jump-to option
Fixes #1487
2024-01-08 22:34:42 +01:00
WerWolv
bfafc692db impr: Added icons to all menu items 2024-01-08 21:51:48 +01:00
WerWolv
3a068b9719 impr: Use ImGui's built-in drag n drop support for bookmarks 2024-01-08 10:56:53 +01:00
WerWolv
9530100455 fix: Texture interpreting raw data as structured images 2024-01-08 09:39:01 +01:00
WerWolv
cab329556c impr: Make sure plugins are only loaded once 2024-01-07 18:45:17 +01:00
WerWolv
1c5d6cbe94 impr: Added error reporting for plugin unloading 2024-01-07 16:07:53 +01:00
WerWolv
576bc80716 impr: Use full windows to draw tutorial popups 2024-01-06 22:54:18 +01:00
Anton Samokhvalov
8042aa39bf fix: ODR issues in plugin bundle generation (#1486)
fix possible ODR - multiple classes with same name in different .cpp
files
2024-01-06 22:13:35 +01:00
WerWolv
409b3ccd6c fix: Popups not appearing at launch sometimes and crashes when exiting 2024-01-06 17:38:55 +01:00
WerWolv
c89d19cd27 impr: Make file provider use atomic file IO instead of memory mappings 2024-01-06 16:09:28 +01:00
WerWolv
f9ab16049b fix: Make sure plugins are unloaded in opposite load order 2024-01-06 16:09:05 +01:00
WerWolv
09300c209f build: Updated libfmt 2024-01-06 09:36:53 +01:00
Nik
d199e0fa0f git: Updated plugin template link 2024-01-05 22:19:05 +01:00
WerWolv
89cab26888 build: Use Arch Docker file to its own folder 2024-01-05 21:37:24 +01:00
WerWolv
31b900a71c git: Make a imhex-download-sdk release when a new ImHex version is released 2024-01-05 21:35:02 +01:00
WerWolv
76a58cd843 fix: Updater not renaming file correctly 2024-01-05 18:12:46 +01:00
WerWolv
dbdc900e94 build: Don't update pacman packages on msys2 2024-01-05 14:52:07 +01:00
WerWolv
e3ec4ebd21 build: Make msys2 deps install script use pacboy 2024-01-05 14:47:30 +01:00
WerWolv
2ab529a3f5 build: Make macos ARM build only require macOS 12.1 as well 2024-01-05 13:52:53 +01:00
Nik
a82fdcca4b build: Remove manual macOS code signing again 2024-01-05 12:39:19 +01:00
Nik
0627b36bf6 git: Fixed rest of the screenshots in the readme 2024-01-04 22:39:28 +01:00
Nik
e8a5b5ab9c git: Fixed screenshots in readme 2024-01-04 22:37:31 +01:00
WerWolv
a1edb1b896 build: Bumped version to 1.32.2 2024-01-04 22:08:00 +01:00
WerWolv
b27e63586e build: Bundle nodes folder with executable 2024-01-04 22:07:49 +01:00
WerWolv
d2bd5b5640 impr: Make antialiasing be enabled by default for custom fonts 2024-01-04 21:33:45 +01:00
WerWolv
f91505ff09 fix: Unnecessary reinterpret_cast 2024-01-04 21:33:30 +01:00
WerWolv
464495987a fix: Crash due to task manager not being fully reset 2024-01-04 21:33:17 +01:00
WerWolv
27aef75e54 build: Added a plugin template to the SDK 2024-01-04 20:25:51 +01:00
WerWolv
70e3b4dd1a build: Cleanup build script a bit 2024-01-04 17:55:53 +01:00
WerWolv
556fd2bbc3 build: Really only build the things that are necessary 2024-01-04 13:18:27 +01:00
WerWolv
0097d1782e build: Fix external plugins not having a imhex version set 2024-01-04 12:01:40 +01:00
WerWolv
f03bdc5f45 build: Exclude libraries from main build target in sdk 2024-01-04 11:34:56 +01:00
WerWolv
ebf379f7c1 build: Fix some sdk variables not being set correctly 2024-01-04 10:39:07 +01:00
WerWolv
cd72ff1f84 build: Fix installing external plugins 2024-01-04 10:25:29 +01:00
WerWolv
eca41cac16 build: Fix more link and define issues 2024-01-04 01:06:38 +01:00
WerWolv
a8e2e132d1 build: Fix library linking and define setting issues 2024-01-04 01:01:51 +01:00
WerWolv
499711b9af build: Updated libfmt 2024-01-04 00:40:40 +01:00
WerWolv
b0eec3a844 build: Added dmg background resource 2024-01-04 00:38:40 +01:00
WerWolv
24e90f0f20 feat: Added simple HTTP request tool 2024-01-04 00:38:21 +01:00
WerWolv
ff48d37598 build: Make SDK not try to link to unbundled libraries 2024-01-04 00:37:56 +01:00
WerWolv
c402d58685 fix: Force scaling of default font to be a integer multiple 2024-01-03 18:26:48 +01:00
WerWolv
ed8934882e impr: Make sure detached windows always have an appropriate size 2024-01-03 18:26:25 +01:00
WerWolv
62093a8dd8 fix: ImHex not always going to sleep correctly 2024-01-02 17:11:52 +01:00
WerWolv
4a5f1038e0 fix: Crash when opening a file that cannot be mapped into memory 2023-12-31 14:58:20 +01:00
WerWolv
8cb833eca9 impr: Improve Documentation AI UX 2023-12-31 13:53:44 +01:00
WerWolv
e2b7a69fc8 fix: Warnings when trying to load progress for achievements that aren't in save file 2023-12-31 13:53:28 +01:00
Nik
950eaea8af impr: Make decompression support actually useful (#1481) 2023-12-31 11:39:24 +01:00
WerWolv
b22d90f9ca impr: Handle hiding of main menu better 2023-12-31 11:39:06 +01:00
WerWolv
b76e7ff678 impr: Remove duplicate window name from macOS title bar 2023-12-30 23:52:25 +01:00
WerWolv
9c386e949d git: Add brewfile lock to gitignore 2023-12-30 19:41:09 +01:00
WerWolv
2b1688be31 build: Don't try to sign unbundled executable on macOS 2023-12-30 19:40:01 +01:00
WerWolv
3d9de1aaa6 git: Fix Ubuntu builds missing commit information 2023-12-30 19:12:04 +01:00
Nik
5a0a5ad445 build: Fix macOS M1 build entirely (#1480) 2023-12-30 19:11:33 +01:00
WerWolv
038b98eacf fix: Foreground color not applying to ASCII column
Fixes #1477
2023-12-29 22:41:12 +01:00
WerWolv
3592d17c93 impr: Allow Home/End to work in hex editor view 2023-12-29 11:30:23 +01:00
WerWolv
4cbd84671c impr: Allow num keys to be interpreted as function keys if numlock isn't set
Closes #1475
2023-12-29 11:29:31 +01:00
WerWolv
c3c9603ea1 fix: Yara rules Add button not doing anything 2023-12-29 11:12:50 +01:00
WerWolv
af63b42eaf impr: Make task progress bar show animation when no progress is set 2023-12-28 22:14:45 +01:00
WerWolv
2f7da91a73 fix: Remove unused update parameter 2023-12-28 21:51:31 +01:00
WerWolv
8fcf08132e fix: Allow store to properly update files 2023-12-28 20:59:34 +01:00
WerWolv
db72ba295a build: Don't try to bundle updater on targets that don't have an updater 2023-12-28 20:44:42 +01:00
WerWolv
2d7a6a7cb5 fix: Uncaught exception when trying to update all store items 2023-12-28 20:35:35 +01:00
WerWolv
390b5a7925 fix: Logs in log view not being filtered correctly 2023-12-28 20:34:49 +01:00
WerWolv
5ca6ed30b4 build: Fix updater not being installed correctly 2023-12-28 20:26:58 +01:00
WerWolv
9685b39969 fix: Missing reference 2023-12-28 19:25:37 +01:00
WerWolv
03dc26d2d4 build: Always extract magic file database 2023-12-28 19:24:56 +01:00
WerWolv
b64bb3bec9 fix: Crashes when opening diffing view 2023-12-28 19:21:15 +01:00
WerWolv
8d3530a4f3 build: Bumped version to 1.32.1 2023-12-28 18:33:36 +01:00
WerWolv
83b1416797 build: Fixed dependencies of plugins not being bundled correctly 2023-12-28 18:05:49 +01:00
WerWolv
5adeac6bbc fix: Make sure library plugins are always initialized 2023-12-28 14:59:23 +01:00
WerWolv
f44b44a881 build: Fix wrong dependency name for libarchive on Ubuntu
Fixes #1474
2023-12-28 14:48:36 +01:00
WerWolv
1ed978f22e impr: Remove telemetry checkboxes from settings in the web version
They are disabled there and should not be enableable
2023-12-28 13:24:31 +01:00
WerWolv
7ed06ae515 git: Fixed set -x wrongfully added to windows CI
Closes  #1473
2023-12-28 11:48:13 +01:00
865 changed files with 235323 additions and 99457 deletions

5
.github/codecov.yml vendored Normal file
View File

@@ -0,0 +1,5 @@
comment: false
ignore:
- "lib/third_party" # Third party libraries should be ignored
- "lib/external" # Our own libraries should be checked in their own repositories
- "tests" # https://about.codecov.io/blog/should-i-include-test-files-in-code-coverage-calculations/

View File

@@ -8,7 +8,7 @@ on:
jobs:
codeql:
name: 🐛 CodeQL
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
@@ -16,7 +16,7 @@ jobs:
steps:
- name: 🧰 Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
@@ -26,14 +26,14 @@ jobs:
languages: 'cpp'
- name: 📜 Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ runner.os }}-analysis-build-${{ github.run_id }}
restore-keys: ${{ runner.os }}-analysis-build
max-size: 50M
- name: 📜 Restore CMakeCache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
build/CMakeCache.txt
@@ -49,7 +49,7 @@ jobs:
set -x
mkdir -p build
cd build
CC=gcc-12 CXX=g++-12 cmake \
CC=gcc-14 CXX=g++-14 cmake \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX="$PWD/install" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
@@ -57,8 +57,9 @@ jobs:
-DCMAKE_C_FLAGS="-fuse-ld=lld" \
-DCMAKE_CXX_FLAGS="-fuse-ld=lld" \
-DIMHEX_PATTERNS_PULL_MASTER=ON \
-G Ninja \
..
make -j 4 install
ninja install
- name: 🗯️ Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

File diff suppressed because it is too large Load Diff

View File

@@ -1,77 +0,0 @@
name: Build for the web
on:
push:
branches: ["*"]
pull_request:
workflow_dispatch:
env:
BUILD_TYPE: Release
permissions:
pages: write
id-token: write
actions: write
jobs:
build:
runs-on: ubuntu-22.04
name: 🌍 WebAssembly
steps:
- name: 🧰 Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: 📁 Restore docker /cache
uses: actions/cache@v3
with:
path: cache
key: web-cmakecache-${{ hashFiles('**/CMakeLists.txt') }}
- name: 🐳 Inject /cache into docker
uses: reproducible-containers/buildkit-cache-dance@v2.1.2
with:
cache-source: cache
cache-target: /cache
- name: 🛠️ Build using docker
run: |
docker buildx build . -f dist/web/Dockerfile --progress=plain --build-arg 'JOBS=4' --output out
- name: 🔨 Fix permissions
run: |
chmod -c -R +rX "out/"
- name: ⬆️ Upload artifacts
uses: actions/upload-pages-artifact@v2
with:
path: out/
# See https://github.com/actions/cache/issues/342#issuecomment-1711054115
- name: 🗑️ Delete old cache
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete "build-web-cache" --confirm
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
name: 📃 Deploy to GitHub Pages
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/master' && github.event.repository.fork == false }}
needs: build
steps:
- name: 🌍 Deploy
id: deployment
uses: actions/deploy-pages@v2

View File

@@ -10,12 +10,12 @@ on:
jobs:
release-update-repos:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: Release Update Repos
steps:
- name: 🧰 Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ImHex
@@ -52,13 +52,23 @@ jobs:
repo: ImHex-Patterns
token: ${{ secrets.RELEASE_TOKEN }}
- name: 🎫 Create imhex-download-sdk release
uses: ncipollo/release-action@v1
env:
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
if: "${{ env.RELEASE_TOKEN != '' }}"
with:
tag: v${{ env.IMHEX_VERSION }}
repo: imhex-download-sdk
token: ${{ secrets.RELEASE_TOKEN }}
release-upload-artifacts:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: Release Upload Artifacts
steps:
- name: 🧰 Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ImHex
submodules: recursive
@@ -80,7 +90,7 @@ jobs:
run: tar --exclude-vcs -czvf Full.Sources.tar.gz ImHex
- name: ⬇️ Download artifacts from latest workflow
uses: dawidd6/action-download-artifact@v2
uses: dawidd6/action-download-artifact@v6
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build.yml
@@ -107,9 +117,11 @@ jobs:
run: |
mv "Windows Portable x86_64.zip" imhex-${{ env.IMHEX_VERSION }}-Windows-Portable-x86_64.zip
mv "Windows Portable NoGPU x86_64.zip" imhex-${{ env.IMHEX_VERSION }}-Windows-Portable-NoGPU-x86_64.zip
mv "ImHex Web.zip" imhex-${{ env.IMHEX_VERSION }}-Web.zip
rm artifact.tar
- name: ⬆️ Upload everything to release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981
with:
files: '*'
@@ -137,7 +149,7 @@ jobs:
commit_email: itrooz@protonmail.com
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: Bump to version ${{ env.IMHEX_VERSION }}
ssh_keyscan_types: rsa,dsa,ecdsa,ed25519
ssh_keyscan_types: rsa,ecdsa,ed25519
release-update-winget:
name: Release update winget package
@@ -154,7 +166,6 @@ jobs:
WINGET_GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
if: "${{ env.WINGET_GITHUB_TOKEN != '' }}"
run: |
set -x
$tagname = $env:GITHUB_REF.Replace("refs/tags/", "")
$version = $tagname.Replace("v", "")
$url = "https://github.com/WerWolv/ImHex/releases/download/${tagname}/imhex-${version}-Windows-x86_64.msi"

30
.github/workflows/stale_issues.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * 0"
workflow_dispatch:
jobs:
close-issues:
runs-on: ubuntu-24.04
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v5
with:
operations-per-run: '200'
ascending: true
days-before-issue-stale: 334
days-before-issue-close: 30
stale-issue-label: "stale"
stale-issue-message: |
This issue is marked stale as it has been open for 11 months without activity.
Please try the latest ImHex version. (Avaiable here: https://imhex.download/ for release and https://imhex.download/#nightly for development version)
If the issue persists on the latest version, please make a comment on this issue again
Without response, this issue will be closed in one month.
close-issue-message: ""
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -2,15 +2,21 @@ name: "Unit Tests"
on:
push:
branches: [ master ]
branches:
- 'master'
- 'releases/**'
- 'tests/**'
- 'feature/**'
pull_request:
branches: [ master ]
branches:
- 'master'
- 'releases/**'
workflow_dispatch:
jobs:
tests:
name: 🧪 Unit Tests
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
@@ -18,25 +24,17 @@ jobs:
steps:
- name: 🧰 Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: 📜 Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ runner.os }}-tests-build-${{ github.run_id }}
restore-keys: ${{ runner.os }}-tests-build
max-size: 50M
- name: 📜 Restore CMakeCache
uses: actions/cache@v3
with:
path: |
build/CMakeCache.txt
key: ${{ runner.os }}-tests-build-${{ hashFiles('**/CMakeLists.txt') }}
- name: ⬇️ Install dependencies
run: |
sudo apt update
@@ -47,17 +45,60 @@ jobs:
set -x
mkdir -p build
cd build
CC=gcc-12 CXX=g++-12 cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_FLAGS="-fuse-ld=lld -fsanitize=address,leak,undefined -fno-sanitize-recover=all" \
-DCMAKE_CXX_FLAGS="-fuse-ld=lld -fsanitize=address,leak,undefined -fno-sanitize-recover=all" \
-DIMHEX_OFFLINE_BUILD=ON \
CC=gcc-14 CXX=g++-14 cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DIMHEX_ENABLE_UNIT_TESTS=ON \
-DIMHEX_ENABLE_PLUGIN_TESTS=ON \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_FLAGS="-fuse-ld=lld -fsanitize=address,leak,undefined -fno-sanitize-recover=all --coverage" \
-DCMAKE_CXX_FLAGS="-fuse-ld=lld -fsanitize=address,leak,undefined -fno-sanitize-recover=all --coverage" \
-DIMHEX_OFFLINE_BUILD=ON \
-G Ninja \
..
make -j4 unit_tests
ninja unit_tests
ninja imhex_all
- name: 🧪 Perform plcli Integration Tests
run: |
cd lib/external/pattern_language
python tests/integration/integration.py ../../../build/imhex --pl
- name: 🧪 Perform Unit Tests
run: |
cd build
ctest --output-on-failure
# Generate report from all gcov .gcda files
#- name: 🧪 Generate coverage report
# run: |
# sudo apt install python3-pip python3-venv
# python3 -m venv venv
# . venv/bin/activate
# pip3 install gcovr
# cd build
# gcovr --gcov-executable /usr/bin/gcov-14 --exclude '.*/yara_rules/' --exclude '.*/third_party/' --exclude '.*/external/' --root .. --xml coverage_report.xml --verbose --gcov-ignore-errors all
#
#- name: Upload coverage reports to Codecov
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# if: ${{ env.CODECOV_TOKEN }}
# uses: codecov/codecov-action@v4
# with:
# fail_ci_if_error: true
# token: ${{ secrets.CODECOV_TOKEN }}
# file: build/coverage_report.xml
langs:
name: 🧪 Langs
runs-on: ubuntu-22.04
steps:
- name: 🧰 Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Check langs
run:
python3 tests/check_langs.py

11
.gitignore vendored
View File

@@ -1,12 +1,21 @@
.vscode/
.idea/
.kdev4/
cmake-build-*/
build*/
local/
venv/
.cache/
install/
out/
*.mgc
*.kdev4
imgui.ini
.DS_Store
./CMakeUserPresets.json
CMakeUserPresets.json
Brewfile.lock.json
.vs/
vcpkg.json

18
.gitmodules vendored
View File

@@ -8,7 +8,7 @@
ignore = dirty
[submodule "lib/third_party/xdgpp"]
path = lib/third_party/xdgpp
url = https://git.sr.ht/~danyspin97/xdgpp
url = https://github.com/WerWolv/xdgpp
ignore = dirty
[submodule "lib/third_party/fmt"]
path = lib/third_party/fmt
@@ -22,6 +22,14 @@
path = lib/third_party/jthread/jthread
url = https://github.com/josuttis/jthread
ignore = dirty
[submodule "lib/third_party/edlib"]
path = lib/third_party/edlib
url = https://github.com/blawrence-ont/edlib
ignore = dirty
[submodule "lib/third_party/lunasvg"]
path = lib/third_party/lunasvg
url = https://github.com/sammycage/lunasvg
ignore = dirty
[submodule "lib/external/libromfs"]
path = lib/external/libromfs
@@ -35,4 +43,10 @@
[submodule "lib/third_party/HashLibPlus"]
path = lib/third_party/HashLibPlus
url = https://github.com/WerWolv/HashLibPlus
url = https://github.com/WerWolv/HashLibPlus
[submodule "lib/external/disassembler"]
path = lib/external/disassembler
url = https://github.com/WerWolv/Disassembler
[submodule "lib/third_party/clip"]
path = lib/third_party/clip
url = https://github.com/dacap/clip

View File

@@ -1,38 +1,57 @@
cmake_minimum_required(VERSION 3.20)
# Options
option(IMHEX_PLUGINS_IN_SHARE "Put the plugins in share/imhex/plugins instead of lib[..]/imhex/plugins" OFF)
option(IMHEX_STRIP_RELEASE "Strip the release builds" ON)
option(IMHEX_OFFLINE_BUILD "Enable offline build" OFF)
option(IMHEX_IGNORE_BAD_CLONE "Disable the bad clone prevention checks" OFF)
option(IMHEX_PATTERNS_PULL_MASTER "Download latest files from master branch of the ImHex-Patterns repo" OFF)
option(IMHEX_IGNORE_BAD_COMPILER "Allow compiling with an unsupported compiler" OFF)
option(IMHEX_USE_GTK_FILE_PICKER "Use GTK file picker instead of xdg-desktop-portals" OFF)
option(IMHEX_DISABLE_STACKTRACE "Disables support for printing stack traces" OFF)
option(IMHEX_BUNDLE_DOTNET "Bundle .NET runtime" ON)
option(IMHEX_ENABLE_LTO "Enables Link Time Optimizations if possible" OFF)
option(IMHEX_USE_DEFAULT_BUILD_SETTINGS "Use default build settings" OFF)
option(IMHEX_STRICT_WARNINGS "Enable most available warnings and treat them as errors" ON)
option(IMHEX_STATIC_LINK_PLUGINS "Statically link all plugins into the main executable" OFF)
option(IMHEX_GENERATE_PACKAGE "Specify if a native package should be built. Only usable on Windows and MacOS" OFF)
option(IMHEX_ENABLE_UNITY_BUILD "Enables building ImHex as a unity build." OFF)
option(IMHEX_PLUGINS_IN_SHARE "Put the plugins in share/imhex/plugins instead of lib[..]/imhex/plugins (Linux only)" OFF)
option(IMHEX_STRIP_RELEASE "Strip the release builds" ON )
option(IMHEX_OFFLINE_BUILD "Enable offline build" OFF)
option(IMHEX_IGNORE_BAD_CLONE "Disable the bad clone prevention checks" OFF)
option(IMHEX_PATTERNS_PULL_MASTER "Download latest files from master branch of the ImHex-Patterns repo" OFF)
option(IMHEX_IGNORE_BAD_COMPILER "Allow compiling with an unsupported compiler" OFF)
option(IMHEX_USE_GTK_FILE_PICKER "Use GTK file picker instead of xdg-desktop-portals (Linux only)" OFF)
option(IMHEX_DISABLE_STACKTRACE "Disables support for printing stack traces" OFF)
option(IMHEX_BUNDLE_DOTNET "Bundle .NET runtime" ON )
option(IMHEX_ENABLE_LTO "Enables Link Time Optimizations if possible" OFF)
option(IMHEX_USE_DEFAULT_BUILD_SETTINGS "Use default build settings" OFF)
option(IMHEX_STRICT_WARNINGS "Enable most available warnings and treat them as errors" ON )
option(IMHEX_STATIC_LINK_PLUGINS "Statically link all plugins into the main executable" OFF)
option(IMHEX_GENERATE_PACKAGE "Specify if a native package should be built. (Windows and MacOS only)" OFF)
option(IMHEX_ENABLE_UNITY_BUILD "Enables building ImHex as a unity build." OFF)
option(IMHEX_GENERATE_PDBS "Enable generating PDB files in non-debug builds (Windows only)" OFF)
option(IMHEX_REPLACE_DWARF_WITH_PDB "Remove DWARF information from binaries when generating PDBS (Windows only)" OFF)
option(IMHEX_ENABLE_STD_ASSERTS "Enable debug asserts in the C++ std library. (Breaks Plugin ABI!)" OFF)
option(IMHEX_ENABLE_UNIT_TESTS "Enable building unit tests" OFF)
option(IMHEX_ENABLE_PRECOMPILED_HEADERS "Enable precompiled headers" OFF)
option(IMHEX_COMPRESS_DEBUG_INFO "Compress debug information" ON )
option(IMHEX_ENABLE_CXX_MODULES "Enable C++20 Module compilation. Testing only!" OFF)
set(IMHEX_BASE_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}")
set(CMAKE_MODULE_PATH "${IMHEX_BASE_FOLDER}/cmake/modules")
# Optional IDE support
include("${IMHEX_BASE_FOLDER}/cmake/ide_helpers.cmake")
# Basic compiler and cmake configurations
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_SCAN_FOR_MODULES ${IMHEX_ENABLE_CXX_MODULES})
set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON)
set(IMHEX_BASE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_MODULE_PATH "${IMHEX_BASE_FOLDER}/cmake/modules")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include("${IMHEX_BASE_FOLDER}/cmake/build_helpers.cmake")
# Setup project
loadVersion(IMHEX_VERSION)
loadVersion(IMHEX_VERSION IMHEX_VERSION_PLAIN)
setVariableInParent(IMHEX_VERSION ${IMHEX_VERSION})
configureCMake()
project(imhex
LANGUAGES C CXX VERSION ${IMHEX_VERSION}
DESCRIPTION "The ImHex Hex Editor"
HOMEPAGE_URL "https://imhex.werwolv.net"
LANGUAGES C CXX
VERSION ${IMHEX_VERSION_PLAIN}
DESCRIPTION "The ImHex Hex Editor"
HOMEPAGE_URL "https://imhex.werwolv.net"
)
configureProject()
# Add ImHex sources
add_custom_target(imhex_all ALL)
# Make sure project is configured correctly
setDefaultBuiltTypeIfUnset()
@@ -43,23 +62,32 @@ detectBundledPlugins()
# Add various defines
detectOS()
detectArch()
addDefines()
# Configure packaging and install targets
configurePackingResources()
setUninstallTarget()
addBundledLibraries()
# Add ImHex sources
add_custom_target(imhex_all ALL)
add_subdirectory(lib/libimhex)
add_subdirectory(main)
addPluginDirectories()
add_subdirectory(lib/trace)
# Add unit tests
enable_testing()
add_subdirectory(tests EXCLUDE_FROM_ALL)
if (IMHEX_ENABLE_UNIT_TESTS)
if (NOT TARGET unit_tests)
enable_testing()
add_custom_target(unit_tests)
add_subdirectory(tests EXCLUDE_FROM_ALL)
endif ()
endif ()
# Configure packaging
# Configure more resources that will be added to the install package
generateSDKDirectory()
# Handle package generation
createPackage()
generatePDBs()
generateSDKDirectory()
# Accommodate IDEs with FOLDER support
tweakTargetsForIDESupport()

View File

@@ -28,6 +28,32 @@
"displayName": "x86_64 Build",
"description": "x86_64 build",
"inherits": [ "base" ]
},
{
"name": "xcode",
"inherits": [ "base" ],
"displayName": "Xcode",
"description": "Xcode with external compiler override",
"generator": "Xcode",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_CXX_FLAGS": "-fexperimental-library -Wno-shorten-64-to-32 -Wno-deprecated-declarations",
"IMHEX_IDE_HELPERS_OVERRIDE_XCODE_COMPILER": "ON"
}
},
{
"name": "vs2022",
"displayName": "Visual Studio 2022",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
}
],
"buildPresets": [

View File

@@ -27,6 +27,11 @@ chmod +x imhex-*.AppImage
./imhex-*.AppImage
```
If you're experiencing glib / libgtk assertion failures, you might need to setup your `XDG_DATA_DIRS` env var correctly. In this case, run the following command before executing the AppImage. (See issue [ImHex/#2038](https://github.com/WerWolv/ImHex/issues/2038))
```bash
export XDG_DATA_DIRS="/usr/local/share:/usr/share"
```
#### Flatpak
To install the Flatpak, make sure you have the Flathub repository added to your system. Then simply run the following command:

128
README.md
View File

@@ -1,42 +1,30 @@
<a href="https://imhex.werwolv.net">
<h1 align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="./resources/projects/logo_text_light.svg">
<img height="100px" src="./resources/projects/logo_text_dark.svg">
<img height="300px" style="margin: 0; padding: 0" src="./resources/dist/common/logo/ImHexLogoSVGBG.svg">
</picture>
</h1>
</a>
<p align="center">A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.</p>
<p align="center">
<a title="'Build' workflow Status" href="https://github.com/WerWolv/ImHex/actions?query=workflow%3ABuild">
<img alt="'Build' workflow Status" src="https://img.shields.io/github/actions/workflow/status/WerWolv/ImHex/build.yml?longCache=true&style=for-the-badge&label=Build&logoColor=fff&logo=GitHub%20Actions&branch=master">
</a>
<a title="Discord Server" href="https://discord.gg/X63jZ36xBY">
<img alt="Discord Server" src="https://img.shields.io/discord/789833418631675954?label=Discord&logo=Discord&logoColor=fff&style=for-the-badge">
</a>
<a title="Total Downloads" href="https://github.com/WerWolv/ImHex/releases/latest">
<img alt="Total Downloads" src="https://img.shields.io/github/downloads/WerWolv/ImHex/total?longCache=true&style=for-the-badge&label=Downloads&logoColor=fff&logo=GitHub">
</a>
<a title="Code Quality" href="https://www.codefactor.io/repository/github/werwolv/imhex">
<img alt="Code Quality" src="https://img.shields.io/codefactor/grade/github/WerWolv/ImHex?longCache=true&style=for-the-badge&label=Code%20Quality&logoColor=fff&logo=CodeFactor&branch=master">
</a>
<a title="Translation" href="https://weblate.werwolv.net/projects/imhex/">
<img alt="Translation" src="https://img.shields.io/weblate/progress/imhex?logo=weblate&logoColor=%23FFFFFF&server=https%3A%2F%2Fweblate.werwolv.net&style=for-the-badge">
</a>
<a title="Documentation" href="https://imhex.werwolv.net/docs">
<img alt="Documentation" src="https://img.shields.io/badge/Docs-Available-brightgreen?logo=gitbook&logoColor=%23FFFFFF&style=for-the-badge">
</a>
<a title="Plugins" href="https://github.com/WerWolv/ImHex/blob/master/PLUGINS.md">
<img alt="Plugins" src="https://img.shields.io/badge/Plugins-Supported-brightgreen?logo=stackedit&logoColor=%23FFFFFF&style=for-the-badge">
</a>
A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
<br>
<a href="https://itinerarium.github.io/phoneme-synthesis/?w=/'ˈɪmhɛks/"><strong>/ˈɪmhɛks/</strong></a>
</p>
<p align="center">
<a title="'Build' workflow Status" href="https://github.com/WerWolv/ImHex/actions?query=workflow%3ABuild"><img alt="'Build' workflow Status" src="https://img.shields.io/github/actions/workflow/status/WerWolv/ImHex/build.yml?longCache=true&style=for-the-badge&label=Build&logoColor=fff&logo=GitHub%20Actions&branch=master"></a>
<a title="Discord Server" href="https://discord.gg/X63jZ36xBY"><img alt="Discord Server" src="https://img.shields.io/discord/789833418631675954?label=Discord&logo=Discord&logoColor=fff&style=for-the-badge"></a>
<a title="Total Downloads" href="https://github.com/WerWolv/ImHex/releases/latest"><img alt="Total Downloads" src="https://img.shields.io/github/downloads/WerWolv/ImHex/total?longCache=true&style=for-the-badge&label=Downloads&logoColor=fff&logo=GitHub"></a>
<a title="Code Quality" href="https://www.codefactor.io/repository/github/werwolv/imhex"><img alt="Code Quality" src="https://img.shields.io/codefactor/grade/github/WerWolv/ImHex?longCache=true&style=for-the-badge&label=Code%20Quality&logoColor=fff&logo=CodeFactor&branch=master"></a>
<a title="Translation" href="https://weblate.werwolv.net/projects/imhex/"><img alt="Translation" src="https://img.shields.io/weblate/progress/imhex?logo=weblate&logoColor=%23FFFFFF&server=https%3A%2F%2Fweblate.werwolv.net&style=for-the-badge"></a>
<a title="Plugins" href="https://github.com/WerWolv/ImHex/blob/master/PLUGINS.md"><img alt="Plugins" src="https://img.shields.io/badge/Plugins-Supported-brightgreen?logo=stackedit&logoColor=%23FFFFFF&style=for-the-badge"></a>
</p>
<p align="center">
<a title="Use the Web version of ImHex right in your browser!" href="https://web.imhex.werwolv.net">
<img alt="Use the Web version of ImHex right in your browser!" src="resources/dist/common/try_online_banner.png">
</a>
<a title="Download the latest version of ImHex" href="https://imhex.download"><img alt="Download the latest version of ImHex!" src="resources/dist/common/get_release_banner.png"></a>
<a title="Download the latest nightly pre-release version of ImHex" href="https://imhex.download/#nightly"><img alt="Download the latest nightly pre-release version of ImHex" src="resources/dist/common/get_nightly_banner.png"></a>
<a title="Use the Web version of ImHex right in your browser!" href="https://web.imhex.werwolv.net"><img alt="Use the Web version of ImHex right in your browser!" src="resources/dist/common/try_online_banner.png"></a>
<a title="Read the documentation of ImHex!" href="https://docs.werwolv.net"><img alt="Read the documentation of ImHex!" src="resources/dist/common/read_docs_banner.png"></a>
</p>
## Supporting
@@ -44,22 +32,21 @@
If you like my work, please consider supporting me on GitHub Sponsors, Patreon or PayPal. Thanks a lot!
<p align="center">
<a href="https://github.com/sponsors/WerWolv"><img src="https://werwolv.net/assets/github_banner.png" alt="GitHub donate button" /> </a>
<a href="https://www.patreon.com/werwolv"><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Patreon donate button" /> </a>
<a href="https://werwolv.net/donate"><img src="https://werwolv.net/assets/paypal_banner.png" alt="PayPal donate button" /> </a>
<a href="https://github.com/sponsors/WerWolv"><img src="https://werwolv.net/assets/github_banner.png" alt="GitHub donate button" /></a>
<a href="https://www.patreon.com/werwolv"><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Patreon donate button" /></a>
<a href="https://werwolv.net/donate"><img src="https://werwolv.net/assets/paypal_banner.png" alt="PayPal donate button" /></a>
</p>
## Screenshots
![Hex editor, patterns and data information](https://private-user-images.githubusercontent.com/10835354/290512928-ae20c3ce-4c02-4579-9471-640f43fd6bad.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTEiLCJleHAiOjE3MDMyNDk0NTksIm5iZiI6MTcwMzI0OTE1OSwicGF0aCI6Ii8xMDgzNTM1NC8yOTA1MTI5MjgtYWUyMGMzY2UtNGMwMi00NTc5LTk0NzEtNjQwZjQzZmQ2YmFkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFJV05KWUFYNENTVkVINTNBJTJGMjAyMzEyMjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjMxMjIyVDEyNDU1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFmN2RhYmNlYWVjYzI0YWQxNjE0YjI1NDNjMTQ2MGFlODhkMmYzMTVkY2Y3MzNlYzUzYTM3N2IwNWE4OGY2YTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.RbVnFXxuJS0xUoWbdgqCHtd-BopaFCyDypAfgkzGezU)
![Bookmarks, disassembler and data processor](https://user-images.githubusercontent.com/10835354/139717323-1f8c9d52-f7eb-4f43-9f11-097ac728ed6c.png)
![Hex editor, patterns and data information](https://github.com/user-attachments/assets/902a7c4c-410d-490f-999e-14c856fec027)
![Bookmarks, data information, find view and data processor](https://github.com/user-attachments/assets/58eefa1f-31c9-4bb8-a1c1-8cdd8ddbd29f)
<details>
<summary><strong>More Screenshots</strong></summary>
![Data Processor decrypting some data and displaying it as an image](https://private-user-images.githubusercontent.com/10835354/290514353-d7f53f91-09e9-46c4-a720-e979c1c4e820.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTEiLCJleHAiOjE3MDMyNDk0NTksIm5iZiI6MTcwMzI0OTE1OSwicGF0aCI6Ii8xMDgzNTM1NC8yOTA1MTQzNTMtZDdmNTNmOTEtMDllOS00NmM0LWE3MjAtZTk3OWMxYzRlODIwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFJV05KWUFYNENTVkVINTNBJTJGMjAyMzEyMjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjMxMjIyVDEyNDU1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE4OGIxNjg0NDcyMWVkYTMzOTAzMTAxMmJlNjE2ZjVkMTVmNzhlMDU1ZWNhODQyZjNjYTgzMzgzYjYyODVlNzQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Y4VAVgSPBZI3Q1gDehPuoC98pQXVe-z9FUWhvDAV-1g)
![STL Parser written in the Pattern Language visualizing a 3D model](https://private-user-images.githubusercontent.com/10835354/290517253-426d83c5-f6b7-4b69-aa87-05e48ab73e24.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTEiLCJleHAiOjE3MDMyNDk0NTksIm5iZiI6MTcwMzI0OTE1OSwicGF0aCI6Ii8xMDgzNTM1NC8yOTA1MTcyNTMtNDI2ZDgzYzUtZjZiNy00YjY5LWFhODctMDVlNDhhYjczZTI0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFJV05KWUFYNENTVkVINTNBJTJGMjAyMzEyMjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjMxMjIyVDEyNDU1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJlMmJmZDYzOTgyZGYxOWQ5MmJhMTMyMzA2YWE3YmU0ODJlY2MwYmQxM2RlODc1MTgwYTQ5ZGYxMWNkY2JlNjAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.lsJSbAnAWZNXm_bteUWZUM96Nd4qKhk3H3WZtjsFQB4)
![Data Information view displaying various stats about the file](https://private-user-images.githubusercontent.com/10835354/290517882-1601cd05-e50b-41f7-8272-cb9af9e6fb81.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTEiLCJleHAiOjE3MDMyNDk0NTksIm5iZiI6MTcwMzI0OTE1OSwicGF0aCI6Ii8xMDgzNTM1NC8yOTA1MTc4ODItMTYwMWNkMDUtZTUwYi00MWY3LTgyNzItY2I5YWY5ZTZmYjgxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFJV05KWUFYNENTVkVINTNBJTJGMjAyMzEyMjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjMxMjIyVDEyNDU1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRlZjNmNDA4NThlZjFmOTdmYWVlNGIxODQ3MDdmZDkzZGM4ZDEwOWZmNWRiMmM3NjNlODFiMTQ5ZTFhZTRlOTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.AWm3GajW2KkNMT7AWhhCYca18UbXqZCS3-8RG4YN_ng)
![Data Processor decrypting some data and displaying it as an image](https://github.com/WerWolv/ImHex/assets/10835354/d0623081-3094-4840-a8a8-647b38724db8)
![STL Parser written in the Pattern Language visualizing a 3D model](https://github.com/WerWolv/ImHex/assets/10835354/62cbcd18-1c3f-4dd6-a877-2bf2bf4bb2a5)
![Data Information view displaying various stats about the file](https://github.com/WerWolv/ImHex/assets/10835354/d4706c01-c258-45c9-80b8-fe7a10d5a1de)
</details>
@@ -124,7 +111,7 @@ If you like my work, please consider supporting me on GitHub Sponsors, Patreon o
<details>
<summary><strong>Data Inspector</strong></summary>
- Interpreting data as many different types with endianess, decimal, hexadecimal and octal support and bit inversion
- Interpreting data as many different types with endianness, decimal, hexadecimal and octal support and bit inversion
- Unsigned and signed integers (8, 16, 24, 32, 48, 64 bit)
- Floats (16, 32, 64 bit)
- Signed and Unsigned LEB128
@@ -173,7 +160,7 @@ If you like my work, please consider supporting me on GitHub Sponsors, Patreon o
- Numeric Value search
- Search for signed/unsigned integers and floats
- Search for ranges of values
- Option to specify size and endianess
- Option to specify size and endianness
- Option to ignore unaligned values
</details>
<details>
@@ -327,22 +314,26 @@ To use ImHex, the following minimal system requirements need to be met.
> ImHex requires a GPU with OpenGL 3.0 support in general.
> There are releases available (with the `-NoGPU` suffix) that are software rendered and don't require a GPU, however these can be a lot slower than the GPU accelerated versions.
>
> If possible at all, make ImHex use the dedicated GPU on your system instead of the integrated one (especially Intel HD GPUs are known to cause issues).
> If possible at all, make ImHex use the dedicated GPU on your system instead of the integrated one.
> ImHex will usually run fine with integrated GPUs as well but certain Intel HD GPU drivers on Windows are known to cause graphical artifacts.
- **OS**:
- **Windows**: Windows 7 or higher (Windows 10/11 recommended)
- **macOS**: macOS 11 (Big Sur) or higher,
- **macOS**: macOS 13 (Ventura) or higher,
- Lower versions should still work too, but you'll need to compile ImHex yourself. The release binaries will NOT work.
- The macOS build is not signed and will require you to manually allow them in the Security & Privacy settings.
- **Linux**: "Modern" Linux. The following distributions have official releases available. Other distros are supported through the AppImage and Flatpak releases.
- Ubuntu 22.04/23.04
- Fedora 36/37
- RHEL/AlmaLinux 9
- Ubuntu and Debian
- Fedora
- RHEL/AlmaLinux
- Arch Linux
- **CPU**: x86_64 (64 Bit)
- Basically any other distro will work as well when compiling ImHex from sources.
- **CPU**: Officially supported are x86_64 and ARM64, though any Little Endian 64 bit CPU should work.
- **GPU**: OpenGL 3.0 or higher
- Intel HD drivers are really buggy and often cause graphic artifacts
- Integrated Intel HD iGPUs are supported, however certain drivers are known to cause various graphical artifacts, especially on Windows. Use at your own risk.
- In case you don't have a GPU available, there are software rendered releases available for Windows and macOS
- **RAM**: 256MB, more may be required for more complicated analysis
- **Storage**: 100MB
- **RAM**: ~150MiB, more is required for more complex analysis
- **Storage**: 150MiB
## Installing
@@ -351,8 +342,10 @@ Information on how to install ImHex can be found in the [Install](/INSTALL.md) g
## Compiling
To compile ImHex on any platform, GCC (or Clang) is required with a version that supports C++23 or higher.
On macOS, Clang is also required to compile some ObjC code.
All releases are being built using latest available GCC.
Windows and Linux releases are being built using latest available GCC.
MacOS releases are being built using latest available LLVM Clang.
Important to note is, the MSVC and AppleClang compilers are both **NOT** supported since they're both generally severely outdated and lack features GCC and LLVM Clang have.
> [!NOTE]
> Many dependencies are bundled into the repository using submodules so make sure to clone it using the `--recurse-submodules` option.
@@ -365,31 +358,44 @@ See [Contributing](/CONTRIBUTING.md)
## Plugin development
To develop plugins for ImHex, use one of the following two templates projects to get started. You then have access to the entirety of libimhex as well as the ImHex API and the Content Registry to interact with ImHex or to add new content.
- [C++ Plugin Template](https://github.com/WerWolv/ImHex-Cpp-Plugin-Template)
- [Rust Plugin Template](https://github.com/WerWolv/ImHex-Rust-Plugin-Template)
To develop plugins for ImHex, use the following template project to get started. You then have access to the entirety of libimhex as well as the ImHex API and the Content Registry to interact with ImHex or to add new content.
- [ImHex Plugin Template](https://github.com/WerWolv/ImHex-Plugin-Template)
## Credits
### Contributors
- [iTrooz](https://github.com/iTrooz) for getting ImHex onto the Web as well as hundreds of contributions in every part of the project
- [jumanji144](https://github.com/jumanji144) for huge contributions to the Pattern Language and ImHex's infrastructure
- [Mary](https://github.com/marysaka) for her immense help porting ImHex to MacOS and help during development
- [Roblabla](https://github.com/Roblabla) for adding MSI Installer support to ImHex
- [jam1garner](https://github.com/jam1garner) and [raytwo](https://github.com/raytwo) for their help with adding Rust support to plugins
- [Mailaender](https://github.com/Mailaender) for getting ImHex onto Flathub
- [iTrooz](https://github.com/iTrooz) for many improvements and new features to Imhex
- Everybody else who has reported issues on Discord or GitHub that I had great conversations with :)
### Dependencies
- Thanks a lot to ocornut for their amazing [Dear ImGui](https://github.com/ocornut/imgui) which is used for building the entire interface
- Thanks to ocornut as well for their hex editor view used as base for this project.
- Thanks to BalazsJako for their incredible [ImGuiColorTextEdit](https://github.com/BalazsJako/ImGuiColorTextEdit) used for the pattern language syntax highlighting
- Thanks to nlohmann for their [json](https://github.com/nlohmann/json) library used for project files
- Thanks to aquynh for [capstone](https://github.com/aquynh/capstone) which is the base of the disassembly window
- Thanks to epezent for [ImPlot](https://github.com/epezent/implot) used to plot data in various places
- Thanks to Nelarius for [ImNodes](https://github.com/Nelarius/imnodes) used as base for the data processor
- Thanks to BalazsJako for [ImGuiColorTextEdit](https://github.com/BalazsJako/ImGuiColorTextEdit) used for the pattern language syntax highlighting
- Thanks to nlohmann for their [json](https://github.com/nlohmann/json) library used for configuration files
- Thanks to vitaut for their [libfmt](https://github.com/fmtlib/fmt) library which makes formatting and logging so much better
- Thanks to btzy for [nativefiledialog-extended](https://github.com/btzy/nativefiledialog-extended) and their great support, used for handling file dialogs on all platforms
- Thanks to danyspin97 for [xdgpp](https://sr.ht/~danyspin97/xdgpp) used to handle folder paths on Linux
- Thanks to aquynh for [capstone](https://github.com/aquynh/capstone) which is the base of the disassembly window
- Thanks to rxi for [microtar](https://github.com/rxi/microtar) used for extracting downloaded store assets
- Thanks to btzy for [nativefiledialog-extended](https://github.com/btzy/nativefiledialog-extended)
- Thanks to danyspin97 for [xdgpp](https://sr.ht/~danyspin97/xdgpp)
- Thanks to VirusTotal for [Yara](https://github.com/VirusTotal/yara) used by the Yara plugin
- Thanks to Martinsos for [edlib](https://github.com/Martinsos/edlib) used for sequence searching in the diffing view
- Thanks to ron4fun for [HashLibPlus](https://github.com/ron4fun/HashLibPlus) which implements every hashing algorithm under the sun
- Thanks to mackron for [miniaudio](https://github.com/mackron/miniaudio) used to play audio files
- Thanks to all other groups and organizations whose libraries are used in ImHex
### License
The biggest part of ImHex is under the GPLv2-only license.
Notable exceptions to this are the following parts which are under the LGPLv2.1 license:
- **/lib/libimhex**: The library that allows Plugins to interact with ImHex.
- **/plugins/ui**: The UI plugin library that contains some common UI elements that can be used by other plugins
The reason for this is to allow for proprietary plugins to be developed for ImHex.

View File

@@ -1 +1 @@
1.32.0
1.38.0.WIP

View File

@@ -1,3 +1,73 @@
# Some libraries we use set the BUILD_SHARED_LIBS variable to ON, which causes CMake to
# display a warning about options being set using set() instead of option().
# Explicitly set the policy to NEW to suppress the warning.
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0063 NEW)
if (POLICY CMP0177)
set(CMAKE_POLICY_DEFAULT_CMP0177 OLD)
cmake_policy(SET CMP0177 OLD)
endif()
function(getTarget target type)
get_target_property(IMPORTED_TARGET ${target} IMPORTED)
if (IMPORTED_TARGET)
set(${type} INTERFACE PARENT_SCOPE)
else()
set(${type} PRIVATE PARENT_SCOPE)
endif()
endfunction()
function(addCFlag)
if (ARGC EQUAL 1)
add_compile_options($<$<COMPILE_LANGUAGE:C>:${ARGV0}>)
elseif (ARGC EQUAL 2)
getTarget(${ARGV1} TYPE)
target_compile_options(${ARGV1} ${TYPE} $<$<COMPILE_LANGUAGE:C>:${ARGV0}>)
endif()
endfunction()
function(addCXXFlag)
if (ARGC EQUAL 1)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:${ARGV0}>)
elseif (ARGC EQUAL 2)
getTarget(${ARGV1} TYPE)
target_compile_options(${ARGV1} ${TYPE} $<$<COMPILE_LANGUAGE:CXX>:${ARGV0}>)
endif()
endfunction()
function(addObjCFlag)
if (ARGC EQUAL 1)
add_compile_options($<$<COMPILE_LANGUAGE:OBJC>:${ARGV0}>)
elseif (ARGC EQUAL 2)
getTarget(${ARGV1} TYPE)
target_compile_options(${ARGV1} ${TYPE} $<$<COMPILE_LANGUAGE:OBJC>:${ARGV0}>)
endif()
endfunction()
function(addLinkerFlag)
if (ARGC EQUAL 1)
add_link_options(${ARGV0})
elseif (ARGC EQUAL 2)
getTarget(${ARGV1} TYPE)
target_link_options(${ARGV1} ${TYPE} ${ARGV0})
endif()
endfunction()
function(addCCXXFlag)
addCFlag(${ARGV0} ${ARGV1})
addCXXFlag(${ARGV0} ${ARGV1})
endfunction()
function(addCommonFlag)
addCFlag(${ARGV0} ${ARGV1})
addCXXFlag(${ARGV0} ${ARGV1})
addObjCFlag(${ARGV0} ${ARGV1})
endfunction()
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "Disable deprecated warnings" FORCE)
include(FetchContent)
if(IMHEX_STRIP_RELEASE)
@@ -22,7 +92,7 @@ macro(addDefines)
add_compile_definitions(NDEBUG)
elseif (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(IMHEX_VERSION_STRING ${IMHEX_VERSION_STRING}-Debug)
add_compile_definitions(DEBUG _GLIBCXX_DEBUG _GLIBCXX_VERBOSE)
add_compile_definitions(DEBUG)
elseif (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set(IMHEX_VERSION_STRING ${IMHEX_VERSION_STRING})
add_compile_definitions(NDEBUG)
@@ -31,6 +101,10 @@ macro(addDefines)
add_compile_definitions(NDEBUG)
endif ()
if (IMHEX_ENABLE_STD_ASSERTS)
add_compile_definitions(_GLIBCXX_DEBUG _GLIBCXX_VERBOSE)
endif()
if (IMHEX_STATIC_LINK_PLUGINS)
add_compile_definitions(IMHEX_STATIC_LINK_PLUGINS)
endif ()
@@ -42,6 +116,9 @@ function(addDefineToSource SOURCE DEFINE)
APPEND
PROPERTY COMPILE_DEFINITIONS "${DEFINE}"
)
# Disable precompiled headers for this file
set_source_files_properties(${SOURCE} PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
endfunction()
# Detect current OS / System
@@ -51,6 +128,10 @@ macro(detectOS)
set(CMAKE_INSTALL_BINDIR ".")
set(CMAKE_INSTALL_LIBDIR ".")
set(PLUGINS_INSTALL_LOCATION "plugins")
add_compile_definitions(WIN32_LEAN_AND_MEAN)
add_compile_definitions(NOMINMAX)
add_compile_definitions(UNICODE)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
elseif (APPLE)
add_compile_definitions(OS_MACOS)
set(CMAKE_INSTALL_BINDIR ".")
@@ -62,14 +143,19 @@ macro(detectOS)
add_compile_definitions(OS_WEB)
elseif (UNIX AND NOT APPLE)
add_compile_definitions(OS_LINUX)
if (BSD AND BSD STREQUAL "FreeBSD")
add_compile_definitions(OS_FREEBSD)
endif()
include(GNUInstallDirs)
if(IMHEX_PLUGINS_IN_SHARE)
set(PLUGINS_INSTALL_LOCATION "share/imhex/plugins")
else()
set(PLUGINS_INSTALL_LOCATION "${CMAKE_INSTALL_LIBDIR}/imhex/plugins")
# Warning : Do not work with portable versions such as appimage (because the path is hardcoded)
add_compile_definitions(SYSTEM_PLUGINS_LOCATION="${CMAKE_INSTALL_FULL_LIBDIR}/imhex") # "plugins" will be appended from the app
# Add System plugin location for plugins to be loaded from
# IMPORTANT: This does not work for Sandboxed or portable builds such as the Flatpak or AppImage release
add_compile_definitions(SYSTEM_PLUGINS_LOCATION="${CMAKE_INSTALL_FULL_LIBDIR}/imhex")
endif()
else ()
@@ -78,17 +164,9 @@ macro(detectOS)
endmacro()
# Detect 32 vs. 64 bit system
macro(detectArch)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_compile_definitions(ARCH_64_BIT)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
add_compile_definitions(ARCH_32_BIT)
endif()
endmacro()
macro(configurePackingResources)
set(LIBRARY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
if (WIN32)
if (NOT (CMAKE_BUILD_TYPE STREQUAL "Debug"))
set(APPLICATION_TYPE WIN32)
@@ -104,15 +182,16 @@ macro(configurePackingResources)
set(CPACK_WIX_PRODUCT_ICON "${PROJECT_SOURCE_DIR}/resources/dist/windows/icon.ico")
set(CPACK_WIX_UI_BANNER "${PROJECT_SOURCE_DIR}/resources/dist/windows/wix_banner.png")
set(CPACK_WIX_UI_DIALOG "${PROJECT_SOURCE_DIR}/resources/dist/windows/wix_dialog.png")
set(CPACK_WIX_CULTURES "en-US;de-DE;ja-JP;it-IT;pt-BR;zh-CN;zh-TW")
set(CPACK_WIX_CULTURES "en-US;de-DE;ja-JP;it-IT;pt-BR;zh-CN;zh-TW;ru-RU")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "ImHex")
set_property(INSTALL "$<TARGET_FILE_NAME:main>"
PROPERTY CPACK_START_MENU_SHORTCUTS "ImHex"
)
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/resources/dist/windows/LICENSE.rtf")
endif()
elseif (APPLE)
set (IMHEX_ICON "${IMHEX_BASE_FOLDER}/resources/dist/macos/AppIcon.icns")
elseif (APPLE OR ${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
set(IMHEX_ICON "${IMHEX_BASE_FOLDER}/resources/dist/macos/AppIcon.icns")
set(BUNDLE_NAME "imhex.app")
if (IMHEX_GENERATE_PACKAGE)
set(APPLICATION_TYPE MACOSX_BUNDLE)
@@ -123,15 +202,16 @@ macro(configurePackingResources)
set(MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/resources/dist/macos/Info.plist.in")
set(MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "net.WerWolv.ImHex")
set(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}-${IMHEX_COMMIT_HASH_SHORT}")
string(SUBSTRING "${IMHEX_COMMIT_HASH_LONG}" 0 7 COMMIT_HASH_SHORT)
set(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}-${COMMIT_HASH_SHORT}")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
string(TIMESTAMP CURR_YEAR "%Y")
set(MACOSX_BUNDLE_COPYRIGHT "Copyright © 2020 - ${CURR_YEAR} WerWolv. All rights reserved." )
if ("${CMAKE_GENERATOR}" STREQUAL "Xcode")
set (IMHEX_BUNDLE_PATH "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/imhex.app")
set (IMHEX_BUNDLE_PATH "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${BUNDLE_NAME}")
else ()
set (IMHEX_BUNDLE_PATH "${CMAKE_BINARY_DIR}/imhex.app")
set (IMHEX_BUNDLE_PATH "${CMAKE_BINARY_DIR}/${BUNDLE_NAME}")
endif()
set(PLUGINS_INSTALL_LOCATION "${IMHEX_BUNDLE_PATH}/Contents/MacOS/plugins")
@@ -140,21 +220,17 @@ macro(configurePackingResources)
endif()
endmacro()
macro(createPackage)
set(LIBRARY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
macro(addPluginDirectories)
file(MAKE_DIRECTORY "plugins")
foreach (plugin IN LISTS PLUGINS)
add_subdirectory("plugins/${plugin}")
if (TARGET ${plugin})
set_target_properties(${plugin} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins)
set_target_properties(${plugin} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins)
set_target_properties(${plugin} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${IMHEX_MAIN_OUTPUT_DIRECTORY}/plugins")
set_target_properties(${plugin} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${IMHEX_MAIN_OUTPUT_DIRECTORY}/plugins")
if (APPLE)
if (IMHEX_GENERATE_PACKAGE)
set_target_properties(${plugin} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGINS_INSTALL_LOCATION})
else ()
set_target_properties(${plugin} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins)
endif ()
else ()
if (WIN32)
@@ -173,19 +249,24 @@ macro(createPackage)
add_dependencies(imhex_all ${plugin})
endif ()
endforeach()
endmacro()
set_target_properties(libimhex PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
macro(createPackage)
if (WIN32)
# Install binaries directly in the prefix, usually C:\Program Files\ImHex.
set(CMAKE_INSTALL_BINDIR ".")
set(PLUGIN_TARGET_FILES "")
foreach (plugin IN LISTS PLUGINS)
list(APPEND PLUGIN_TARGET_FILES "$<TARGET_FILE:${plugin}>")
endforeach ()
# Grab all dynamically linked dependencies.
INSTALL(CODE "set(CMAKE_INSTALL_BINDIR \"${CMAKE_INSTALL_BINDIR}\")")
INSTALL(CODE "LIST(APPEND DEP_FOLDERS \${PY_PARENT})")
install(CODE "set(CMAKE_INSTALL_BINDIR \"${CMAKE_INSTALL_BINDIR}\")")
install(CODE "set(PLUGIN_TARGET_FILES \"${PLUGIN_TARGET_FILES}\")")
install(CODE [[
file(GET_RUNTIME_DEPENDENCIES
EXECUTABLES $<TARGET_FILE:builtin> $<TARGET_FILE:libimhex> $<TARGET_FILE:main>
EXECUTABLES ${PLUGIN_TARGET_FILES} $<TARGET_FILE:libimhex> $<TARGET_FILE:main>
RESOLVED_DEPENDENCIES_VAR _r_deps
UNRESOLVED_DEPENDENCIES_VAR _u_deps
CONFLICTING_DEPENDENCIES_PREFIX _c_deps
@@ -207,7 +288,6 @@ macro(createPackage)
endforeach()
]])
install(FILES "$<TARGET_FILE:libimhex>" DESTINATION "${CMAKE_INSTALL_LIBDIR}" PERMISSIONS ${LIBRARY_PERMISSIONS})
downloadImHexPatternsFiles("./")
elseif(UNIX AND NOT APPLE)
@@ -217,8 +297,8 @@ macro(createPackage)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}/share/licenses/imhex)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dist/imhex.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/icon.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps RENAME imhex.png)
install(FILES "$<TARGET_FILE:libimhex>" DESTINATION "${CMAKE_INSTALL_LIBDIR}" PERMISSIONS ${LIBRARY_PERMISSIONS})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dist/imhex.mime.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/mime/packages RENAME imhex.xml)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/icon.svg DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps RENAME imhex.svg)
downloadImHexPatternsFiles("./share/imhex")
# install AppStream file
@@ -230,43 +310,60 @@ macro(createPackage)
endif()
if (IMHEX_GENERATE_PACKAGE AND APPLE)
include(PostprocessBundle)
if (APPLE)
if (IMHEX_GENERATE_PACKAGE)
set(EXTRA_BUNDLE_LIBRARY_PATHS ${EXTRA_BUNDLE_LIBRARY_PATHS} "${IMHEX_SYSTEM_LIBRARY_PATH}")
include(PostprocessBundle)
set_target_properties(libimhex PROPERTIES SOVERSION ${IMHEX_VERSION})
set_target_properties(libimhex PROPERTIES SOVERSION ${IMHEX_VERSION})
set_property(TARGET main PROPERTY MACOSX_BUNDLE_INFO_PLIST ${MACOSX_BUNDLE_INFO_PLIST})
set_property(TARGET main PROPERTY MACOSX_BUNDLE_INFO_PLIST ${MACOSX_BUNDLE_INFO_PLIST})
# Fix rpath
add_custom_command(TARGET imhex_all POST_BUILD COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath "@executable_path/../Frameworks/" $<TARGET_FILE:main>)
# Fix rpath
install(CODE "execute_process(COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath \"@executable_path/../Frameworks/\" $<TARGET_FILE:main>)")
# FIXME: Remove this once we move/integrate the plugins directory.
add_custom_target(build-time-make-plugins-directory ALL COMMAND ${CMAKE_COMMAND} -E make_directory "${IMHEX_BUNDLE_PATH}/Contents/MacOS/plugins")
add_custom_target(build-time-make-resources-directory ALL COMMAND ${CMAKE_COMMAND} -E make_directory "${IMHEX_BUNDLE_PATH}/Contents/Resources")
add_custom_target(build-time-make-plugins-directory ALL COMMAND ${CMAKE_COMMAND} -E make_directory "${IMHEX_BUNDLE_PATH}/Contents/MacOS/plugins")
add_custom_target(build-time-make-resources-directory ALL COMMAND ${CMAKE_COMMAND} -E make_directory "${IMHEX_BUNDLE_PATH}/Contents/Resources")
downloadImHexPatternsFiles("${IMHEX_BUNDLE_PATH}/Contents/MacOS")
downloadImHexPatternsFiles("${CMAKE_INSTALL_PREFIX}/${BUNDLE_NAME}/Contents/MacOS")
install(FILES ${IMHEX_ICON} DESTINATION "${IMHEX_BUNDLE_PATH}/Contents/Resources")
install(TARGETS main BUNDLE DESTINATION ".")
install(FILES $<TARGET_FILE:main> DESTINATION "${IMHEX_BUNDLE_PATH}")
install(FILES ${IMHEX_ICON} DESTINATION "${CMAKE_INSTALL_PREFIX}/${BUNDLE_NAME}/Contents/Resources")
install(TARGETS main BUNDLE DESTINATION ".")
install(TARGETS updater BUNDLE DESTINATION ".")
# Update library references to make the bundle portable
postprocess_bundle(imhex_all main)
# Update library references to make the bundle portable
postprocess_bundle(imhex_all main)
# Enforce DragNDrop packaging.
set(CPACK_GENERATOR "DragNDrop")
# Enforce DragNDrop packaging.
set(CPACK_GENERATOR "DragNDrop")
set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/resources/dist/macos/AppIcon.icns" )
set(CPACK_BUNDLE_PLIST "${CMAKE_BINARY_DIR}/imhex.app/Contents/Info.plist")
set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/resources/dist/macos/AppIcon.icns")
set(CPACK_BUNDLE_PLIST "${CMAKE_INSTALL_PREFIX}/${BUNDLE_NAME}/Contents/Info.plist")
if (IMHEX_RESIGN_BUNDLE)
find_program(CODESIGN_PATH codesign)
if (CODESIGN_PATH)
install(CODE "message(STATUS \"Signing bundle '${CMAKE_INSTALL_PREFIX}/${BUNDLE_NAME}'...\")")
install(CODE "execute_process(COMMAND ${CODESIGN_PATH} --force --deep --entitlements ${CMAKE_SOURCE_DIR}/resources/macos/Entitlements.plist --sign - ${CMAKE_INSTALL_PREFIX}/${BUNDLE_NAME} COMMAND_ERROR_IS_FATAL ANY)")
endif()
endif()
install(CODE [[ message(STATUS "MacOS Bundle finalized. DO NOT TOUCH IT ANYMORE! ANY MODIFICATIONS WILL BREAK IT FROM NOW ON!") ]])
else()
downloadImHexPatternsFiles("${IMHEX_MAIN_OUTPUT_DIRECTORY}")
endif()
else()
install(TARGETS main RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if(WIN32) # Forwarder is only needed on Windows
if (TARGET updater)
install(TARGETS updater RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
if (TARGET main-forwarder)
install(TARGETS main-forwarder BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif()
if (IMHEX_GENERATE_PACKAGE)
set (CPACK_BUNDLE_NAME "ImHex")
set(CPACK_BUNDLE_NAME "ImHex")
include(CPack)
endif()
@@ -285,8 +382,11 @@ endfunction()
macro(configureCMake)
message(STATUS "Configuring ImHex v${IMHEX_VERSION}")
# Enable C and C++ languages
enable_language(C CXX)
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
if (IMHEX_USE_DEFAULT_BUILD_SETTINGS)
@@ -319,8 +419,11 @@ macro(configureCMake)
if (LD_LLD_PATH)
set(CMAKE_LINKER ${LD_LLD_PATH})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=lld")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=lld")
if (NOT XCODE AND NOT MSVC)
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -fuse-ld=lld)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fuse-ld=lld)
endif()
else ()
message(WARNING "lld not found, using default linker!")
endif ()
@@ -344,13 +447,20 @@ macro(configureCMake)
message(WARNING "LTO is not supported: ${output_error}")
endif ()
endif ()
# Some libraries we use set the BUILD_SHARED_LIBS variable to ON, which causes CMake to
# display a warning about options being set using set() instead of option().
# Explicitly set the policy to NEW to suppress the warning.
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
endmacro()
function(configureProject)
# Enable C and C++ languages
enable_language(C CXX)
if (XCODE)
# Support Xcode's multi configuration paradigm by placing built artifacts into separate directories
set(IMHEX_MAIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Configs/$<CONFIG>" PARENT_SCOPE)
else()
set(IMHEX_MAIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" PARENT_SCOPE)
endif()
endfunction()
macro(setDefaultBuiltTypeIfUnset)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Using RelWithDebInfo build type as it was left unset" FORCE)
@@ -358,12 +468,14 @@ macro(setDefaultBuiltTypeIfUnset)
endif()
endmacro()
function(loadVersion version)
function(loadVersion version plain_version)
set(VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/VERSION")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${VERSION_FILE})
file(READ "${VERSION_FILE}" read_version)
string(STRIP ${read_version} read_version)
string(REPLACE ".WIP" "" read_version_plain ${read_version})
set(${version} ${read_version} PARENT_SCOPE)
set(${plain_version} ${read_version_plain} PARENT_SCOPE)
endfunction()
function(detectBadClone)
@@ -390,6 +502,8 @@ function(verifyCompiler)
message(FATAL_ERROR "ImHex requires GCC 12.0.0 or newer. Please use the latest GCC version.")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "17.0.0")
message(FATAL_ERROR "ImHex requires Clang 17.0.0 or newer. Please use the latest Clang version.")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
elseif (NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
message(FATAL_ERROR "ImHex can only be compiled with GCC or Clang. ${CMAKE_CXX_COMPILER_ID} is not supported.")
endif()
@@ -453,56 +567,176 @@ function(downloadImHexPatternsFiles dest)
message(STATUS "Finished downloading ImHex-Patterns")
else ()
set(imhex_patterns_SOURCE_DIR "")
# Maybe patterns are cloned to a subdirectory
set(imhex_patterns_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ImHex-Patterns")
if (NOT EXISTS ${imhex_patterns_SOURCE_DIR})
set(imhex_patterns_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ImHex-Patterns")
endif()
# Or a sibling directory
if (NOT EXISTS ${imhex_patterns_SOURCE_DIR})
set(imhex_patterns_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../ImHex-Patterns")
endif()
endif ()
if (EXISTS ${imhex_patterns_SOURCE_DIR})
set(PATTERNS_FOLDERS_TO_INSTALL constants encodings includes patterns magic)
if (NOT EXISTS ${imhex_patterns_SOURCE_DIR})
message(WARNING "Failed to locate ImHex-Patterns repository, some resources will be missing during install!")
elseif(XCODE)
# The Xcode build has multiple configurations, which each need a copy of these files
file(GLOB_RECURSE sourceFilePaths LIST_DIRECTORIES NO CONFIGURE_DEPENDS RELATIVE "${imhex_patterns_SOURCE_DIR}"
"${imhex_patterns_SOURCE_DIR}/constants/*"
"${imhex_patterns_SOURCE_DIR}/encodings/*"
"${imhex_patterns_SOURCE_DIR}/includes/*"
"${imhex_patterns_SOURCE_DIR}/patterns/*"
"${imhex_patterns_SOURCE_DIR}/magic/*"
"${imhex_patterns_SOURCE_DIR}/nodes/*"
)
list(FILTER sourceFilePaths EXCLUDE REGEX "_schema.json$")
foreach(relativePath IN LISTS sourceFilePaths)
file(GENERATE OUTPUT "${dest}/${relativePath}" INPUT "${imhex_patterns_SOURCE_DIR}/${relativePath}")
endforeach()
else()
set(PATTERNS_FOLDERS_TO_INSTALL constants encodings includes patterns magic nodes)
foreach (FOLDER ${PATTERNS_FOLDERS_TO_INSTALL})
install(DIRECTORY "${imhex_patterns_SOURCE_DIR}/${FOLDER}" DESTINATION ${dest} PATTERN "**/_schema.json" EXCLUDE)
install(DIRECTORY "${imhex_patterns_SOURCE_DIR}/${FOLDER}" DESTINATION "${dest}" PATTERN "**/_schema.json" EXCLUDE)
endforeach ()
endif ()
endfunction()
# Compress debug info. See https://github.com/WerWolv/ImHex/issues/1714 for relevant problem
macro(setupDebugCompressionFlag)
include(CheckCXXCompilerFlag)
include(CheckLinkerFlag)
check_cxx_compiler_flag(-gz=zstd ZSTD_AVAILABLE_COMPILER)
check_linker_flag(CXX -gz=zstd ZSTD_AVAILABLE_LINKER)
check_cxx_compiler_flag(-gz COMPRESS_AVAILABLE_COMPILER)
check_linker_flag(CXX -gz COMPRESS_AVAILABLE_LINKER)
if (NOT DEBUG_COMPRESSION_FLAG) # Cache variable
if (ZSTD_AVAILABLE_COMPILER AND ZSTD_AVAILABLE_LINKER)
message("Using Zstd compression for debug info because both compiler and linker support it")
set(DEBUG_COMPRESSION_FLAG "-gz=zstd" CACHE STRING "Cache to use for debug info compression")
elseif (COMPRESS_AVAILABLE_COMPILER AND COMPRESS_AVAILABLE_LINKER)
message("Using default compression for debug info because both compiler and linker support it")
set(DEBUG_COMPRESSION_FLAG "-gz" CACHE STRING "Cache to use for debug info compression")
else()
set(DEBUG_COMPRESSION_FLAG "" CACHE STRING "Cache to use for debug info compression")
endif()
endif()
addCommonFlag(${DEBUG_COMPRESSION_FLAG})
endmacro()
macro(setupCompilerFlags target)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
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
addCommonFlag("/wd5244" ${target}) # 'include' in the purview of module 'module' appears erroneous
if (IMHEX_STRICT_WARNINGS)
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)
set(IMHEX_COMMON_FLAGS "${IMHEX_COMMON_FLAGS} -Wall -Wextra -Wpedantic -Werror")
addCommonFlag("-Werror" ${target})
endif()
if (UNIX AND NOT APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(IMHEX_COMMON_FLAGS "${IMHEX_COMMON_FLAGS} -rdynamic")
addCommonFlag("-rdynamic" ${target})
endif()
set(IMHEX_CXX_FLAGS "-fexceptions -frtti")
addCXXFlag("-fexceptions" ${target})
addCXXFlag("-frtti" ${target})
addCommonFlag("-fno-omit-frame-pointer" ${target})
# Disable some warnings
set(IMHEX_C_CXX_FLAGS "-Wno-unknown-warning-option -Wno-array-bounds -Wno-deprecated-declarations")
addCCXXFlag("-Wno-array-bounds" ${target})
addCCXXFlag("-Wno-deprecated-declarations" ${target})
addCCXXFlag("-Wno-unknown-pragmas" ${target})
addCXXFlag("-Wno-include-angled-in-module-purview" ${target})
if (IMHEX_ENABLE_UNITY_BUILD AND WIN32)
set(IMHEX_COMMON_FLAGS "${IMHEX_COMMON_FLAGS} -Wa,-mbig-obj")
# 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")
if (WIN32)
addLinkerFlag("-Wa,mbig-obj" ${target})
endif ()
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND APPLE)
execute_process(COMMAND brew --prefix llvm OUTPUT_VARIABLE LLVM_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
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")
addCommonFlag("/bigobj" ${target})
addCFlag("/std:clatest" ${target})
addCXXFlag("/std:c++latest" ${target})
endif()
# Disable some warnings for gcc
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(IMHEX_C_CXX_FLAGS "${IMHEX_C_CXX_FLAGS} -Wno-restrict -Wno-stringop-overread -Wno-stringop-overflow -Wno-dangling-reference")
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
addCCXXFlag("-Wno-restrict" ${target})
addCCXXFlag("-Wno-stringop-overread" ${target})
addCCXXFlag("-Wno-stringop-overflow" ${target})
addCCXXFlag("-Wno-dangling-reference" ${target})
endif()
# Define emscripten-specific disabled warnings
if (EMSCRIPTEN)
set(IMHEX_C_CXX_FLAGS "${IMHEX_C_CXX_FLAGS} -pthread -Wno-dollar-in-identifier-extension -Wno-pthreads-mem-growth")
addCCXXFlag("-pthread" ${target})
addCCXXFlag("-Wno-dollar-in-identifier-extension" ${target})
addCCXXFlag("-Wno-pthreads-mem-growth" ${target})
endif ()
# Set actual CMake flags
set_target_properties(${target} PROPERTIES COMPILE_FLAGS "${IMHEX_COMMON_FLAGS} ${IMHEX_C_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${IMHEX_COMMON_FLAGS} ${IMHEX_C_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IMHEX_COMMON_FLAGS} ${IMHEX_C_CXX_FLAGS} ${IMHEX_CXX_FLAGS}")
set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} ${IMHEX_COMMON_FLAGS}")
if (IMHEX_COMPRESS_DEBUG_INFO)
setupDebugCompressionFlag()
endif()
# Only generate minimal debug information for stacktraces in RelWithDebInfo builds
if (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
addCCXXFlag("-g1" ${target})
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Add flags for debug info in inline functions
addCCXXFlag("-gstatement-frontiers" ${target})
addCCXXFlag("-ginline-points" ${target})
endif()
endif()
endmacro()
# uninstall target
@@ -519,8 +753,6 @@ macro(setUninstallTarget)
endmacro()
macro(addBundledLibraries)
find_package(PkgConfig REQUIRED)
set(EXTERNAL_LIBS_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/lib/external")
set(THIRD_PARTY_LIBS_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/lib/third_party")
@@ -528,28 +760,27 @@ macro(addBundledLibraries)
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/imgui)
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/microtar EXCLUDE_FROM_ALL)
set_target_properties(microtar PROPERTIES POSITION_INDEPENDENT_CODE ON)
set(CLIP_ENABLE_IMAGE OFF CACHE BOOL "")
set(CLIP_EXAMPLES OFF CACHE BOOL "")
set(CLIP_TESTS OFF CACHE BOOL "")
set(CLIP_INSTALL OFF CACHE BOOL "")
set(CLIP_X11_WITH_PNG OFF CACHE BOOL "")
set(CLIP_SUPPORT_WINXP OFF CACHE BOOL "")
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/clip EXCLUDE_FROM_ALL)
target_include_directories(clip INTERFACE $<BUILD_INTERFACE:${THIRD_PARTY_LIBS_FOLDER}/clip>)
add_subdirectory(${EXTERNAL_LIBS_FOLDER}/libwolv EXCLUDE_FROM_ALL)
set_property(TARGET libwolv-types PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET libwolv-utils PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET libwolv-io PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET libwolv-hash PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET libwolv-containers PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET libwolv-net PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET libwolv-math_eval PROPERTY POSITION_INDEPENDENT_CODE ON)
set(XDGPP_INCLUDE_DIRS "${THIRD_PARTY_LIBS_FOLDER}/xdgpp")
set(FPHSA_NAME_MISMATCHED ON CACHE BOOL "")
find_package(PkgConfig REQUIRED)
if(NOT USE_SYSTEM_FMT)
set(FMT_INSTALL OFF CACHE BOOL "Disable install targets for libfmt" FORCE)
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/fmt EXCLUDE_FROM_ALL)
set_target_properties(fmt PROPERTIES POSITION_INDEPENDENT_CODE ON)
set(FMT_LIBRARIES fmt::fmt-header-only)
else()
find_package(fmt 8.0.0 REQUIRED)
find_package(fmt REQUIRED)
set(FMT_LIBRARIES fmt::fmt)
endif()
@@ -561,13 +792,11 @@ macro(addBundledLibraries)
if (NOT EMSCRIPTEN)
# curl
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBCURL REQUIRED IMPORTED_TARGET libcurl>=7.60.0)
find_package(CURL REQUIRED)
# nfd
if (NOT USE_SYSTEM_NFD)
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/nativefiledialog EXCLUDE_FROM_ALL)
set_target_properties(nfd PROPERTIES POSITION_INDEPENDENT_CODE ON)
set(NFD_LIBRARIES nfd)
else()
find_package(nfd)
@@ -583,9 +812,16 @@ macro(addBundledLibraries)
set(NLOHMANN_JSON_LIBRARIES nlohmann_json::nlohmann_json)
endif()
if (NOT USE_SYSTEM_LUNASVG)
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/lunasvg EXCLUDE_FROM_ALL)
set(LUNASVG_LIBRARIES lunasvg)
else()
find_package(lunasvg REQUIRED)
set(LUNASVG_LIBRARIES lunasvg::lunasvg)
endif()
if (NOT USE_SYSTEM_LLVM)
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/llvm-demangle EXCLUDE_FROM_ALL)
set_target_properties(LLVMDemangle PROPERTIES POSITION_INDEPENDENT_CODE ON)
else()
find_package(LLVM REQUIRED Demangle)
endif()
@@ -602,42 +838,45 @@ macro(addBundledLibraries)
set(JTHREAD_LIBRARIES jthread)
endif()
set(LIBPL_BUILD_CLI_AS_EXECUTABLE OFF)
add_subdirectory(${EXTERNAL_LIBS_FOLDER}/pattern_language EXCLUDE_FROM_ALL)
set_target_properties(libpl PROPERTIES POSITION_INDEPENDENT_CODE ON)
find_package(mbedTLS 3.4.0 REQUIRED)
pkg_search_module(MAGIC libmagic>=5.39)
if(NOT MAGIC_FOUND)
find_library(MAGIC 5.39 magic REQUIRED)
if (USE_SYSTEM_BOOST)
find_package(Boost REQUIRED CONFIG COMPONENTS regex)
set(BOOST_LIBRARIES Boost::regex)
else()
set(MAGIC_INCLUDE_DIRS ${MAGIC_INCLUDEDIR})
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/boost ${CMAKE_CURRENT_BINARY_DIR}/boost EXCLUDE_FROM_ALL)
set(BOOST_LIBRARIES boost::regex)
endif()
if (NOT IMHEX_DISABLE_STACKTRACE)
if (WIN32)
message(STATUS "StackWalk enabled!")
set(LIBBACKTRACE_LIBRARIES DbgHelp.lib)
else ()
find_package(Backtrace)
if (${Backtrace_FOUND})
message(STATUS "Backtrace enabled! Header: ${Backtrace_HEADER}")
set(LIBPL_BUILD_CLI_AS_EXECUTABLE OFF CACHE BOOL "" FORCE)
set(LIBPL_ENABLE_PRECOMPILED_HEADERS ${IMHEX_ENABLE_PRECOMPILED_HEADERS} CACHE BOOL "" FORCE)
if (Backtrace_HEADER STREQUAL "execinfo.h")
set(LIBBACKTRACE_LIBRARIES ${Backtrace_LIBRARY})
set(LIBBACKTRACE_INCLUDE_DIRS ${Backtrace_INCLUDE_DIR})
add_compile_definitions(BACKTRACE_HEADER=\"${Backtrace_HEADER}\")
add_compile_definitions(HEX_HAS_EXECINFO)
elseif (Backtrace_HEADER STREQUAL "backtrace.h")
set(LIBBACKTRACE_LIBRARIES ${Backtrace_LIBRARY})
set(LIBBACKTRACE_INCLUDE_DIRS ${Backtrace_INCLUDE_DIR})
add_compile_definitions(BACKTRACE_HEADER=\"${Backtrace_HEADER}\")
add_compile_definitions(HEX_HAS_BACKTRACE)
endif ()
endif()
endif ()
endif ()
set(LIBPL_SHARED_LIBRARY OFF CACHE BOOL "" FORCE)
add_subdirectory(${EXTERNAL_LIBS_FOLDER}/pattern_language EXCLUDE_FROM_ALL)
add_subdirectory(${EXTERNAL_LIBS_FOLDER}/disassembler EXCLUDE_FROM_ALL)
if (LIBPL_SHARED_LIBRARY)
install(
TARGETS
libpl
DESTINATION
"${CMAKE_INSTALL_LIBDIR}"
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
if (WIN32)
set_target_properties(
libpl
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
)
endif()
enableUnityBuild(libpl)
find_package(mbedTLS 3.4.0 REQUIRED)
find_package(Magic 5.39 REQUIRED)
endmacro()
function(enableUnityBuild TARGET)
@@ -646,77 +885,69 @@ function(enableUnityBuild TARGET)
endif ()
endfunction()
function(generatePDBs)
if (NOT WIN32 OR CMAKE_BUILD_TYPE STREQUAL "Debug")
return()
endif ()
include(FetchContent)
FetchContent_Declare(
cv2pdb
URL "https://github.com/rainers/cv2pdb/releases/download/v0.52/cv2pdb-0.52.zip"
DOWNLOAD_EXTRACT_TIMESTAMP ON
)
FetchContent_Populate(cv2pdb)
set(PDBS_TO_GENERATE main main-forwarder libimhex ${PLUGINS})
add_custom_target(pdbs)
foreach (PDB ${PDBS_TO_GENERATE})
if (PDB STREQUAL "main")
set(GENERATED_PDB imhex)
elseif (PDB STREQUAL "main-forwarder")
set(GENERATED_PDB imhex-gui)
elseif (PDB STREQUAL "libimhex")
set(GENERATED_PDB libimhex)
else ()
set(GENERATED_PDB plugins/${PDB})
endif ()
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${GENERATED_PDB}.pdb
WORKING_DIRECTORY ${cv2pdb_SOURCE_DIR}
COMMAND
(
${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/${GENERATED_PDB}.pdb &&
${cv2pdb_SOURCE_DIR}/cv2pdb64.exe
$<TARGET_FILE:${PDB}>
) || (exit 0)
DEPENDS $<TARGET_FILE:${PDB}>
COMMAND_EXPAND_LISTS)
target_sources(imhex_all PRIVATE ${CMAKE_BINARY_DIR}/${GENERATED_PDB}.pdb)
install(FILES ${CMAKE_BINARY_DIR}/${GENERATED_PDB}.pdb DESTINATION ".")
endforeach ()
function(setSDKPaths)
if (WIN32)
set(SDK_PATH "./sdk" PARENT_SCOPE)
elseif (APPLE)
set(SDK_PATH "${CMAKE_INSTALL_PREFIX}/${BUNDLE_NAME}/Contents/Resources/sdk" PARENT_SCOPE)
else()
set(SDK_PATH "share/imhex/sdk" PARENT_SCOPE)
endif()
set(SDK_BUILD_PATH "${CMAKE_BINARY_DIR}/sdk" PARENT_SCOPE)
endfunction()
function(generateSDKDirectory)
if (WIN32)
set(SDK_PATH "./sdk")
elseif (APPLE)
set(SDK_PATH "imhex.app/Contents/Resources/sdk")
else()
set(SDK_PATH "share/imhex/sdk")
endif()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/libimhex DESTINATION "${SDK_PATH}/lib")
setSDKPaths()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/libimhex DESTINATION "${SDK_PATH}/lib" PATTERN "**/source/*" EXCLUDE)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/trace DESTINATION "${SDK_PATH}/lib" PATTERN "**/source/*" EXCLUDE)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/external DESTINATION "${SDK_PATH}/lib")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/third_party/imgui DESTINATION "${SDK_PATH}/lib/third_party")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/third_party/imgui DESTINATION "${SDK_PATH}/lib/third_party" PATTERN "**/source/*" EXCLUDE)
if (NOT USE_SYSTEM_FMT)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/third_party/fmt DESTINATION "${SDK_PATH}/lib/third_party")
endif()
if (NOT USE_SYSTEM_NLOHMANN_JSON)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/third_party/nlohmann_json DESTINATION "${SDK_PATH}/lib/third_party")
endif()
if (NOT USE_SYSTEM_BOOST)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/third_party/boost DESTINATION "${SDK_PATH}/lib/third_party")
endif()
install(FILES ${CMAKE_SOURCE_DIR}/cmake/modules/ImHexPlugin.cmake DESTINATION "${SDK_PATH}/cmake/modules")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/modules DESTINATION "${SDK_PATH}/cmake")
install(FILES ${CMAKE_SOURCE_DIR}/cmake/build_helpers.cmake DESTINATION "${SDK_PATH}/cmake")
install(FILES ${CMAKE_SOURCE_DIR}/cmake/sdk/CMakeLists.txt DESTINATION "${SDK_PATH}")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/sdk/ DESTINATION "${SDK_PATH}")
install(TARGETS libimhex ARCHIVE DESTINATION "${SDK_PATH}/lib")
install(TARGETS libimhex RUNTIME DESTINATION "${SDK_PATH}/lib")
install(TARGETS libimhex LIBRARY DESTINATION "${SDK_PATH}/lib")
install(TARGETS tracing 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/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)
get_target_property(library_include_dirs ${library} INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(${target} PRIVATE ${library_include_dirs})
endfunction()
endfunction()
function(precompileHeaders target includeFolder)
if (NOT IMHEX_ENABLE_PRECOMPILED_HEADERS)
return()
endif()
file(GLOB_RECURSE TARGET_INCLUDES "${includeFolder}/**/*.hpp")
set(SYSTEM_INCLUDES "<algorithm>;<array>;<atomic>;<chrono>;<cmath>;<cstddef>;<cstdint>;<cstdio>;<cstdlib>;<cstring>;<exception>;<filesystem>;<functional>;<iterator>;<limits>;<list>;<map>;<memory>;<optional>;<ranges>;<set>;<stdexcept>;<string>;<string_view>;<thread>;<tuple>;<type_traits>;<unordered_map>;<unordered_set>;<utility>;<variant>;<vector>")
set(INCLUDES "${SYSTEM_INCLUDES};${TARGET_INCLUDES}")
string(REPLACE ">" "$<ANGLE-R>" INCLUDES "${INCLUDES}")
target_precompile_headers(${target}
PUBLIC
"$<$<COMPILE_LANGUAGE:CXX>:${INCLUDES}>"
)
endfunction()

149
cmake/ide_helpers.cmake Normal file
View File

@@ -0,0 +1,149 @@
option(IMHEX_IDE_HELPERS_OVERRIDE_XCODE_COMPILER "Enable choice of compiler for Xcode builds, despite CMake's best efforts" OFF)
option(IMHEX_IDE_HELPERS_INTRUSIVE_IDE_TWEAKS "Enable intrusive CMake tweaks to better support IDEs with folder support" OFF)
# The CMake infrastructure silently ignores the CMAKE_<>_COMPILER settings when
# using the `Xcode` generator.
#
# A particularly nasty (and potentially only) way of getting around this is to
# temporarily lie about the generator being used, while CMake determines and
# locks in the compiler to use.
#
# Needless to say, this is hacky and fragile. Use at your own risk!
if (IMHEX_IDE_HELPERS_OVERRIDE_XCODE_COMPILER AND CMAKE_GENERATOR STREQUAL "Xcode")
set(CMAKE_GENERATOR "Unknown")
enable_language(C CXX)
set(CMAKE_GENERATOR "Xcode")
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_C_COMPILER}")
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_CXX_COMPILER}")
if (CLANG)
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_C_COMPILER}")
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_CXX_COMPILER}")
endif()
# By default Xcode passes a `-index-store-path=<...>` parameter to the compiler
# during builds to build code completion indexes. This is not supported by
# anything other than AppleClang
set(CMAKE_XCODE_ATTRIBUTE_COMPILER_INDEX_STORE_ENABLE "NO")
endif()
# Generate a launch/build scheme for all targets
set(CMAKE_XCODE_GENERATE_SCHEME YES)
# Utility function that helps avoid messing with non-standard targets
macro(returnIfTargetIsNonTweakable target)
get_target_property(targetIsAliased ${target} ALIASED_TARGET)
get_target_property(targetIsImported ${target} IMPORTED)
if (targetIsAliased OR targetIsImported)
return()
endif()
get_target_property(targetType ${target} TYPE)
if (targetType MATCHES "INTERFACE_LIBRARY|UNKNOWN_LIBRARY")
return()
endif()
endmacro()
# Targets usually don't specify their private headers, nor group their source files
# which results in very spotty coverage by IDEs with folders support
#
# Unfortunately, CMake does not have a `target_source_group` like construct yet, therefore
# we have to play by the limitations of `source_group`.
#
# A particularly problematic part is that the function must be called within the directoryies
# scope for the grouping to take effect.
#
# See: https://discourse.cmake.org/t/topic/7388
function(tweakTargetForIDESupport target)
returnIfTargetIsNonTweakable(${target})
# Don't assume directory structure of third parties
get_target_property(targetSourceDir ${target} SOURCE_DIR)
if (targetSourceDir MATCHES "third_party")
return()
endif()
# Add headers to target
get_target_property(targetSourceDir ${target} SOURCE_DIR)
if (targetSourceDir)
file(GLOB_RECURSE targetPrivateHeaders CONFIGURE_DEPENDS "${targetSourceDir}/include/*.hpp")
target_sources(${target} PRIVATE "${targetPrivateHeaders}")
endif()
# Organize target sources into directory tree
get_target_property(sources ${target} SOURCES)
foreach(file IN LISTS sources)
get_filename_component(path "${file}" ABSOLUTE)
if (NOT path MATCHES "^${targetSourceDir}")
continue()
endif()
source_group(TREE "${targetSourceDir}" PREFIX "Source Tree" FILES "${file}")
endforeach()
endfunction()
if (IMHEX_IDE_HELPERS_INTRUSIVE_IDE_TWEAKS)
# See tweakTargetForIDESupport for rationale
function(add_library target)
_add_library(${target} ${ARGN})
tweakTargetForIDESupport(${target})
endfunction()
function(add_executable target)
_add_executable(${target} ${ARGN})
tweakTargetForIDESupport(${target})
endfunction()
endif()
# Adjust target's FOLDER property, which is an IDE only preference
function(_tweakTarget target path)
get_target_property(targetType ${target} TYPE)
if (TARGET generator-${target})
set_target_properties(generator-${target} PROPERTIES FOLDER "romfs/${target}")
endif()
if (TARGET romfs_file_packer-${target})
set_target_properties(romfs_file_packer-${target} PROPERTIES FOLDER "romfs/${target}")
endif()
if (TARGET libromfs-${target})
set_target_properties(libromfs-${target} PROPERTIES FOLDER "romfs/${target}")
endif()
if (${targetType} MATCHES "EXECUTABLE|LIBRARY")
set_target_properties(${target} PROPERTIES FOLDER "${path}")
endif()
endfunction()
macro(_tweakTargetsRecursive dir)
get_property(subdirectories DIRECTORY ${dir} PROPERTY SUBDIRECTORIES)
foreach(subdir IN LISTS subdirectories)
_tweakTargetsRecursive("${subdir}")
endforeach()
if(${dir} STREQUAL ${CMAKE_SOURCE_DIR})
return()
endif()
get_property(targets DIRECTORY "${dir}" PROPERTY BUILDSYSTEM_TARGETS)
file(RELATIVE_PATH rdir ${CMAKE_SOURCE_DIR} "${dir}/..")
foreach(target ${targets})
_tweakTarget(${target} "${rdir}")
endforeach()
endmacro()
# Tweak all targets this CMake build is aware about
function(tweakTargetsForIDESupport)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
_tweakTargetsRecursive("${CMAKE_SOURCE_DIR}")
endfunction()

View File

@@ -0,0 +1,8 @@
find_path(CAPSTONE_INCLUDE_DIR capstone.h PATH_SUFFIXES capstone)
find_library(CAPSTONE_LIBRARY NAMES capstone)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Capstone DEFAULT_MSG CAPSTONE_LIBRARY CAPSTONE_INCLUDE_DIR)
mark_as_advanced(CAPSTONE_INCLUDE_DIR CAPSTONE_LIBRARY)

View File

@@ -11,6 +11,14 @@ if (UNIX)
set(CORECLR_SUBARCH "arm64")
endif()
endif()
if (APPLE)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
set(CORECLR_ARCH "osx-arm64")
set(CORECLR_SUBARCH "arm64")
else()
set(CORECLR_ARCH "osx-x64")
endif()
endif()
if (NOT DOTNET_EXECUTABLE)
set(DOTNET_EXECUTABLE dotnet)
@@ -49,13 +57,16 @@ endif()
set(CoreClrEmbed_ROOT_PATH "${CORECLR_RUNTIME_ROOT_PATH}")
file(GLOB _CORECLR_HOST_ARCH_PATH "${CORECLR_RUNTIME_ROOT_PATH}/packs/Microsoft.NETCore.App.Host.*-${CORECLR_SUBARCH}")
if (_CORECLR_HOST_ARCH_PATH)
get_filename_component(_CORECLR_HOST_ARCH_FILENAME ${_CORECLR_HOST_ARCH_PATH} NAME)
string(REPLACE "Microsoft.NETCore.App.Host." "" _CORECLR_COMPUTED_ARCH "${_CORECLR_HOST_ARCH_FILENAME}")
if (_CORECLR_COMPUTED_ARCH)
set(CORECLR_ARCH "${_CORECLR_COMPUTED_ARCH}")
endif()
file(GLOB _CORECLR_HOST_ARCH_PATH_LIST "${CORECLR_RUNTIME_ROOT_PATH}/packs/Microsoft.NETCore.App.Host.*-${CORECLR_SUBARCH}")
if (_CORECLR_HOST_ARCH_PATH_LIST)
foreach(_CORECLR_HOST_ARCH_PATH ${_CORECLR_HOST_ARCH_PATH_LIST})
get_filename_component(_CORECLR_HOST_ARCH_FILENAME ${_CORECLR_HOST_ARCH_PATH} NAME)
string(REPLACE "Microsoft.NETCore.App.Host." "" _CORECLR_COMPUTED_ARCH "${_CORECLR_HOST_ARCH_FILENAME}")
if (_CORECLR_COMPUTED_ARCH)
set(CORECLR_ARCH "${_CORECLR_COMPUTED_ARCH}")
break()
endif()
endforeach()
endif()
set(CORECLR_HOST_BASE_PATH "${CORECLR_RUNTIME_ROOT_PATH}/packs/Microsoft.NETCore.App.Host.${CORECLR_ARCH}/${CORECLR_RUNTIME_VERSION_FULL}")
@@ -78,4 +89,5 @@ if (CoreClrEmbed_INCLUDE_DIR AND CoreClrEmbed_LIBRARY)
set(CoreClrEmbed_LIBRARIES "${CoreClrEmbed_LIBRARY}" CACHE STRING "CoreClrEmbed libraries" FORCE)
set(CoreClrEmbed_SHARED_LIBRARIES "${CoreClrEmbed_SHARED_LIBRARY}" CACHE STRING "CoreClrEmbed shared libraries" FORCE)
set(CoreClrEmbed_INCLUDE_DIRS "${CoreClrEmbed_INCLUDE_DIR}" CACHE STRING "CoreClrEmbed include directories" FORCE)
set(CoreClrEmbed_VERSION "${CORECLR_RUNTIME_VERSION_FULL}" CACHE STRING "CoreClrEmbed version" FORCE)
endif()

View File

@@ -0,0 +1,139 @@
#.rst:
# Find GLFW
# ---------
#
# Finds the GLFW library using its cmake config if that exists, otherwise
# falls back to finding it manually. This module defines:
#
# GLFW_FOUND - True if GLFW library is found
# GLFW::GLFW - GLFW imported target
#
# Additionally, in case the config was not found, these variables are defined
# for internal usage:
#
# GLFW_LIBRARY - GLFW library
# GLFW_DLL_DEBUG - GLFW debug DLL on Windows, if found
# GLFW_DLL_RELEASE - GLFW release DLL on Windows, if found
# GLFW_INCLUDE_DIR - Root include dir
#
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
# 2020, 2021, 2022 Vladimír Vondruš <mosra@centrum.cz>
# Copyright © 2016 Jonathan Hale <squareys@googlemail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# GLFW installs cmake package config files which handles dependencies in case
# GLFW is built statically. Try to find first, quietly, so it doesn't print
# loud messages when it's not found, since that's okay. If the glfw target
# already exists, it means we're using it through a CMake subproject -- don't
# attempt to find the package in that case.
if(NOT TARGET glfw)
find_package(glfw3 CONFIG QUIET)
endif()
# If either a glfw config file was found or we have a subproject, point
# GLFW::GLFW to that and exit -- nothing else to do here.
if(TARGET glfw)
if(NOT TARGET GLFW::GLFW)
# Aliases of (global) targets are only supported in CMake 3.11, so we
# work around it by this. This is easier than fetching all possible
# properties (which are impossible to track of) and then attempting to
# rebuild them into a new target.
add_library(GLFW::GLFW INTERFACE IMPORTED)
set_target_properties(GLFW::GLFW PROPERTIES INTERFACE_LINK_LIBRARIES glfw)
endif()
# Just to make FPHSA print some meaningful location, nothing else
get_target_property(_GLFW_INTERFACE_INCLUDE_DIRECTORIES glfw INTERFACE_INCLUDE_DIRECTORIES)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args("GLFW" DEFAULT_MSG
_GLFW_INTERFACE_INCLUDE_DIRECTORIES)
if(CORRADE_TARGET_WINDOWS)
# .dll is in LOCATION, .lib is in IMPLIB. Yay, useful!
get_target_property(GLFW_DLL_DEBUG glfw IMPORTED_LOCATION_DEBUG)
get_target_property(GLFW_DLL_RELEASE glfw IMPORTED_LOCATION_RELEASE)
endif()
return()
endif()
if(CORRADE_TARGET_WINDOWS)
if(MSVC)
if(MSVC_VERSION VERSION_LESS 1910)
set(_GLFW_LIBRARY_PATH_SUFFIX lib-vc2015)
elseif(MSVC_VERSION VERSION_LESS 1920)
set(_GLFW_LIBRARY_PATH_SUFFIX lib-vc2017)
elseif(MSVC_VERSION VERSION_LESS 1930)
set(_GLFW_LIBRARY_PATH_SUFFIX lib-vc2019)
elseif(MSVC_VERSION VERSION_LESS 1940)
set(_GLFW_LIBRARY_PATH_SUFFIX lib-vc2022)
else()
message(FATAL_ERROR "Unsupported MSVC version")
endif()
elseif(MINGW)
set(_GLFW_LIBRARY_PATH_SUFFIX lib-mingw-w64)
else()
message(FATAL_ERROR "Unsupported compiler")
endif()
endif()
# In case no config file was found, try manually finding the library. Prefer
# the glfw3dll as it's a dynamic library.
find_library(GLFW_LIBRARY
NAMES glfw glfw3dll glfw3
PATH_SUFFIXES ${_GLFW_LIBRARY_PATH_SUFFIX})
if(CORRADE_TARGET_WINDOWS AND GLFW_LIBRARY MATCHES "glfw3dll.(lib|a)$")
# TODO: debug?
find_file(GLFW_DLL_RELEASE
NAMES glfw3.dll
PATH_SUFFIXES ${_GLFW_LIBRARY_PATH_SUFFIX})
endif()
# Include dir
find_path(GLFW_INCLUDE_DIR
NAMES GLFW/glfw3.h)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args("GLFW" DEFAULT_MSG
GLFW_LIBRARY
GLFW_INCLUDE_DIR)
if(NOT TARGET GLFW::GLFW)
add_library(GLFW::GLFW UNKNOWN IMPORTED)
# Work around BUGGY framework support on macOS
# https://cmake.org/Bug/view.php?id=14105
if(CORRADE_TARGET_APPLE AND GLFW_LIBRARY MATCHES "\\.framework$")
set_property(TARGET GLFW::GLFW PROPERTY IMPORTED_LOCATION ${GLFW_LIBRARY}/GLFW)
else()
set_property(TARGET GLFW::GLFW PROPERTY IMPORTED_LOCATION ${GLFW_LIBRARY})
endif()
set_property(TARGET GLFW::GLFW PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${GLFW_INCLUDE_DIR})
endif()
mark_as_advanced(GLFW_LIBRARY GLFW_INCLUDE_DIR)

View File

@@ -0,0 +1,60 @@
find_path(LZ4_INCLUDE_DIR
NAMES lz4.h
HINTS "${LZ4_INCLUDEDIR}" "${LZ4_HINTS}/include"
PATHS
/usr/local/include
/usr/include
)
find_library(LZ4_LIBRARY
NAMES lz4 liblz4
HINTS "${LZ4_LIBDIR}" "${LZ4_HINTS}/lib"
PATHS
/usr/local/lib
/usr/lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args( LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR )
if( LZ4_FOUND )
include( CheckIncludeFile )
include( CMakePushCheckState )
set( LZ4_INCLUDE_DIRS ${LZ4_INCLUDE_DIR} )
set( LZ4_LIBRARIES ${LZ4_LIBRARY} )
cmake_push_check_state()
set( CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIRS} )
check_include_file( lz4frame.h HAVE_LZ4FRAME_H )
cmake_pop_check_state()
if (WIN32)
set ( LZ4_DLL_DIR "${LZ4_HINTS}/bin"
CACHE PATH "Path to LZ4 DLL"
)
file( GLOB _lz4_dll RELATIVE "${LZ4_DLL_DIR}"
"${LZ4_DLL_DIR}/lz4*.dll"
)
set ( LZ4_DLL ${_lz4_dll}
# We're storing filenames only. Should we use STRING instead?
CACHE FILEPATH "LZ4 DLL file name"
)
file( GLOB _lz4_pdb RELATIVE "${LZ4_DLL_DIR}"
"${LZ4_DLL_DIR}/lz4*.pdb"
)
set ( LZ4_PDB ${_lz4_pdb}
CACHE FILEPATH "LZ4 PDB file name"
)
mark_as_advanced( LZ4_DLL_DIR LZ4_DLL LZ4_PDB )
endif()
else()
set( LZ4_INCLUDE_DIRS )
set( LZ4_LIBRARIES )
endif()
mark_as_advanced( LZ4_LIBRARIES LZ4_INCLUDE_DIRS )
add_library( LZ4::lz4 INTERFACE IMPORTED )
set_property( TARGET LZ4::lz4 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${LZ4_INCLUDE_DIRS} )
set_property( TARGET LZ4::lz4 PROPERTY INTERFACE_LINK_LIBRARIES ${LZ4_LIBRARIES} )

View File

@@ -0,0 +1,18 @@
find_path(LIBMAGIC_INCLUDE_DIR magic.h)
find_library(LIBMAGIC_LIBRARY NAMES magic)
if (LIBMAGIC_INCLUDE_DIR AND LIBMAGIC_LIBRARY)
set(LIBMAGIC_FOUND TRUE)
endif (LIBMAGIC_INCLUDE_DIR AND LIBMAGIC_LIBRARY)
find_package_handle_standard_args("libmagic" DEFAULT_MSG
LIBMAGIC_LIBRARY
LIBMAGIC_INCLUDE_DIR
)
mark_as_advanced(
LIBMAGIC_INCLUDE_DIR
LIBMAGIC_LIBRARY
LIBMAGIC_FOUND
)

View File

@@ -0,0 +1,4 @@
find_library(YARA_LIBRARIES NAMES yara)
find_file(yara.h YARA_INCLUDE_DIRS)
mark_as_advanced(YARA_LIBRARIES YARA_INCLUDE_DIRS)

View File

@@ -0,0 +1,45 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# - Try to find Facebook zstd library
# This will define
# ZSTD_FOUND
# ZSTD_INCLUDE_DIR
# ZSTD_LIBRARY
#
find_path(ZSTD_INCLUDE_DIR NAMES zstd.h)
find_library(ZSTD_LIBRARY_DEBUG NAMES zstdd zstd_staticd)
find_library(ZSTD_LIBRARY_RELEASE NAMES zstd zstd_static)
include(SelectLibraryConfigurations)
SELECT_LIBRARY_CONFIGURATIONS(ZSTD)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
ZSTD DEFAULT_MSG
ZSTD_LIBRARY ZSTD_INCLUDE_DIR
)
if (ZSTD_FOUND)
message(STATUS "Found Zstd: ${ZSTD_LIBRARY}")
endif()
mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARY)
add_library(ZSTD::zstd INTERFACE IMPORTED)
set_property(TARGET ZSTD::zstd PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${ZSTD_INCLUDE_DIR})
set_property(TARGET ZSTD::zstd PROPERTY INTERFACE_LINK_LIBRARIES ${ZSTD_LIBRARY})

View File

@@ -40,7 +40,12 @@ IF(MBEDTLS_FOUND)
STRING(REGEX REPLACE "^lib" "" MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY_FILE})
STRING(REGEX REPLACE "^lib" "" MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY_FILE})
STRING(REGEX REPLACE "^lib" "" MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY_FILE})
SET(MBEDTLS_LIBRARIES "-L${MBEDTLS_LIBRARY_DIR} -l${MBEDTLS_LIBRARY_FILE} -l${MBEDX509_LIBRARY_FILE} -l${MBEDCRYPTO_LIBRARY_FILE}")
if (MSVC)
SET(MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARY_FILE}.lib ${MBEDX509_LIBRARY_FILE}.lib ${MBEDCRYPTO_LIBRARY_FILE}.lib)
else()
SET(MBEDTLS_LIBRARIES "-L${MBEDTLS_LIBRARY_DIR} -l${MBEDTLS_LIBRARY_FILE} -l${MBEDX509_LIBRARY_FILE} -l${MBEDCRYPTO_LIBRARY_FILE}")
endif()
IF(NOT MBEDTLS_FIND_QUIETLY)
MESSAGE(STATUS "Found mbedTLS:")
@@ -55,9 +60,9 @@ IF(MBEDTLS_FOUND)
MESSAGE(STATUS " Crypto: ${MBEDCRYPTO_LIBRARY}")
ENDIF(NOT MBEDTLS_FIND_QUIETLY)
ELSE(MBEDTLS_FOUND)
IF(MBEDTLS_FIND_REQUIRED)
IF(mbedTLS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find mbedTLS")
ENDIF(MBEDTLS_FIND_REQUIRED)
ENDIF(mbedTLS_FIND_REQUIRED)
ENDIF(MBEDTLS_FOUND)
MARK_AS_ADVANCED(
@@ -67,4 +72,4 @@ MARK_AS_ADVANCED(
MBEDTLS_LIBRARY
MBEDX509_LIBRARY
MBEDCRYPTO_LIBRARY
)
)

View File

@@ -1,10 +1,16 @@
macro(add_imhex_plugin)
setSDKPaths()
# Parse arguments
set(options LIBRARY_PLUGIN)
set(oneValueArgs NAME)
set(multiValueArgs SOURCES INCLUDES LIBRARIES)
set(oneValueArgs NAME IMHEX_VERSION)
set(multiValueArgs SOURCES INCLUDES LIBRARIES FEATURES)
cmake_parse_arguments(IMHEX_PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (IMHEX_PLUGIN_IMHEX_VERSION)
message(STATUS "Compiling plugin ${IMHEX_PLUGIN_NAME} for ImHex Version ${IMHEX_PLUGIN_IMHEX_VERSION}")
set(IMHEX_VERSION_STRING "${IMHEX_PLUGIN_IMHEX_VERSION}")
endif()
if (IMHEX_STATIC_LINK_PLUGINS)
set(IMHEX_PLUGIN_LIBRARY_TYPE STATIC)
@@ -23,6 +29,10 @@ macro(add_imhex_plugin)
endif()
endif()
if (IMHEX_PLUGIN_LIBRARY_PLUGIN)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/" DESTINATION "${SDK_PATH}/lib/plugins/${IMHEX_PLUGIN_NAME}")
endif()
# Define new project for plugin
project(${IMHEX_PLUGIN_NAME})
@@ -31,8 +41,12 @@ macro(add_imhex_plugin)
# Add include directories and link libraries
target_include_directories(${IMHEX_PLUGIN_NAME} PUBLIC ${IMHEX_PLUGIN_INCLUDES})
target_link_libraries(${IMHEX_PLUGIN_NAME} PRIVATE libimhex ${IMHEX_PLUGIN_LIBRARIES} ${FMT_LIBRARIES} imgui_all_includes libwolv)
target_link_libraries(${IMHEX_PLUGIN_NAME} PUBLIC ${IMHEX_PLUGIN_LIBRARIES})
target_link_libraries(${IMHEX_PLUGIN_NAME} PRIVATE libimhex ${FMT_LIBRARIES} imgui_all_includes libwolv)
addIncludesFromLibrary(${IMHEX_PLUGIN_NAME} libpl)
addIncludesFromLibrary(${IMHEX_PLUGIN_NAME} libpl-gen)
precompileHeaders(${IMHEX_PLUGIN_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/include")
# Add IMHEX_PROJECT_NAME and IMHEX_VERSION define
target_compile_definitions(${IMHEX_PLUGIN_NAME} PRIVATE IMHEX_PROJECT_NAME="${IMHEX_PLUGIN_NAME}")
@@ -40,34 +54,106 @@ macro(add_imhex_plugin)
target_compile_definitions(${IMHEX_PLUGIN_NAME} PRIVATE IMHEX_PLUGIN_NAME=${IMHEX_PLUGIN_NAME})
# Enable required compiler flags
set_target_properties(${IMHEX_PLUGIN_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
enableUnityBuild(${IMHEX_PLUGIN_NAME})
setupCompilerFlags(${IMHEX_PLUGIN_NAME})
# Configure build properties
set_target_properties(${IMHEX_PLUGIN_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins
RUNTIME_OUTPUT_DIRECTORY "${IMHEX_MAIN_OUTPUT_DIRECTORY}/plugins"
CXX_STANDARD 23
PREFIX ""
SUFFIX ${IMHEX_PLUGIN_SUFFIX}
)
# Set rpath of plugin libraries to the plugins folder
if (WIN32)
if (IMHEX_PLUGIN_LIBRARY_PLUGIN)
set_target_properties(${IMHEX_PLUGIN_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
endif()
elseif (APPLE)
set_target_properties(${IMHEX_PLUGIN_NAME} PROPERTIES BUILD_RPATH "@executable_path/../Frameworks;@executable_path/plugins")
endif()
# Setup a romfs for the plugin
list(APPEND LIBROMFS_RESOURCE_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/romfs)
set(LIBROMFS_PROJECT_NAME ${IMHEX_PLUGIN_NAME})
add_subdirectory(${IMHEX_BASE_FOLDER}/lib/external/libromfs ${CMAKE_CURRENT_BINARY_DIR}/libromfs)
set_target_properties(${LIBROMFS_LIBRARY} PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(${IMHEX_PLUGIN_NAME} PRIVATE ${LIBROMFS_LIBRARY})
set(FEATURE_DEFINE_CONTENT)
if (IMHEX_PLUGIN_FEATURES)
list(LENGTH IMHEX_PLUGIN_FEATURES IMHEX_FEATURE_COUNT)
math(EXPR IMHEX_FEATURE_COUNT "${IMHEX_FEATURE_COUNT} - 1" OUTPUT_FORMAT DECIMAL)
foreach(index RANGE 0 ${IMHEX_FEATURE_COUNT} 2)
list(SUBLIST IMHEX_PLUGIN_FEATURES ${index} 2 IMHEX_PLUGIN_FEATURE)
list(GET IMHEX_PLUGIN_FEATURE 0 feature_define)
list(GET IMHEX_PLUGIN_FEATURE 1 feature_description)
string(TOUPPER ${feature_define} feature_define)
add_definitions(-DIMHEX_PLUGIN_${IMHEX_PLUGIN_NAME}_FEATURE_${feature_define}=0)
set(FEATURE_DEFINE_CONTENT "${FEATURE_DEFINE_CONTENT}{ \"${feature_description}\", IMHEX_FEATURE_ENABLED(${feature_define}) },")
endforeach()
endif()
target_compile_options(${IMHEX_PLUGIN_NAME} PRIVATE -DIMHEX_PLUGIN_FEATURES_CONTENT=${FEATURE_DEFINE_CONTENT})
# Add the new plugin to the main dependency list so it gets built by default
if (TARGET imhex_all)
add_dependencies(imhex_all ${IMHEX_PLUGIN_NAME})
endif()
if (IMHEX_EXTERNAL_PLUGIN_BUILD)
install(TARGETS ${IMHEX_PLUGIN_NAME} DESTINATION ".")
endif()
# Fix rpath
if (APPLE)
set_target_properties(
${IMHEX_PLUGIN_NAME}
PROPERTIES
INSTALL_RPATH "@executable_path/../Frameworks;@executable_path/plugins"
)
elseif (UNIX)
set(PLUGIN_RPATH "")
list(APPEND PLUGIN_RPATH "$ORIGIN")
if (IMHEX_PLUGIN_ADD_INSTALL_PREFIX_TO_RPATH)
list(APPEND PLUGIN_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif()
set_target_properties(
${IMHEX_PLUGIN_NAME}
PROPERTIES
INSTALL_RPATH_USE_ORIGIN ON
INSTALL_RPATH "${PLUGIN_RPATH}"
)
endif()
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt AND IMHEX_ENABLE_UNIT_TESTS AND IMHEX_ENABLE_PLUGIN_TESTS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests)
target_link_libraries(${IMHEX_PLUGIN_NAME} PUBLIC ${IMHEX_PLUGIN_NAME}_tests)
target_compile_definitions(${IMHEX_PLUGIN_NAME}_tests PRIVATE IMHEX_PROJECT_NAME="${IMHEX_PLUGIN_NAME}-tests")
endif()
endmacro()
macro(add_romfs_resource input output)
if (NOT EXISTS ${input})
message(WARNING "Resource file ${input} does not exist")
endif()
configure_file(${input} ${CMAKE_CURRENT_BINARY_DIR}/romfs/${output} COPYONLY)
list(APPEND LIBROMFS_RESOURCE_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/romfs)
endmacro()
endmacro()
macro (enable_plugin_feature feature)
string(TOUPPER ${feature} feature)
if (NOT (feature IN_LIST IMHEX_PLUGIN_FEATURES))
message(FATAL_ERROR "Feature ${feature} is not enabled for plugin ${IMHEX_PLUGIN_NAME}")
endif()
remove_definitions(-DIMHEX_PLUGIN_${IMHEX_PLUGIN_NAME}_FEATURE_${feature}=0)
add_definitions(-DIMHEX_PLUGIN_${IMHEX_PLUGIN_NAME}_FEATURE_${feature}=1)
endmacro()

View File

@@ -14,12 +14,11 @@ if(CMAKE_GENERATOR)
# Being called as include(PostprocessBundle), so define a helper function.
set(_POSTPROCESS_BUNDLE_MODULE_LOCATION "${CMAKE_CURRENT_LIST_FILE}")
function(postprocess_bundle out_target in_target)
add_custom_command(TARGET ${out_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -DBUNDLE_PATH="$<TARGET_FILE_DIR:${in_target}>/../.."
-DCODE_SIGN_CERTIFICATE_ID="${CODE_SIGN_CERTIFICATE_ID}"
-DEXTRA_BUNDLE_LIBRARY_PATHS="${EXTRA_BUNDLE_LIBRARY_PATHS}"
-P "${_POSTPROCESS_BUNDLE_MODULE_LOCATION}"
)
install(CODE "set(BUNDLE_PATH ${CMAKE_INSTALL_PREFIX}/${BUNDLE_NAME})")
install(CODE "set(CODE_SIGN_CERTIFICATE_ID ${CODE_SIGN_CERTIFICATE_ID})")
install(CODE "set(EXTRA_BUNDLE_LIBRARY_PATHS ${EXTRA_BUNDLE_LIBRARY_PATHS})")
install(SCRIPT ${_POSTPROCESS_BUNDLE_MODULE_LOCATION})
endfunction()
return()
endif()
@@ -36,14 +35,13 @@ message(STATUS "Fixing up application bundle: ${BUNDLE_PATH}")
# Make sure to fix up any included ImHex plugin.
file(GLOB_RECURSE plugins "${BUNDLE_PATH}/Contents/MacOS/plugins/*.hexplug")
file(GLOB_RECURSE plugin_libs "${BUNDLE_PATH}/Contents/MacOS/plugins/*.hexpluglib")
# BundleUtilities doesn't support DYLD_FALLBACK_LIBRARY_PATH behavior, which
# makes it sometimes break on libraries that do weird things with @rpath. Specify
# equivalent search directories until https://gitlab.kitware.com/cmake/cmake/issues/16625
# is fixed and in our minimum CMake version.
set(extra_dirs "/usr/local/lib" "/lib" "/usr/lib" ${EXTRA_BUNDLE_LIBRARY_PATHS} "${BUNDLE_PATH}/Contents/MacOS/plugins")
set(extra_dirs "/usr/local/lib" "/lib" "/usr/lib" ${EXTRA_BUNDLE_LIBRARY_PATHS} "${BUNDLE_PATH}/Contents/MacOS/plugins" "${BUNDLE_PATH}/Contents/Frameworks")
message(STATUS "Fixing up application bundle: ${extra_dirs}")
# BundleUtilities is overly verbose, so disable most of its messages
@@ -55,7 +53,8 @@ message(STATUS "Fixing up application bundle: ${extra_dirs}")
include(BundleUtilities)
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle("${BUNDLE_PATH}" "${plugins};${plugin_libs}" "${extra_dirs}")
fixup_bundle("${BUNDLE_PATH}" "${plugins}" "${extra_dirs}")
if (CODE_SIGN_CERTIFICATE_ID)
# Hack around Apple Silicon signing bugs by copying the real app, signing it and moving it back.
@@ -67,4 +66,13 @@ if (CODE_SIGN_CERTIFICATE_ID)
endif()
# Add a necessary rpath to the imhex binary
get_bundle_main_executable("${BUNDLE_PATH}" IMHEX_EXECUTABLE)
get_bundle_main_executable("${BUNDLE_PATH}" IMHEX_EXECUTABLE)
file(GLOB_RECURSE plugin_libs "${BUNDLE_PATH}/Contents/MacOS/*.hexpluglib")
foreach(plugin_lib ${plugin_libs})
get_filename_component(plugin_lib_name ${plugin_lib} NAME)
set(plugin_lib_dest "${BUNDLE_PATH}/Contents/MacOS/plugins/${plugin_lib_name}")
configure_file(${plugin_lib} "${plugin_lib_dest}" COPYONLY)
message(STATUS "Copying plugin library: ${plugin_lib} to ${plugin_lib_dest}")
endforeach ()

View File

@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.20)
project(ImHexSDK)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "" FORCE)
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/build_helpers.cmake")
set(IMHEX_BASE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
@@ -9,35 +10,58 @@ include(ImHexPlugin)
function(add_subdirectory_if_exists folder)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${folder}/CMakeLists.txt")
add_subdirectory("${folder}")
add_subdirectory("${folder}" EXCLUDE_FROM_ALL)
endif()
endfunction()
set(IMHEX_EXTERNAL_PLUGIN_BUILD ON PARENT_SCOPE)
set(IMHEX_EXTERNAL_PLUGIN_BUILD ON)
add_custom_target(imhex_all)
add_subdirectory(lib/third_party/imgui)
add_subdirectory(lib/third_party/imgui EXCLUDE_FROM_ALL)
set(FMT_INSTALL OFF CACHE BOOL "" FORCE)
add_subdirectory_if_exists(lib/third_party/fmt)
set(FMT_LIBRARIES fmt::fmt-header-only PARENT_SCOPE)
set(FMT_LIBRARIES fmt::fmt-header-only)
add_subdirectory_if_exists(lib/third_party/nlohmann_json)
set(NLOHMANN_JSON_LIBRARIES nlohmann_json PARENT_SCOPE)
set(NLOHMANN_JSON_LIBRARIES nlohmann_json)
add_subdirectory(lib/external/libwolv)
add_subdirectory_if_exists(lib/third_party/boost)
set(BOOST_LIBRARIES boost::regex PARENT_SCOPE)
set(BOOST_LIBRARIES boost::regex)
set(LIBPL_BUILD_CLI_AS_EXECUTABLE OFF)
add_subdirectory(lib/external/pattern_language)
add_subdirectory(lib/external/libwolv EXCLUDE_FROM_ALL)
set(LIBPL_ENABLE_CLI OFF CACHE BOOL "" FORCE)
add_subdirectory(lib/external/pattern_language EXCLUDE_FROM_ALL)
add_subdirectory(lib/libimhex)
add_subdirectory(lib/trace)
if (WIN32)
set_target_properties(libimhex PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex.dll"
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/../libimhex.dll"
IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/lib/liblibimhex.dll.a"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex/include")
set_target_properties(tracing PROPERTIES
IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/lib/libtracing.a"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/trace/include")
elseif (APPLE)
file(GLOB LIBIMHEX_DYLIB "${CMAKE_CURRENT_SOURCE_DIR}/../../Frameworks/libimhex.*.dylib")
set_target_properties(libimhex PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex.dylib"
IMPORTED_LOCATION "${LIBIMHEX_DYLIB}"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex/include")
set_target_properties(tracing PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/../libtracing.a"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/trace/include")
else()
set_target_properties(libimhex PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex.so"
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/../libimhex.so"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex/include")
set_target_properties(tracing PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/../libtracing.a"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/trace/include")
endif()

View File

@@ -0,0 +1,60 @@
# ImHex Plugin Template
# =====================
# This is the official CMake template for making your own ImHex plugins
# To use this template, copy the file into its own directory and modify it to your needs
# For the most part, this is a regular CMake project with some extra functions provided by the ImHex SDK
#
# [NOTE FOR NON-C++ PLUGINS]
# The template is laid out for a C++ plugin, however you can write your plugin in any language you want
# and just make the plugin statically link against your code. The only thing that's required is a .cpp file with
# the IMHEX_PLUGIN_SETUP() macro used in it. This macro is used to setup the plugin and register it with ImHex
#
# [CMAKE FUNCTIONS]
# add_imhex_plugin(): Registers a new plugin
# NAME: The name of the plugin
# IMHEX_VERSION: The ImHex version this plugin is compatible with. If unset, the plugin will be loaded on all versions (this may not work though)
# SOURCES: Source files of the plugin
# INCLUDES: Include directories of the plugin
# LIBRARIES: Libraries to link against
# FEATURES: Optional features that can be enabled or disabled
# LIBRARY_PLUGIN: If set, turns this plugin into a library plugin. Library plugins can be linked against by other plugins
#
# add_romfs_resource(filePath romfsPath): Adds a file to the romfs of the plugin
# The RomFS is a virtual filesystem whose files can be accessed by the plugin using the functions in the `romfs::` namespace
# This function is used to add a single file to the romfs. You can however also simply create a `romfs` directory in your plugin directory and place your files and folders in there
# filePath: The path to the file on the disk
# romfsPath: The path to the file in the romfs
#
# enable_plugin_feature(feature): Enables a plugin feature
# Features are optional parts of the plugin that may or may not be available depending on build settings
# When a feature is enabled, `IMHEX_FEATURE_ENABLED(feature)` will be defined to true. Otherwise, it will be defined to false
# Use the `IMHEX_PLUGIN_FEATURES` macro in the main plugin file to define names to each feature and have them be listed in the plugin list
# feature: The name of the feature to enable
cmake_minimum_required(VERSION 3.20)
project(ImHexPlugin)
# Include the ImHex SDK
# For this to work, you need to set the IMHEX_SDK_PATH environment variable to the path of the ImHex SDK
#
# On Windows, the SDK is next to the ImHex executable
# On Linux, the SDK is usually in /usr/share/imhex/sdk but this may vary depending on your distribution
# On MacOS, the SDK is located inside of the ImHex.app bundle under ImHex.app/Contents/Resources/sdk
if (NOT EXISTS $ENV{IMHEX_SDK_PATH})
message(FATAL_ERROR "The IMHEX_SDK_PATH environment variable is not set")
endif()
add_subdirectory($ENV{IMHEX_SDK_PATH} ImHexSDK)
# Register the plugin
# This will configure everything you need to make your plugin work
# Modify the arguments to your needs. Right now it defines a plugin called `example_plugin`
# with a single source file called `example_plugin.cpp` in the `source` directory
# By default you have access to the libimhex library to interact with ImHex
# as well as libwolv, libromfs, libfmt and ImGui, but you can link against any libraries you want
add_imhex_plugin(
NAME
example_plugin
SOURCES
source/example_plugin.cpp
)

View File

@@ -0,0 +1,11 @@
#include <hex/plugin.hpp>
// Browse through the headers in lib/libimhex/include/hex/api/ to see what you can do with the API.
// Most important ones are <hex/api/imhex_api.hpp> and <hex/api/content_registry.hpp>
// This is the main entry point of your plugin. The code in the body of this construct will be executed
// when ImHex starts up and loads the plugin.
// The strings in the header are used to display information about the plugin in the UI.
IMHEX_PLUGIN_SETUP("Example Plugin", "Author", "Description") {
// Put your init code here
}

View File

@@ -11,31 +11,23 @@ AppDir:
exec_args: $@
apt:
arch:
- amd64
- "{{ARCHITECTURE_PACKAGE}}"
allow_unauthenticated: true
sources:
- sourceline: deb http://us.archive.ubuntu.com/ubuntu/ jammy main restricted
- sourceline: deb http://us.archive.ubuntu.com/ubuntu/ jammy-updates main restricted
- sourceline: deb http://us.archive.ubuntu.com/ubuntu/ jammy universe
- sourceline: deb http://us.archive.ubuntu.com/ubuntu/ jammy-updates universe
- sourceline: deb http://us.archive.ubuntu.com/ubuntu/ jammy multiverse
- sourceline: deb http://us.archive.ubuntu.com/ubuntu/ jammy-updates multiverse
- sourceline: deb http://us.archive.ubuntu.com/ubuntu/ jammy-backports main restricted
universe multiverse
- sourceline: deb http://security.ubuntu.com/ubuntu jammy-security main restricted
- sourceline: deb http://security.ubuntu.com/ubuntu jammy-security universe
- sourceline: deb http://security.ubuntu.com/ubuntu jammy-security multiverse
- sourceline: 'deb [arch=amd64] http://us.archive.ubuntu.com/ubuntu/ oracular main restricted universe multiverse'
- sourceline: 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ oracular main restricted universe multiverse'
include:
- librsvg2-common
- libbz2-1.0:amd64
- libcap2:amd64
- libdbus-1-3:amd64
- libgpg-error0:amd64
- liblzma5:amd64
- libnss-mdns:amd64
- libpcre3:amd64
- libselinux1:amd64
- libtinfo6:amd64
- libbz2-1.0
- libcap2
- libdbus-1-3
- libfontconfig1
- libgpg-error0
- liblzma5
- libnss-mdns
- libpcre3
- libselinux1
- libtinfo6
files:
include:
- /lib/x86_64-linux-gnu/libLLVM-13.so.1
@@ -132,6 +124,6 @@ AppDir:
- usr/share/doc/*/NEWS.*
- usr/share/doc/*/TODO.*
AppImage:
arch: x86_64
update-information: gh-releases-zsync|WerWolv|ImHex|latest|imhex-*-x86_64.AppImage.zsync
file_name: imhex-{{VERSION}}-x86_64.AppImage
arch: "{{ARCHITECTURE_APPIMAGE_BUILDER}}"
update-information: gh-releases-zsync|WerWolv|ImHex|latest|imhex-*-{{ARCHITECTURE_FILE_NAME}}.AppImage.zsync
file_name: imhex-{{VERSION}}-{{ARCHITECTURE_FILE_NAME}}.AppImage

View File

@@ -1,4 +1,4 @@
FROM ubuntu:22.04 as build
FROM ubuntu:24.10 as build
# Used to invalidate layer cache but not mount cache
# See https://github.com/moby/moby/issues/41715#issuecomment-733976493
@@ -14,24 +14,13 @@ apt update
# general deps
apt install -y ccache git wget
# appimage tools deps
apt install -y python3-pip python3-setuptools desktop-file-utils libgdk-pixbuf2.0-dev fuse ninja-build
apt install -y python3-pip python3-venv python3-setuptools desktop-file-utils libgdk-pixbuf2.0-dev fuse ninja-build
apt install -y squashfs-tools zsync
# imhex deps
/tmp/get_deps_debian.sh
EOF
RUN --mount=type=cache,target=/cache <<EOF
# Download appimage-builder
set -xe
mkdir -p /cache/bin
wget -nc https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /cache/bin/appimagetool || true
chmod +x /cache/bin/appimagetool
pip3 install git+https://github.com/AppImageCrafters/appimage-builder@f38699e
EOF
ENV PATH="/cache/bin/:${PATH}"
# Copy Imhex source
@@ -41,19 +30,24 @@ ARG LTO=ON
ARG BUILD_TYPE=RelWithDebInfo
ARG GIT_COMMIT_HASH
ARG GIT_BRANCH
ARG ARCHITECTURE_PACKAGE
ARG ARCHITECTURE_FILE_NAME
ARG ARCHITECTURE_APPIMAGE_BUILDER
WORKDIR /build
SHELL ["bash", "-c"] # Ubuntu sh doesnt support string substitution
# Ubuntu sh doesnt support string substitution
SHELL ["bash", "-c"]
RUN <<EOF
# Prepare ImHex build
set -xe
CC=gcc-12 CXX=g++-12 cmake -G "Ninja" \
CC=gcc-14 CXX=g++-14 cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DIMHEX_PATTERNS_PULL_MASTER=ON \
-DIMHEX_COMMIT_HASH_SHORT="${GIT_COMMIT_HASH::7}" \
-DIMHEX_COMMIT_HASH_LONG="${GIT_COMMIT_HASH}" \
-DIMHEX_COMMIT_BRANCH="${GIT_BRANCH}" \
-DIMHEX_ENABLE_LTO=${LTO} \
@@ -72,11 +66,23 @@ ccache -s
EOF
RUN <<EOF
# Package ImHex as AppImage
# Download appimage-builder
set -xe
mkdir -p /cache/bin
wget -nc https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /cache/bin/appimagetool || true
chmod +x /cache/bin/appimagetool
python3 -m venv venv
. venv/bin/activate
pip3 install git+https://github.com/AppImageCrafters/appimage-builder@f38699e
# Package ImHex as AppImage
export VERSION=$(cat /imhex/VERSION)
appimage-builder --recipe /imhex/dist/AppImageBuilder.yml
export ARCHITECTURE_PACKAGE=${ARCHITECTURE_PACKAGE}
export ARCHITECTURE_FILE_NAME=${ARCHITECTURE_FILE_NAME}
export ARCHITECTURE_APPIMAGE_BUILDER=${ARCHITECTURE_APPIMAGE_BUILDER}
appimage-builder --recipe /imhex/dist/AppImage/AppImageBuilder.yml
EOF
FROM scratch

View File

@@ -13,6 +13,7 @@ RUN pacman -S --needed --noconfirm \
glfw-x11 \
file \
mbedtls \
fontconfig \
freetype2 \
curl \
dbus \

7
dist/Arch/PKGBUILD vendored
View File

@@ -8,8 +8,8 @@ pkgdesc="A Hex Editor for Reverse Engineers, Programmers and people who value th
arch=("x86_64")
url="https://github.com/WerWolv/ImHex"
license=('GPL2')
depends=(glfw mbedtls freetype2 libglvnd dbus gtk3 curl fmt yara nlohmann-json libarchive)
makedepends=(git)
depends=(glfw mbedtls fontconfig freetype2 libglvnd dbus gtk3 curl fmt yara zlib bzip2 xz zstd)
makedepends=(git nlohmann-json)
provides=(imhex)
conflicts=(imhex)
source=("$url/releases/download/v$pkgver/imhex-$pkgver-ArchLinux-x86_64.pkg.tar.zst")
@@ -17,6 +17,7 @@ md5sums=(SKIP)
package() {
install -Dm755 "$srcdir/usr/bin/imhex" "$pkgdir/usr/bin/imhex"
install -Dm755 "$srcdir/usr/bin/imhex-updater" "$pkgdir/usr/bin/imhex-updater"
install -Dm644 "$srcdir/usr/lib/libimhex.so.$pkgver" "$pkgdir/usr/lib/libimhex.so.$pkgver"
for plugin in "$srcdir/usr/lib/imhex/plugins/"*.hexplug*; do
@@ -25,5 +26,5 @@ package() {
install -d "$pkgdir/usr/share/imhex"
cp -r "$srcdir/usr/share/imhex/"{constants,encodings,includes,magic,patterns} "$pkgdir/usr/share/imhex"
cp -r "$srcdir/usr/share/"{applications,licenses,pixmaps} "$pkgdir/usr/share"
cp -r "$srcdir/usr/share/"{applications,licenses,pixmaps,mime} "$pkgdir/usr/share"
}

View File

@@ -4,7 +4,7 @@ Section: editors
Priority: optional
Architecture: amd64
License: GNU GPL-2
Depends: libglfw3 | libglfw3-wayland, libmagic1, libmbedtls14, libfreetype6, libopengl0, libdbus-1-3, xdg-desktop-portal, libarchive
Depends: libfontconfig1, libglfw3 | libglfw3-wayland, libmagic1, libmbedtls14, libfreetype6, libopengl0, libdbus-1-3, xdg-desktop-portal
Maintainer: WerWolv <hey@werwolv.net>
Description: ImHex Hex Editor
A Hex Editor for Reverse Engineers, Programmers and

View File

@@ -20,10 +20,15 @@ DEPEND=""
RDEPEND="${DEPEND}
media-libs/glfw
sys-apps/file
dev-libs/mbedtls
dev-cpp/nlohmann_json
dbus
xdg-desktop-portal
app-arch/libarchive
net-libs/mbedtls
sys-apps/dbus
sys-apps/xdg-desktop-portal
sys-libs/zlib
app-arch/bzip2
app-arch/lzma
app-arch/zstd
app-arch/lz4
"
BDEPEND="${DEPEND}
dev-cpp/nlohmann_json
"
BDEPEND="${DEPEND}"

View File

@@ -18,11 +18,11 @@ docker buildx build . -f <DOCKERFILE_PATH> --progress plain --build-arg 'JOBS=4'
where `<DOCKERFILE_PATH>` should be replaced by the wanted Dockerfile base d on the build you want to do:
| Wanted build | Dockerfile path |
|--------------|-----------------------------|
| MacOS M1 | dist/macOS/arm64.Dockerfile |
| AppImage | dist/appimage/Dockerfile |
| Web version | dist/web/Dockerfile |
| Wanted build | Dockerfile path | Target |
|--------------|-----------------------------|--------|
| MacOS M1 | dist/macOS/arm64.Dockerfile | - |
| AppImage | dist/appimage/Dockerfile | - |
| Web version | dist/web/Dockerfile | raw |
We'll explain this command in the next section
@@ -43,6 +43,7 @@ In the command saw earlier:
- `.` is the base folder that the Dockerfile will be allowed to see
- `-f <path>` is to specify the Dockerfile path
- `--progress plain` is to allow you to see the output of instructions
- `--build-arg <key>=<value>` is to allow to to specify arguments to the build (like -DKEY=VALUE in CMake)
- `--build-arg <key>=<value>` is to allow to specify arguments to the build (like -DKEY=VALUE in CMake)
- `--build-context key=<folder>` is to specify folders other than the base folder that the Dockerfile is allowed to see
- `--output <path>` is the path to write the output package to. If not specified, Docker will create an image as the output (probably not what you want)
- `--target <target>` specifies which docker target to build

View File

@@ -9,17 +9,12 @@ On Linux, ImHex is built through regular GCC (or optionally Clang).
cd ImHex
mkdir -p build
cd build
CC=gcc-12 CXX=g++-12 cmake \
CC=gcc-14 CXX=g++-14 \
cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_FLAGS="-fuse-ld=lld" \
-DCMAKE_CXX_FLAGS="-fuse-ld=lld" \
-DCMAKE_OBJC_COMPILER_LAUNCHER=ccache \
-DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_INSTALL_PREFIX="/usr" \
..
make -j 4 install
ninja install
```
All paths follow the XDG Base Directories standard, and can thus be modified

View File

@@ -3,29 +3,20 @@
On macOS, ImHex is built through regular GCC and LLVM clang.
1. Clone the repo using `git clone https://github.com/WerWolv/ImHex --recurse-submodules`
2. Install all the dependencies using `brew bundle --no-lock --file dist/Brewfile`
2. Install all the dependencies using `brew bundle --no-lock --file dist/macOS/Brewfile`
3. Build ImHex itself using the following commands:
```sh
cd ImHex
mkdir -p build
cd build
CC=$(brew --prefix gcc@12)/bin/gcc-12 \
CXX=$(brew --prefix gcc@12)/bin/g++-12 \
CC=$(brew --prefix llvm)/bin/clang \
CXX=$(brew --prefix llvm)/bin/clang++ \
OBJC=$(brew --prefix llvm)/bin/clang \
OBJCXX=$(brew --prefix llvm)/bin/clang++ \
PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig":"$(brew --prefix)/lib/pkgconfig" \
MACOSX_DEPLOYMENT_TARGET="10.15" \
cmake \
cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="./install" \
-DIMHEX_GENERATE_PACKAGE=ON \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_OBJC_COMPILER_LAUNCHER=ccache \
-DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \
..
make -j4 package
ninja install
```
If the build fails while trying to find the macOS libraries, make sure you have
Xcode installed with `xcode-select --install`. Homebrew will also help get the
most recent SDK installed and configured with `brew doctor`.

View File

@@ -14,7 +14,7 @@ mkdir build
cd build
cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$PWD/install" \
-DCMAKE_INSTALL_PREFIX="./install" \
-DIMHEX_USE_DEFAULT_BUILD_SETTINGS=ON \
..
ninja install

54
dist/gen_release_notes.py vendored Normal file
View File

@@ -0,0 +1,54 @@
import subprocess
import sys
def get_commits(branch: str, start_tag: str, end_tag: str) -> list[str]:
try:
commits_raw = subprocess.check_output([ "git", "--no-pager", "log", branch, "--no-color", "--pretty=oneline", "--abbrev-commit", f"{start_tag}..{end_tag}"], stderr=subprocess.DEVNULL).decode("UTF-8").split("\n")
except:
return []
commits = []
for line in commits_raw:
commits.append(line[9:])
return commits
def main(args: list) -> int:
if len(args) != 2:
print(f"Usage: {args[0]} prev_minor")
return 1
last_minor_version = f"v1.{args[1]}"
master_commits = get_commits("master", f"{last_minor_version}.0", "master")
for i in range(1, 100):
branch_commits = get_commits(f"releases/{last_minor_version}.X", f"{last_minor_version}.0", f"{last_minor_version}.{i}")
if len(branch_commits) == 0:
break
master_commits = [commit for commit in master_commits if commit not in branch_commits]
sorted_commits = {}
for commit in master_commits:
if commit == "":
continue
try:
category, commit_name = commit.split(":", 1)
if category not in sorted_commits:
sorted_commits[category] = []
sorted_commits[category].append(commit_name)
except:
print(f"Failed to parse commit: {commit}")
for category in sorted_commits:
print(f"## {category}\n")
for commit in sorted_commits[category]:
print(f"- {commit}")
print(f"\n")
if __name__ == "__main__":
exit(main(sys.argv))

View File

@@ -5,6 +5,7 @@ pacman -S $@ --needed \
gcc \
lld \
glfw \
fontconfig \
file \
mbedtls \
freetype2 \
@@ -15,4 +16,8 @@ pacman -S $@ --needed \
yara \
nlohmann-json \
ninja \
libarchive
zlib \
bzip2 \
xz \
zstd \
lz4

View File

@@ -8,8 +8,8 @@ fi
apt install -y \
build-essential \
gcc-12 \
g++-12 \
gcc-14 \
g++-14 \
lld \
${PKGCONF:-} \
cmake \
@@ -18,9 +18,14 @@ apt install -y \
libglm-dev \
libmagic-dev \
libmbedtls-dev \
libfontconfig-dev \
libfreetype-dev \
libdbus-1-dev \
libcurl4-gnutls-dev \
libgtk-3-dev \
ninja-build \
libarchive-dev
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libzstd-dev \
liblz4-dev

View File

@@ -4,6 +4,7 @@ dnf install -y \
cmake \
dbus-devel \
file-devel \
fontconfig-devel \
freetype-devel \
libcurl-devel \
gcc-c++ \
@@ -13,4 +14,8 @@ dnf install -y \
lld \
mbedtls-devel \
gtk3-devel \
libarchive-devel
libzstd-devel \
zlib-devel \
bzip2-devel \
xz-devel \
lz4-devel

View File

@@ -1,16 +1,21 @@
#!/usr/bin/env sh
pacman -S --needed --noconfirm \
mingw-w64-x86_64-gcc \
mingw-w64-x86_64-lld \
mingw-w64-x86_64-cmake \
mingw-w64-x86_64-ccache \
mingw-w64-x86_64-glfw \
mingw-w64-x86_64-file \
mingw-w64-x86_64-curl-winssl \
mingw-w64-x86_64-mbedtls \
mingw-w64-x86_64-freetype \
mingw-w64-x86_64-dlfcn \
mingw-w64-x86_64-ninja \
mingw-w64-x86_64-capstone \
mingw-w64-x86_64-libarchive
pacman -S --needed --noconfirm pactoys unzip
pacboy -S --needed --noconfirm \
gcc:p \
lld:p \
cmake:p \
ccache:p \
glfw:p \
file:p \
curl-winssl:p \
mbedtls:p \
freetype:p \
dlfcn:p \
ninja:p \
capstone:p \
zlib:p \
bzip2:p \
xz:p \
zstd:p \
lz4:p

21
dist/get_deps_tumbleweed.sh vendored Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env sh
zypper install \
cmake \
ninja \
gcc14 \
gcc14-c++ \
fontconfig-devel \
freetype2-devel \
libcurl-devel \
dbus-1-devel \
file-devel \
Mesa-libGL-devel \
libglfw-devel \
mbedtls-devel \
gtk3-devel \
libzstd-devel \
zlib-devel \
bzip3-devel \
xz-devel \
lz4-dev

8
dist/imhex.desktop vendored
View File

@@ -1,4 +1,5 @@
[Desktop Entry]
Version=1.0
Name=ImHex
Comment=ImHex Hex Editor
GenericName=Hex Editor
@@ -8,3 +9,10 @@ Type=Application
StartupNotify=true
Categories=Development;IDE;
StartupWMClass=imhex
Keywords=static-analysis;reverse-engineering;disassembler;disassembly;hacking;forensics;hex-editor;cybersecurity;security;binary-analysis;
MimeType=application/vnd.imhex.proj;
Actions=NewFile;
[Desktop Action NewFile]
Exec=imhex --new
Name=Create New File

8
dist/imhex.mime.xml vendored Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/vnd.imhex.proj">
<comment>ImHex Project</comment>
<glob pattern="*.hexproj"/>
</mime-type>
</mime-info>

244
dist/langtool.py vendored Normal file → Executable file
View File

@@ -1,104 +1,214 @@
#!/usr/bin/env python3
from pathlib import Path
import sys
import argparse
import json
# This fixes a CJK full-width character input issue
# which makes left halves of deleted characters displayed on screen
# pylint: disable=unused-import
import re
import readline
DEFAULT_LANG = "en_US"
DEFAULT_LANG_PATH = "plugins/*/romfs/lang/"
INVALID_TRANSLATION = ""
def handle_missing_key(command, lang_data, key, value):
if command == "check":
print(f"Error: Translation {lang_data['code']} is missing translation for key '{key}'")
exit(2)
elif command == "translate" or command == "create":
print(f"Key \033[1m'{key}': '{value}'\033[0m is missing in translation '{lang_data['code']}'")
new_value = input("Enter translation: ")
lang_data["translations"][key] = new_value
elif command == "update":
lang_data["translations"][key] = INVALID_TRANSLATION
def main():
if len(sys.argv) < 3:
print(f"Usage: {Path(sys.argv[0]).name} <check|translate|update|create> <lang folder path> <language>")
parser = argparse.ArgumentParser(
prog="langtool",
description="ImHex translate tool",
)
parser.add_argument(
"command",
choices=[
"check",
"translate",
"update",
"create",
"retranslate",
"untranslate",
"fmtzh",
],
)
parser.add_argument(
"-c", "--langdir", default=DEFAULT_LANG_PATH, help="Language folder glob"
)
parser.add_argument("-l", "--lang", default="", help="Language to translate")
parser.add_argument(
"-r", "--reflang", default="", help="Language for reference when translating"
)
parser.add_argument(
"-k", "--keys", help="Keys to re-translate (only in re/untranslate mode)"
)
args = parser.parse_args()
command = args.command
lang = args.lang
print(f"Running in {command} mode")
lang_files_glob = f"{lang}.json" if lang != "" else "*.json"
lang_folders = set(Path(".").glob(args.langdir))
if len(lang_folders) == 0:
print(f"Error: {args.langdir} matches nothing")
return 1
command = sys.argv[1]
if command not in ["check", "translate", "update", "create"]:
print(f"Unknown command: {command}")
return 1
for lang_folder in lang_folders:
if not lang_folder.is_dir():
print(f"Error: {lang_folder} is not a folder")
return 1
print(f"Using langtool in {command} mode")
default_lang_data = {}
default_lang_path = lang_folder / Path(DEFAULT_LANG + ".json")
if not default_lang_path.exists():
print(
f"Error: Default language file {default_lang_path} does not exist in {lang_folder}"
)
return 1
with default_lang_path.open("r", encoding="utf-8") as file:
default_lang_data = json.load(file)
lang_folder_path = Path(sys.argv[2])
if not lang_folder_path.exists():
print(f"Error: {lang_folder_path} does not exist")
return 1
if not lang_folder_path.is_dir():
print(f"Error: {lang_folder_path} is not a folder")
return 1
lang = sys.argv[3] if len(sys.argv) > 3 else ""
print(f"Processing language files in {lang_folder_path}...")
default_lang_file_path = lang_folder_path / Path(DEFAULT_LANG + ".json")
if not default_lang_file_path.exists():
print(f"Error: Default language file {default_lang_file_path} does not exist")
return 1
print(f"Using file '{default_lang_file_path.name}' as template language file")
with default_lang_file_path.open("r", encoding="utf-8") as default_lang_file:
default_lang_data = json.load(default_lang_file)
reference_lang_data = None
reference_lang_path = lang_folder / Path(args.reflang + ".json")
if reference_lang_path.exists():
with reference_lang_path.open("r", encoding="utf-8") as file:
reference_lang_data = json.load(file)
if command == "create" and lang != "":
lang_file_path = lang_folder_path / Path(lang + ".json")
lang_file_path = lang_folder / Path(lang + ".json")
if lang_file_path.exists():
print(f"Error: Language file {lang_file_path} already exists")
return 1
continue
print(f"Creating new language file '{lang_file_path.name}'")
exist_lang_data = None
for lang_folder1 in lang_folders:
lang_file_path1 = lang_folder1 / Path(lang + ".json")
if lang_file_path1.exists():
with lang_file_path1.open("r", encoding="utf-8") as file:
exist_lang_data = json.load(file)
break
print(f"Creating new language file '{lang_file_path}'")
with lang_file_path.open("w", encoding="utf-8") as new_lang_file:
new_lang_data = {
"code": lang,
"language": input("Enter language: "),
"country": input("Enter country: "),
"translations": {}
"language": (
exist_lang_data["language"]
if exist_lang_data
else input("Enter language name: ")
),
"country": (
exist_lang_data["country"]
if exist_lang_data
else input("Enter country name: ")
),
"translations": {},
}
json.dump(new_lang_data, new_lang_file, indent=4, ensure_ascii=False)
for additional_lang_file_path in lang_folder_path.glob("*.json"):
if not lang == "" and not additional_lang_file_path.stem == lang:
lang_files = set(lang_folder.glob(lang_files_glob))
if len(lang_files) == 0:
print(f"Warn: Language file for '{lang}' does not exist in '{lang_folder}'")
for lang_file_path in lang_files:
if (
lang_file_path.stem == f"{DEFAULT_LANG}.json"
or lang_file_path.stem == f"{args.reflang}.json"
):
continue
if additional_lang_file_path.name.startswith(DEFAULT_LANG):
continue
print(f"\nProcessing '{lang_file_path}'")
if not (command == "update" or command == "create"):
print("\n----------------------------\n")
print(f"\nProcessing file '{additional_lang_file_path.name}'\n----------------------------\n")
with additional_lang_file_path.open("r+", encoding="utf-8") as additional_lang_file:
additional_lang_data = json.load(additional_lang_file)
with lang_file_path.open("r+", encoding="utf-8") as target_lang_file:
lang_data = json.load(target_lang_file)
for key, value in default_lang_data["translations"].items():
if key not in additional_lang_data["translations"] or additional_lang_data["translations"][key] == INVALID_TRANSLATION:
handle_missing_key(command, additional_lang_data, key, value)
has_translation = (
key in lang_data["translations"]
and lang_data["translations"][key] != INVALID_TRANSLATION
)
if (
has_translation
and not (
(command == "retranslate" or command == "untranslate")
and re.compile(args.keys).fullmatch(key)
)
and not command == "fmtzh"
):
continue
if command == "check":
print(
f"Error: Translation {lang_data['code']} is missing translation for key '{key}'"
)
elif (
command == "translate"
or command == "retranslate"
or command == "untranslate"
):
if command == "untranslate" and not has_translation:
continue
reference_tranlsation = (
" '%s'" % reference_lang_data["translations"][key]
if (
reference_lang_data
and key in reference_lang_data["translations"]
)
else ""
)
print(
f"\033[1m'{key}' '{value}'{reference_tranlsation}\033[0m => {lang_data['language']}",
end="",
)
if has_translation:
translation = lang_data["translations"][key]
print(f" <= \033[1m'{translation}'\033[0m")
print() # for a new line
if command == "untranslate":
lang_data["translations"][key] = INVALID_TRANSLATION
continue
try:
new_value = input("=> ")
lang_data["translations"][key] = new_value
except KeyboardInterrupt:
break
elif command == "update" or command == "create":
lang_data["translations"][key] = INVALID_TRANSLATION
elif command == "fmtzh":
if has_translation:
lang_data["translations"][key] = fmtzh(
lang_data["translations"][key]
)
keys_to_remove = []
for key, value in additional_lang_data["translations"].items():
for key, value in lang_data["translations"].items():
if key not in default_lang_data["translations"]:
keys_to_remove.append(key)
for key in keys_to_remove:
additional_lang_data["translations"].pop(key)
print(f"Removed unused key '{key}' from translation '{additional_lang_data['code']}'")
lang_data["translations"].pop(key)
print(
f"Removed unused key '{key}' from translation '{lang_data['code']}'"
)
additional_lang_file.seek(0)
additional_lang_file.truncate()
json.dump(additional_lang_data, additional_lang_file, indent=4, sort_keys=True, ensure_ascii=False)
target_lang_file.seek(0)
target_lang_file.truncate()
json.dump(
lang_data,
target_lang_file,
indent=4,
sort_keys=True,
ensure_ascii=False,
)
if __name__ == '__main__':
def fmtzh(text: str) -> str:
text = re.sub(r"(\.{3}|\.{6})", "……", text)
text = text.replace("!", "")
text = re.sub(r"([^\.\na-zA-Z\d])\.$", "\1", text, flags=re.M)
text = text.replace("?", "")
return text
if __name__ == "__main__":
exit(main())

View File

@@ -6,8 +6,10 @@ brew "freetype2"
brew "libmagic"
brew "pkg-config"
brew "curl"
brew "gcc@12"
brew "llvm"
brew "glfw"
brew "ninja"
brew "libarchive"
brew "zlib"
brew "xz"
brew "bzip2"
brew "zstd"

View File

@@ -1,10 +1,21 @@
# This base image is also known as "crosscompile". See arm64.crosscompile.Dockerfile
FROM ghcr.io/itrooz/macos-crosscompile:clang17-nosdk as build
FROM ghcr.io/itrooz/macos-crosscompile:clang19-nosdk as build
ENV MACOSX_DEPLOYMENT_TARGET 12.1
ENV MACOSX_DEPLOYMENT_TARGET 13.0
# -- DOWNLOADING STUFF
# Update vcpkg
RUN <<EOF
cp /vcpkg/triplets/community/arm-osx-mytriplet.cmake /tmp/arm-osx-mytriplet.cmake
git -C /vcpkg clean -ffdx
git -C /vcpkg checkout origin/master
git -C /vcpkg reset --hard
git -C /vcpkg pull
/vcpkg/bootstrap-vcpkg.sh
cp /tmp/arm-osx-mytriplet.cmake /vcpkg/triplets/community/arm-osx-mytriplet.cmake
EOF
## Install make
RUN --mount=type=cache,target=/var/lib/apt/lists/ apt update && apt install -y make
@@ -35,9 +46,9 @@ EOF
## Download libmagic
### Clone libmagic
RUN git clone https://github.com/file/file /mnt/file
RUN git clone --depth 1 --branch FILE5_46 https://github.com/file/file /mnt/file
### Download libmagic dependencies
RUN --mount=type=cache,target=/var/lib/apt/lists/ apt install -y libtool autoconf
RUN --mount=type=cache,target=/var/lib/apt/lists/ apt update && apt install -y libtool autoconf
# -- DOWNLOADING + BUILDING STUFF
@@ -52,7 +63,10 @@ vcpkg install --triplet=arm-osx-mytriplet curl
vcpkg install --triplet=arm-osx-mytriplet mbedtls
vcpkg install --triplet=arm-osx-mytriplet freetype
vcpkg install --triplet=arm-osx-mytriplet josuttis-jthread
vcpkg install --triplet=arm-osx-mytriplet libarchive
vcpkg install --triplet=arm-osx-mytriplet zlib
vcpkg install --triplet=arm-osx-mytriplet bzip2
vcpkg install --triplet=arm-osx-mytriplet liblzma
vcpkg install --triplet=arm-osx-mytriplet zstd
EOF
## Install glfw3 dep
@@ -103,6 +117,9 @@ if [ "$CUSTOM_GLFW" ]; then
fi
EOF
RUN mkdir -p /vcpkg/installed/arm-osx-mytriplet/lib/pkgconfig
RUN mkdir -p /osxcross/target/macports/pkgs/vcpkg/installed/arm-osx-mytriplet/lib/pkgconfig
## Build glfw
RUN --mount=type=cache,target=/cache <<EOF
set -xe
@@ -112,7 +129,7 @@ if [ "$CUSTOM_GLFW" ]; then
cd /mnt/glfw
mkdir build
cd build
CC=o64-gcc CXX=o64-g++ cmake -G "Ninja" \
CC=o64-clang CXX=o64-clang++ cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
@@ -120,7 +137,7 @@ if [ "$CUSTOM_GLFW" ]; then
-DCMAKE_OBJC_COMPILER_LAUNCHER=ccache \
-DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_INSTALL_PREFIX=/vcpkg/installed/arm-osx-mytriplet \
-DVCPKG_TARGET_TRIPLET=arm-osx-mytriplet -DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/osxcross/target/toolchain.cmake -DCMAKE_OSX_SYSROOT=/osxcross/target/SDK/MacOSX14.0.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
-DVCPKG_TARGET_TRIPLET=arm-osx-mytriplet -DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/osxcross/target/toolchain.cmake -DCMAKE_OSX_SYSROOT=/osxcross/target/SDK/MacOSX14.0.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 \
..
ninja -j $JOBS install
@@ -142,13 +159,14 @@ RUN --mount=type=cache,target=/cache --mount=type=cache,target=/mnt/ImHex/build/
`# ccache flags` \
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_OBJC_COMPILER_LAUNCHER=ccache -DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \
`# MacOS cross-compiling flags` \
-DVCPKG_TARGET_TRIPLET=arm-osx-mytriplet -DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/osxcross/target/toolchain.cmake -DCMAKE_OSX_SYSROOT=/osxcross/target/SDK/MacOSX14.0.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
-DVCPKG_TARGET_TRIPLET=arm-osx-mytriplet -DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/osxcross/target/toolchain.cmake -DCMAKE_OSX_SYSROOT=/osxcross/target/SDK/MacOSX14.0.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 \
`# Override compilers for code generators` \
-DNATIVE_CMAKE_C_COMPILER=/usr/bin/clang -DNATIVE_CMAKE_CXX_COMPILER=/usr/bin/clang++ \
`# Normal ImHex flags` \
-DIMHEX_GENERATE_PACKAGE=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
`# other flags` \
-DIMHEX_STRICT_WARNINGS=OFF \
-DCMAKE_INSTALL_PREFIX=/mnt/ImHex/build/install \
-B build
## Build ImHex
RUN --mount=type=cache,target=/cache --mount=type=cache,target=/mnt/ImHex/build/_deps <<EOF
@@ -156,11 +174,11 @@ RUN --mount=type=cache,target=/cache --mount=type=cache,target=/mnt/ImHex/build/
set -xe
cd /mnt/ImHex
cmake --build build --parallel $JOBS
cmake --build build --parallel $JOBS --target install
ccache -s
EOF
FROM scratch
COPY --from=build /mnt/ImHex/build/imhex.app imhex.app
COPY --from=build /mnt/ImHex/build/install/imhex.app imhex.app

View File

@@ -1,4 +1,4 @@
# This image is is provided for reference, but a (probably more up to date) image should be available at https://github.com/iTrooz/macos-crosscompile
# This image is provided for reference, but a (probably more up to date) image should be available at https://github.com/iTrooz/macos-crosscompile
FROM ubuntu:22.04
ENV PATH $PATH:/osxcross/target/bin
@@ -68,19 +68,6 @@ RUN --mount=type=cache,target=/cache <<EOF
ccache -s
EOF
# Not needed, because we don't use gcc for cross-compiling anymore
# ## Install dependencies for gcc-13
# RUN apt install -y gcc g++ zlib1g-dev libmpc-dev libmpfr-dev libgmp-dev
# ## Build cross-compiler gcc-13
# RUN --mount=type=cache,target=/cache <<EOF
# set -xe
# ccache -zs
# cd /osxcross
# UNATTENDED=1 CC=/usr/lib/ccache/gcc CXX=/usr/lib/ccache/g++ GCC_VERSION=13.2.0 ./build_gcc.sh
# ccache -s
# EOF
ARG DELETE_SDK=1
RUN <<EOF

5
dist/msys2/PKGBUILD vendored
View File

@@ -17,7 +17,10 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-mbedtls"
"${MINGW_PACKAGE_PREFIX}-polly"
"${MINGW_PACKAGE_PREFIX}-freetype"
"${MINGW_PACKAGE_PREFIX}-libarchive")
"${MINGW_PACKAGE_PREFIX}-zlib"
"${MINGW_PACKAGE_PREFIX}-bzip2"
"${MINGW_PACKAGE_PREFIX}-xz"
"${MINGW_PACKAGE_PREFIX}-zstd")
source=()
sha256sums=()

37
dist/rpm/imhex.spec vendored
View File

@@ -1,5 +1,7 @@
%define source_date_epoch_from_changelog 0
Name: imhex
Version: 1.26.2
Version: VERSION
Release: 0%{?dist}
Summary: A hex editor for reverse engineers and programmers
@@ -14,6 +16,7 @@ BuildRequires: cmake
BuildRequires: desktop-file-utils
BuildRequires: dbus-devel
BuildRequires: file-devel
BuildRequires: fontconfig-devel
BuildRequires: freetype-devel
BuildRequires: fmt-devel
BuildRequires: gcc-c++
@@ -26,10 +29,13 @@ BuildRequires: llvm-devel
BuildRequires: mbedtls-devel
BuildRequires: yara-devel
BuildRequires: nativefiledialog-extended-devel
BuildRequires: dotnet-sdk-7.0
BuildRequires: libarchive-devel
BuildRequires: dotnet-sdk-8.0
BuildRequires: libzstd-devel
BuildRequires: zlib-devel
BuildRequires: bzip2-devel
BuildRequires: xz-devel
%if 0%{?rhel}
BuildRequires: gcc-toolset-12
BuildRequires: gcc-toolset-14
%endif
Provides: bundled(gnulib)
@@ -37,7 +43,6 @@ Provides: bundled(capstone) = 5.0-rc2
Provides: bundled(imgui)
Provides: bundled(libromfs)
Provides: bundled(microtar)
Provides: bundled(libpl)
Provides: bundled(xdgpp)
# ftbfs on these arches. armv7hl might compile when capstone 5.x
@@ -66,9 +71,9 @@ rm -rf lib/third_party/{fmt,nlohmann_json,yara}
%build
%if 0%{?rhel}
. /opt/rh/gcc-toolset-12/enable
. /opt/rh/gcc-toolset-14/enable
%set_build_flags
CXXFLAGS+=" -std=gnu++2b"
CXXFLAGS+=" -std=gnu++23"
%endif
%cmake \
-D CMAKE_BUILD_TYPE=Release \
@@ -89,14 +94,10 @@ CXXFLAGS+=" -std=gnu++2b"
%check
%if 0%{?rhel}
. /opt/rh/gcc-toolset-12/enable
. /opt/rh/gcc-toolset-14/enable
%set_build_flags
CXXFLAGS+=" -std=gnu++2b"
CXXFLAGS+=" -std=gnu++23"
%endif
# build binaries required for tests
%cmake_build --target unit_tests
%ctest --exclude-regex '(Helpers/StoreAPI|Helpers/TipsAPI|Helpers/ContentAPI)'
# Helpers/*API exclude tests that require network access
%install
@@ -121,11 +122,11 @@ cp -a lib/third_party/xdgpp/LICENSE %{buildroot
%license %{_datadir}/licenses/%{name}/
%doc README.md
%{_bindir}/imhex
%{_datadir}/pixmaps/%{name}.png
%{_bindir}/imhex-updater
%{_datadir}/pixmaps/%{name}.svg
%{_datadir}/applications/%{name}.desktop
%{_datadir}/mime/packages/%{name}.xml
%{_libdir}/libimhex.so*
%{_libdir}/%{name}/
%{_metainfodir}/net.werwolv.%{name}.metainfo.xml
%changelog
/usr/lib/debug/%{_libdir}/*.debug
%{_metainfodir}/net.werwolv.%{name}.metainfo.xml

16
dist/vcpkg.json vendored Normal file
View File

@@ -0,0 +1,16 @@
{
"name": "vcpkg",
"version": "1.0.0",
"builtin-baseline": "7e21420f775f72ae938bdeb5e6068f722088f06a",
"dependencies": [
"libmagic",
"freetype",
"mbedtls",
"zlib",
"bzip2",
"liblzma",
"zstd",
"glfw3",
"curl"
]
}

34
dist/web/Dockerfile vendored
View File

@@ -1,11 +1,11 @@
FROM emscripten/emsdk:latest as build
FROM emscripten/emsdk:4.0.8 AS build
# Used to invalidate layer cache but not mount cache
# See https://github.com/moby/moby/issues/41715#issuecomment-733976493
ARG UNIQUEKEY 1
RUN apt update
RUN apt install -y git ccache autoconf automake libtool cmake pkg-config
RUN apt install -y git ccache autoconf automake libtool cmake pkg-config ninja-build
RUN <<EOF
# Install vcpkg
@@ -13,6 +13,7 @@ RUN <<EOF
set -xe
git clone https://github.com/microsoft/vcpkg /vcpkg
git -C /vcpkg pull
/vcpkg/bootstrap-vcpkg.sh
sed -i 's/vcpkg_install_make(${EXTRA_ARGS})/vcpkg_install_make(${EXTRA_ARGS} SUBPATH src)/g' /vcpkg/ports/libmagic/portfile.cmake
EOF
@@ -27,7 +28,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
' >> /emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
EOF
ENV VCPKG_DEFAULT_BINARY_CACHE /cache/vcpkg
ENV VCPKG_DEFAULT_BINARY_CACHE=/cache/vcpkg
RUN --mount=type=cache,target=/cache <<EOF
# Install dependencies with vcpkg
set -xe
@@ -37,12 +38,15 @@ mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
/vcpkg/vcpkg install --triplet=wasm32-emscripten libmagic
/vcpkg/vcpkg install --triplet=wasm32-emscripten freetype
/vcpkg/vcpkg install --triplet=wasm32-emscripten mbedtls
/vcpkg/vcpkg install --triplet=wasm32-emscripten libarchive
/vcpkg/vcpkg install --triplet=wasm32-emscripten zlib
/vcpkg/vcpkg install --triplet=wasm32-emscripten bzip2
/vcpkg/vcpkg install --triplet=wasm32-emscripten liblzma
/vcpkg/vcpkg install --triplet=wasm32-emscripten zstd
EOF
# Build ImHex
ARG JOBS=4
ENV CCACHE_DIR /cache/ccache
ENV CCACHE_DIR=/cache/ccache
RUN mkdir /build
WORKDIR /build
@@ -53,29 +57,36 @@ set -xe
ccache -zs
cmake /imhex \
-G "Ninja" \
-DIMHEX_OFFLINE_BUILD=ON \
-DIMHEX_STATIC_LINK_PLUGINS=ON \
-DIMHEX_EXCLUDE_PLUGINS="script_loader" \
-DIMHEX_COMPRESS_DEBUG_INFO=OFF \
-DNATIVE_CMAKE_C_COMPILER=gcc \
-DNATIVE_CMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \
-DLIBROMFS_COMPRESS_RESOURCES=OFF \
-DCMAKE_BUILD_TYPE=Release
make -j $JOBS
ninja -j $JOBS
cp /imhex/dist/web/source/* /build
ccache -s
EOF
FROM scratch
# Create a file dedicated to store wasm size, because I know no way to get the wasm content length if the web server uses compression
# See https://stackoverflow.com/questions/41701849/cannot-modify-accept-encoding-with-fetch https://github.com/AnthumChris/fetch-progress-indicators/issues/13
RUN du -b /build/imhex.wasm | cut -f1 > imhex.wasm.size
FROM scratch AS raw
COPY --from=build [ \
# ImHex \
"/build/imhex.wasm", \
"/build/imhex.wasm.size", \
"/build/imhex.js", \
"/build/imhex.worker.js", \
\
# Static files \
"/build/index.html", \
@@ -83,11 +94,14 @@ COPY --from=build [ \
"/build/wasm-config.js", \
"/build/enable-threads.js", \
"/build/favicon.ico", \
"/build/icon.png", \
"/build/icon.svg", \
"/build/manifest.json", \
"/build/robots.txt", \
"/build/sitemap.xml", \
\
# Destination \
"./" \
]
]
FROM nginx
COPY --from=raw . /usr/share/nginx/html

10
dist/web/compose.yml vendored Normal file
View File

@@ -0,0 +1,10 @@
# docker compose -f dist/web/compose.yml up --build
version: '3'
services:
imhex_web:
image: imhex_web:latest
build:
context: ../../ # ImHex folder
dockerfile: ./dist/web/Dockerfile
ports:
- 8080:80

View File

@@ -2,10 +2,12 @@
extern "C" void forceLinkPlugin_@IMHEX_PLUGIN_NAME@();
namespace {
struct StaticLoad {
StaticLoad() {
forceLinkPlugin_@IMHEX_PLUGIN_NAME@();
}
};
}
static StaticLoad staticLoad;
static StaticLoad staticLoad;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 KiB

11
dist/web/source/icon.svg vendored Normal file
View File

@@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" version="1">
<rect style="opacity:0.2" width="55" height="10" x="5" y="-60" rx="1.41" transform="rotate(90)"/>
<rect style="fill:#2b50a1" width="55" height="10" x="4" y="-60" rx="1.41" transform="rotate(90)"/>
<rect style="fill:#2b50a1" width="55" height="10" x="4" y="-14" rx="1.41" transform="rotate(90)"/>
<rect style="fill:#2b50a1" width="55" height="10" x="4" y="-33" rx="1.41" transform="rotate(90)"/>
<path style="opacity:0.2" d="M 5.3808594,5 C 4.6158118,5 4,5.6158118 4,6.3808594 V 13.619141 C 4,14.384188 4.6158118,15 5.3808594,15 H 31.619141 C 32.384188,15 33,14.384188 33,13.619141 V 6.3808594 C 33,5.6158118 32.384188,5 31.619141,5 Z M 40.400391,5 C 39.624791,5 39,5.6247906 39,6.4003906 V 13.599609 C 39,14.375209 39.624791,15 40.400391,15 H 58.599609 C 59.375209,15 60,14.375209 60,13.599609 V 6.4003906 C 60,5.6247906 59.375209,5 58.599609,5 Z M 5.3808594,50 C 4.6158118,50 4,50.615812 4,51.380859 v 7.238282 C 4,59.384188 4.6158118,60 5.3808594,60 H 31.619141 C 32.384188,60 33,59.384188 33,58.619141 V 51.380859 C 33,50.615812 32.384188,50 31.619141,50 Z"/>
<rect style="fill:#3a6be0" width="29" height="10" x="4" y="4" rx="1.381"/>
<rect style="fill:#3a6be0" width="21" height="10" x="39" y="4" rx="1.4"/>
<rect style="fill:#3a6be0" width="29" height="10" x="4" y="49" rx="1.381"/>
<path style="fill:#ffffff;opacity:0.1" d="M 5.3808594 4 C 4.6158118 4 4 4.6158118 4 5.3808594 L 4 6.3808594 C 4 5.6158118 4.6158118 5 5.3808594 5 L 31.619141 5 C 32.384188 5 33 5.6158118 33 6.3808594 L 33 5.3808594 C 33 4.6158118 32.384188 4 31.619141 4 L 5.3808594 4 z M 40.400391 4 C 39.624791 4 39 4.6247906 39 5.4003906 L 39 6.4003906 C 39 5.6247906 39.624791 5 40.400391 5 L 58.599609 5 C 59.375209 5 60 5.6247906 60 6.4003906 L 60 5.4003906 C 60 4.6247906 59.375209 4 58.599609 4 L 40.400391 4 z M 5.3808594 49 C 4.6158118 49 4 49.615812 4 50.380859 L 4 51.380859 C 4 50.615812 4.6158118 50 5.3808594 50 L 31.619141 50 C 32.384188 50 33 50.615812 33 51.380859 L 33 50.380859 C 33 49.615812 32.384188 49 31.619141 49 L 5.3808594 49 z"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -11,7 +11,7 @@
<meta name="title" content="ImHex">
<meta name="description" content="Free and extremely powerful Online Hex Editor for your Web Browser. ImHex is a free and open source Hex Editor for Reverse Engineers and Developers and Data Analysts.">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="apple-touch-icon" href="icon.png">
<link rel="apple-touch-icon" href="icon.svg">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
@@ -38,7 +38,7 @@
"founder": "WerWolv",
"slogan": "A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.",
"url": "https://imhex.werwolv.net",
"logo": "https://imhex.werwolv.net/assets/logos/logo.png"
"logo": "https://imhex.werwolv.net/assets/logos/logo.svg"
}
</script>
@@ -61,37 +61,44 @@
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="loading" class="centered">
<img src="https://raw.githubusercontent.com/WerWolv/ImHex/master/plugins/builtin/romfs/assets/dark/banner.png" id="logo" alt="ImHex Logo">
<h1>A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.</h1>
<h2>Available both natively and on the web</h2>
<h5>ImHex runs directly in your web browser with the help of Emscripten and WebAssembly.</h5>
<div id="loading" class="centered">
<img src="https://raw.githubusercontent.com/WerWolv/ImHex/master/plugins/builtin/romfs/assets/dark/banner.svg" id="logo" alt="ImHex Logo">
<h1>A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.</h1>
<h2>Available both natively and on the web</h2>
<h5>ImHex runs directly in your web browser with the help of Emscripten and WebAssembly.</h5>
<div style="height: 50%">
<div style="height: 30%"> </div>
<h2 id="not_working">
Not loading in your Browser? <a href="https://imhex.werwolv.net">Try the native version</a>
</h2>
<div style="height: 50%"></div>
</div>
<div class="loading_ripple">
<div class="lds-ripple"><div></div><div></div></div>
</div>
<div style="height: 10%">
</div>
<div class="footer">
<a href="https://imhex.werwolv.net">Homepage</a>
<p>Made with ♥️ by the ImHex Team</p>
<a href="https://github.com/WerWolv/ImHex">GitHub</a>
<div style="height: 50%">
<div style="height: 30%"> </div>
<h2 id="not_working">
Not loading in your Browser? <a href="https://imhex.werwolv.net">Try the native version</a>
</h2>
<div class="progress-bar-container">
<div class="progress progress-moved">
<div class="progress-bar" id="progress-bar-content">
</div>
</div>
</div>
</div>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
<script src="wasm-config.js"></script>
<script async src="imhex.js"></script>
<div class="loading_ripple">
<div class="lds-ripple"><div></div><div></div></div>
</div>
<div style="height: 10%">
</div>
<div class="footer">
<a href="https://imhex.werwolv.net">Homepage</a>
<p>Made with ♥️ by the ImHex Team</p>
<a href="https://github.com/WerWolv/ImHex">GitHub</a>
</div>
</div>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
<script src="wasm-config.js"></script>
<script async src="imhex.js"></script>
</body>
</html>

View File

@@ -10,8 +10,8 @@
],
"icons": [
{
"src": "icon.png",
"type": "image/png",
"src": "icon.svg",
"type": "image/svg",
"sizes": "640x640"
}
],

View File

@@ -5,10 +5,63 @@
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>https://web.imhex.werwolv.net/</loc>
<lastmod>2023-12-07T22:53:06+00:00</lastmod>
</url>
<url>
<loc>https://web.imhex.werwolv.net/</loc>
<lastmod>2024-01-02T11:44:00+00:00</lastmod>
<priority>1.00</priority>
</url>
<url>
<title>English</title>
<loc>https://web.imhex.werwolv.net?lang=en-US</loc>
<lastmod>2024-01-02T11:44:00+00:00</lastmod>
<priority>1.00</priority>
</url>
<url>
<title>Deutsch</title>
<loc>https://web.imhex.werwolv.net?lang=de-DE</loc>
<lastmod>2024-01-02T11:44:00+00:00</lastmod>
<priority>1.00</priority>
</url>
<url>
<title>Português</title>
<loc>https://web.imhex.werwolv.net?lang=pt-BR</loc>
<lastmod>2024-01-02T11:44:00+00:00</lastmod>
</url>
<url>
<title>中国</title>
<loc>https://web.imhex.werwolv.net?lang=zh-CN</loc>
<lastmod>2024-01-02T11:44:00+00:00</lastmod>
</url>
<url>
<title>國語</title>
<loc>https://web.imhex.werwolv.net?lang=zh-TW</loc>
<lastmod>2024-01-02T11:44:00+00:00</lastmod>
</url>
<url>
<title>日本語</title>
<loc>https://web.imhex.werwolv.net?lang=ja-JP</loc>
<lastmod>2024-01-02T11:44:00+00:00</lastmod>
</url>
<url>
<title>한국어</title>
<loc>https://web.imhex.werwolv.net?lang=ko-KR</loc>
<lastmod>2024-01-02T11:44:00+00:00</lastmod>
</url>
<url>
<title>Español</title>
<loc>https://web.imhex.werwolv.net?lang=es-ES</loc>
<lastmod>2024-01-02T11:44:00+00:00</lastmod>
</url>
<url>
<title>Italiano</title>
<loc>https://web.imhex.werwolv.net?lang=it-IT</loc>
<lastmod>2024-01-02T11:44:00+00:00</lastmod>
</url>
<url>
<title>Русский</title>
<loc>https://web.imhex.werwolv.net?lang=ru-RU</loc>
<lastmod>2024-01-02T11:44:00+00:00</lastmod>
</url>
</urlset>

View File

@@ -17,6 +17,7 @@ body {
margin-right: auto;
display: none;
border: 0 none;
image-rendering: smooth;
}
h1, h2, h5 {
@@ -132,4 +133,56 @@ a:hover {
height: 72px;
opacity: 0;
}
}
:root {
--progress: 0%;
}
.progress-bar-container {
margin: 100px auto;
width: 600px;
text-align: center;
}
.progress {
padding: 6px;
border-radius: 30px;
background: rgba(0, 0, 0, 0.25);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25),
0 1px rgba(255, 255, 255, 0.08);
}
.progress-bar {
color: rgba(240, 240, 240, 0.9);
height: 18px;
border-radius: 30px;
font-size: 13px;
font-family: monospace;
font-weight: bold;
text-wrap: avoid;
white-space: nowrap;
overflow: hidden;
background-image: linear-gradient(
to bottom,
rgba(255, 255, 255, 0.2),
rgba(255, 255, 255, 0.0)
);
}
.progress-moved .progress-bar {
width: var(--progress);
background-color: #3864cb;
}
#logo {
height: 25%;
margin-top: 50px;
}
.canvas-fixed {
position: absolute;
top: 0;
left: 0;
}

View File

@@ -1,3 +1,68 @@
let wasmSize = null;
// See comment in dist/web/Dockerfile about imhex.wasm.size
fetch("imhex.wasm.size").then(async (resp) => {
wasmSize = parseInt((await resp.text()).trim());
console.log(`Real WASM binary size is ${wasmSize} bytes`);
});
// Monkeypatch WebAssembly to have a progress bar
// inspired from: https://github.com/WordPress/wordpress-playground/pull/46 (but had to be modified)
function monkeyPatch(progressFun) {
const _instantiateStreaming = WebAssembly.instantiateStreaming;
WebAssembly.instantiateStreaming = async (responsePromise, ...args) => {
// Do not collect wasm content length here see above
let response = await responsePromise
const file = response.url.substring(
new URL(response.url).origin.length + 1
);
const reportingResponse = new Response(
new ReadableStream(
{
async start(controller) {
const reader = response.clone().body.getReader();
let loaded = 0;
for (; ;) {
const { done, value } = await reader.read();
if (done) {
if(wasmSize) progressFun(file, wasmSize);
break;
}
loaded += value.byteLength;
progressFun(file, loaded);
controller.enqueue(value);
}
controller.close();
}
},
{
status: response.status,
statusText: response.statusText
}
)
);
for (const pair of response.headers.entries()) {
reportingResponse.headers.set(pair[0], pair[1]);
}
return _instantiateStreaming(reportingResponse, ...args);
}
}
monkeyPatch((file, done) => {
if (!wasmSize) return;
if (done > wasmSize) {
console.warn(`Downloaded binary size ${done} is larger than expected WASM size ${wasmSize}`);
return;
}
const percent = ((done / wasmSize) * 100).toFixed(0);
const mibNow = (done / 1024**2).toFixed(1);
const mibTotal = (wasmSize / 1024**2).toFixed(1);
let root = document.querySelector(':root');
root.style.setProperty("--progress", `${percent}%`)
document.getElementById("progress-bar-content").innerHTML = `${percent}% &nbsp;[${mibNow} MiB / ${mibTotal} MiB]`;
});
function glfwSetCursorCustom(wnd, shape) {
let body = document.getElementsByTagName("body")[0]
switch (shape) {
@@ -36,7 +101,77 @@ var notWorkingTimer = setTimeout(() => {
var Module = {
preRun: [],
postRun: [],
postRun: function() {
// Patch the emscripten GLFW module to send mouse and touch events in the right order
// For ImGui interactions to correctly work with touch input, MousePos events need
// to be processed first and then MouseButton events in the next frame. By default,
// GLFW does the exact opposite, which causes buttons to require two taps to register
// and windows get "stuck" to the cursor when dragged or resized
GLFW.onMousemove = event => {
if (event.type === "touchmove") {
event.preventDefault();
let primaryChanged = false;
for (let i of event.changedTouches) {
if (GLFW.primaryTouchId === i.identifier) {
Browser.setMouseCoords(i.pageX, i.pageY);
primaryChanged = true;
break;
}
}
if (!primaryChanged) {
return;
}
} else {
Browser.calculateMouseEvent(event);
}
};
GLFW.onMouseButtonChanged = (event, status) => {
if (!GLFW.active) return;
if (event.target != Module["canvas"]) return;
const isTouchType = event.type === "touchstart" || event.type === "touchend" || event.type === "touchcancel";
let eventButton = 0;
if (isTouchType) {
event.preventDefault();
let primaryChanged = false;
if (GLFW.primaryTouchId === null && event.type === "touchstart" && event.targetTouches.length > 0) {
const chosenTouch = event.targetTouches[0];
GLFW.primaryTouchId = chosenTouch.identifier;
Browser.setMouseCoords(chosenTouch.pageX, chosenTouch.pageY);
primaryChanged = true;
} else if (event.type === "touchend" || event.type === "touchcancel") {
for (let i of event.changedTouches) {
if (GLFW.primaryTouchId === i.identifier) {
GLFW.primaryTouchId = null;
primaryChanged = true;
break;
}
}
}
if (!primaryChanged) {
return;
}
} else {
Browser.calculateMouseEvent(event);
eventButton = GLFW.DOMToGLFWMouseButton(event);
}
if (status == 1) {
GLFW.active.buttons |= (1 << eventButton);
try {
event.target.setCapture();
} catch (e) {}
} else {
GLFW.active.buttons &= ~(1 << eventButton);
}
if (GLFW.active.cursorPosFunc) {
getWasmTableEntry(GLFW.active.cursorPosFunc)(GLFW.active.id, Browser.mouseX, Browser.mouseY);
}
if (GLFW.active.mouseButtonFunc) {
getWasmTableEntry(GLFW.active.mouseButtonFunc)(GLFW.active.id, eventButton, status, GLFW.getModBits(GLFW.active));
}
};
},
onRuntimeInitialized: function() {
// Triggered when the wasm module is loaded and ready to use.
document.getElementById("loading").style.display = "none"
@@ -47,36 +182,90 @@ var Module = {
print: (function() { })(),
printErr: function(text) { },
canvas: (function() {
let canvas = document.getElementById('canvas');
// As a default initial behavior, pop up an alert when webgl context is lost. To make your
// application robust, you may want to override this behavior before shipping!
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
const canvas = document.getElementById('canvas');
canvas.addEventListener("webglcontextlost", function(e) {
alert('WebGL context lost, please reload the page');
e.preventDefault();
}, false);
return canvas;
// Turn long touches into right-clicks
let timer = null;
canvas.addEventListener('touchstart', event => {
timer = setTimeout(() => {
let eventArgs = {
bubbles: true,
cancelable: true,
view: window,
screenX: event.touches[0].screenX,
screenY: event.touches[0].screenY,
clientX: event.touches[0].clientX,
clientY: event.touches[0].clientY,
button: 2,
buttons: 2,
relatedTarget: event.target,
region: event.region
}
canvas.dispatchEvent(new MouseEvent('mousedown', eventArgs));
canvas.dispatchEvent(new MouseEvent('mouseup', eventArgs));
}, 400);
});
canvas.addEventListener('touchend', event => {
if (timer) {
clearTimeout(timer);
timer = null;
}
});
if (typeof WebGL2RenderingContext !== 'undefined') {
let gl = canvas.getContext('webgl2', { stencil: true });
if (!gl) {
console.error('WebGL 2 not available, falling back to WebGL');
gl = canvas.getContext('webgl', { stencil: true });
}
if (!gl) {
alert('WebGL not available with stencil buffer');
}
return canvas;
} else {
alert('WebGL 2 not supported by this browser');
}
})(),
setStatus: function(text) { },
totalDependencies: 0,
monitorRunDependencies: function(left) { },
instantiateWasm: function(imports, successCallback) {
monitorRunDependencies: function(left) {
},
instantiateWasm: async function(imports, successCallback) {
imports.env.glfwSetCursor = glfwSetCursorCustom
imports.env.glfwCreateStandardCursor = glfwCreateStandardCursorCustom
instantiateAsync(wasmBinary, wasmBinaryFile, imports, (result) => successCallback(result.instance, result.module));
}
let result = await instantiateAsync(null, findWasmBinary(), imports);
successCallback(result.instance, result.module)
},
arguments: []
};
// Handle passing arguments to the wasm module
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
if (urlParams.has("lang")) {
Module["arguments"].push("--language");
Module["arguments"].push(urlParams.get("lang"));
}
window.addEventListener('resize', js_resizeCanvas, false);
function js_resizeCanvas() {
let canvas = document.getElementById('canvas');
canvas.top = document.documentElement.clientTop;
canvas.left = document.documentElement.clientLeft;
canvas.width = Math.min(document.documentElement.clientWidth, window.innerWidth || 0);
canvas.height = Math.min(document.documentElement.clientHeight, window.innerHeight || 0);
}
canvas.classList.add("canvas_full_screen")
if (GLFW.active && GLFW.active.windowPosFunc) {
getWasmTableEntry(GLFW.active.windowPosFunc)(GLFW.active.id, GLFW.active.x, GLFW.active.y);
// Prevent some default browser shortcuts from preventing ImHex ones to work
document.addEventListener('keydown', e => {
if (e.ctrlKey) {
if (e.which == 83) e.preventDefault();
}
GLFW.onWindowSizeChanged();
}
})

1
lib/external/disassembler vendored Submodule

View File

@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.16)
project(libimhex)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(LIBIMHEX_SOURCES
source/api/imhex_api.cpp
@@ -35,9 +34,17 @@ set(LIBIMHEX_SOURCES
source/helpers/patches.cpp
source/helpers/encoding_file.cpp
source/helpers/logger.cpp
source/helpers/stacktrace.cpp
source/helpers/tar.cpp
source/helpers/debugging.cpp
source/helpers/default_paths.cpp
source/helpers/imgui_hooks.cpp
source/helpers/semantic_version.cpp
source/helpers/keys.cpp
source/helpers/freetype.cpp
source/helpers/udp_server.cpp
source/helpers/clipboard.cpp
source/test/tests.cpp
source/providers/provider.cpp
source/providers/memory_provider.cpp
@@ -47,25 +54,27 @@ set(LIBIMHEX_SOURCES
source/ui/view.cpp
source/ui/popup.cpp
source/ui/toast.cpp
source/ui/banner.cpp
source/subcommands/subcommands.cpp
)
if (APPLE)
set(OSX_11_0_SDK_PATH /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk)
set(OSX_SDK_PATH /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk)
if (NOT CMAKE_OSX_SYSROOT)
if (IS_DIRECTORY ${OSX_11_0_SDK_PATH})
set(CMAKE_OSX_SYSROOT ${OSX_11_0_SDK_PATH})
if (IS_DIRECTORY ${OSX_SDK_PATH})
set(CMAKE_OSX_SYSROOT ${OSX_SDK_PATH})
else ()
message(WARNING "CMAKE_OSX_SYSROOT not set and macOS 10.9 SDK not found! Using default one.")
message(WARNING "CMAKE_OSX_SYSROOT not set and macOS SDK not found! Using default one.")
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 ()
add_compile_definitions(IMHEX_PROJECT_NAME="${PROJECT_NAME}")
if (IMHEX_EXTERNAL_PLUGIN_BUILD)
add_library(libimhex IMPORTED SHARED GLOBAL)
set(LIBIMHEX_LIBRARY_TYPE INTERFACE)
@@ -76,45 +85,22 @@ else()
add_library(libimhex SHARED ${LIBIMHEX_SOURCES})
endif()
if (IMHEX_ENABLE_CXX_MODULES)
target_sources(libimhex
PUBLIC
FILE_SET cxx_modules TYPE CXX_MODULES
FILES
include/hex.cppm
)
endif()
set(LIBIMHEX_LIBRARY_TYPE PUBLIC)
endif()
set_target_properties(libimhex PROPERTIES POSITION_INDEPENDENT_CODE ON)
enableUnityBuild(libimhex)
setupCompilerFlags(libimhex)
include(GenerateExportHeader)
generate_export_header(libimhex)
target_include_directories(libimhex ${LIBIMHEX_LIBRARY_TYPE} include ${XDGPP_INCLUDE_DIRS} ${MBEDTLS_INCLUDE_DIR} ${MAGIC_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS} ${FMT_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} ${LIBBACKTRACE_INCLUDE_DIRS})
target_link_directories(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${MBEDTLS_LIBRARY_DIR} ${MAGIC_LIBRARY_DIRS})
if (NOT EMSCRIPTEN)
# curl is only used in non-emscripten builds
target_include_directories(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${CURL_INCLUDE_DIRS})
target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${LIBCURL_LIBRARIES})
target_compile_definitions(libimhex PRIVATE IMHEX_PROJECT_NAME="${PROJECT_NAME}")
endif()
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
if (WIN32)
set_target_properties(libimhex PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
target_link_options(libimhex PRIVATE -Wl,--export-all-symbols)
elseif (APPLE)
find_library(FOUNDATION NAMES Foundation)
target_link_libraries(libimhex PUBLIC ${FOUNDATION})
endif ()
target_link_libraries(libimhex PRIVATE microtar libpl plcli libpl-gen libwolv ${FMT_LIBRARIES} ${NFD_LIBRARIES} magic dl ${IMGUI_LIBRARIES} ${NLOHMANN_JSON_LIBRARIES} ${MBEDTLS_LIBRARIES} ${LIBBACKTRACE_LIBRARIES} ${JTHREAD_LIBRARIES})
endif()
target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${NLOHMANN_JSON_LIBRARIES} ${IMGUI_LIBRARIES} LLVMDemangle)
set_property(TARGET libimhex PROPERTY INTERPROCEDURAL_OPTIMIZATION FALSE)
if (DEFINED IMHEX_COMMIT_HASH_LONG AND DEFINED IMHEX_COMMIT_HASH_SHORT AND DEFINED IMHEX_COMMIT_BRANCH)
if (DEFINED IMHEX_COMMIT_HASH_LONG AND DEFINED IMHEX_COMMIT_BRANCH)
set(GIT_COMMIT_HASH_LONG "${IMHEX_COMMIT_HASH_LONG}")
set(GIT_COMMIT_HASH_SHORT "${IMHEX_COMMIT_HASH_SHORT}")
set(GIT_BRANCH "${IMHEX_COMMIT_BRANCH}")
else()
# Get the current working branch
@@ -124,15 +110,7 @@ else()
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE RESULT_BRANCH
)
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git log -1 --format=%h --abbrev=7
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH_SHORT
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE RESULT_HASH_SHORT
ERROR_QUIET
)
execute_process(
@@ -141,15 +119,64 @@ else()
OUTPUT_VARIABLE GIT_COMMIT_HASH_LONG
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE RESULT_HASH_LONG
ERROR_QUIET
)
endif ()
if ((NOT GIT_COMMIT_HASH_SHORT STREQUAL "") AND (NOT GIT_COMMIT_HASH_LONG STREQUAL "") AND (NOT GIT_BRANCH STREQUAL ""))
addDefineToSource(source/api/imhex_api.cpp "GIT_COMMIT_HASH_SHORT=\"${GIT_COMMIT_HASH_SHORT}\"")
if (GIT_COMMIT_HASH_LONG STREQUAL "" OR GIT_BRANCH STREQUAL "")
message(WARNING "Failed to to determine commit hash/branch")
else()
addDefineToSource(source/api/imhex_api.cpp "GIT_COMMIT_HASH_LONG=\"${GIT_COMMIT_HASH_LONG}\"")
addDefineToSource(source/api/imhex_api.cpp "GIT_BRANCH=\"${GIT_BRANCH}\"")
endif ()
addDefineToSource(source/api/imhex_api.cpp "IMHEX_VERSION=\"${IMHEX_VERSION_STRING}\"")
add_dependencies(imhex_all libimhex)
enableUnityBuild(libimhex)
setupCompilerFlags(libimhex)
include(GenerateExportHeader)
generate_export_header(libimhex)
target_include_directories(libimhex ${LIBIMHEX_LIBRARY_TYPE} include ${XDGPP_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS} ${FMT_INCLUDE_DIRS})
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
if (WIN32)
set_target_properties(libimhex PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
if (NOT MSVC)
target_link_options(libimhex PRIVATE -Wl,--export-all-symbols)
endif()
target_link_libraries(libimhex PRIVATE Netapi32.lib)
target_compile_definitions(libimhex PRIVATE EXPORT_SYMBOLS=1)
elseif (APPLE)
find_library(FOUNDATION NAMES Foundation)
target_link_libraries(libimhex PUBLIC ${FOUNDATION})
endif ()
target_link_libraries(libimhex PRIVATE libpl microtar ${NFD_LIBRARIES} magic)
target_link_libraries(libimhex PUBLIC libwolv libpl_includes libpl-gen ${IMGUI_LIBRARIES} ${JTHREAD_LIBRARIES})
if (NOT WIN32)
target_link_libraries(libimhex PRIVATE dl)
endif()
if (NOT EMSCRIPTEN)
target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} CURL::libcurl clip)
endif()
target_include_directories(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${MBEDTLS_INCLUDE_DIR} ${LIBBACKTRACE_INCLUDE_DIRS} ${MAGIC_INCLUDE_DIRS})
target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${MBEDTLS_LIBRARIES})
target_link_directories(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${MBEDTLS_LIBRARY_DIR} ${MAGIC_LIBRARY_DIRS})
precompileHeaders(libimhex "${CMAKE_CURRENT_SOURCE_DIR}/include")
endif()
target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${NLOHMANN_JSON_LIBRARIES} imgui_all_includes ${FMT_LIBRARIES} ${LUNASVG_LIBRARIES} ${BOOST_LIBRARIES} tracing)
set_property(TARGET libimhex PROPERTY INTERPROCEDURAL_OPTIMIZATION FALSE)
add_dependencies(imhex_all libimhex)
install(FILES "$<TARGET_FILE:libimhex>" DESTINATION "${CMAKE_INSTALL_LIBDIR}" PERMISSIONS ${LIBRARY_PERMISSIONS})
set_target_properties(libimhex PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set_target_properties(libimhex PROPERTIES PREFIX "")

502
lib/libimhex/LICENSE Normal file
View File

@@ -0,0 +1,502 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@@ -0,0 +1,51 @@
module;
#include <cmath>
#include <map>
#include <string>
#include <string_view>
#include <vector>
#include <exception>
#include <algorithm>
#include <locale>
#include <array>
#include <filesystem>
#include <functional>
#include <memory>
#include <list>
#include <atomic>
#include <ranges>
#include <fstream>
#include <thread>
#include <future>
#include <fmt/format.h>
#include <nlohmann/json.hpp>
#include <wolv/io/file.hpp>
#include <imgui.h>
#include <imgui_internal.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <hex/helpers/auto_reset.hpp>
#include <hex/api/event_manager.hpp>
#include <hex/providers/provider.hpp>
#include <hex/providers/provider_data.hpp>
#include <hex/data_processor/node.hpp>
#include <hex/data_processor/link.hpp>
#include <hex/data_processor/attribute.hpp>
#include <pl/pattern_language.hpp>
export module hex;
#define HEX_MODULE_EXPORT
#include <hex/api/task_manager.hpp>
#include <hex/api/achievement_manager.hpp>
#include <hex/api/imhex_api.hpp>
#include <hex/api/layout_manager.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/api/plugin_manager.hpp>
#include <hex/api/shortcut_manager.hpp>
#include <hex/api/theme_manager.hpp>
#include <hex/api/tutorial_manager.hpp>
#include <hex/api/workspace_manager.hpp>

View File

@@ -1,4 +1,9 @@
#pragma once
#include <hex/helpers/types.hpp>
#include <hex/helpers/intrinsics.hpp>
#if defined(HEX_MODULE_EXPORT)
#define EXPORT_MODULE export
#else
#define EXPORT_MODULE
#endif

View File

@@ -14,8 +14,9 @@
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <hex/api/localization_manager.hpp>
#include <hex/helpers/auto_reset.hpp>
namespace hex {
EXPORT_MODULE namespace hex {
class AchievementManager;
@@ -151,7 +152,7 @@ namespace hex {
if (m_icon.isValid())
return m_icon;
m_icon = ImGuiExt::Texture(m_iconData.data(), m_iconData.size(), ImGuiExt::Texture::Filter::Linear);
m_icon = ImGuiExt::Texture::fromImage(m_iconData.data(), m_iconData.size(), ImGuiExt::Texture::Filter::Linear);
return m_icon;
}
@@ -295,6 +296,7 @@ namespace hex {
};
class AchievementManager {
static bool s_initialized;
public:
AchievementManager() = delete;
@@ -331,18 +333,7 @@ namespace hex {
static Achievement& addAchievement(auto && ... args) {
auto newAchievement = std::make_unique<T>(std::forward<decltype(args)>(args)...);
const auto &category = newAchievement->getUnlocalizedCategory();
const auto &name = newAchievement->getUnlocalizedName();
auto [categoryIter, categoryInserted] = getAchievements().insert({ category, std::unordered_map<std::string, std::unique_ptr<Achievement>>{} });
auto &[categoryKey, achievements] = *categoryIter;
auto [achievementIter, achievementInserted] = achievements.insert({ name, std::move(newAchievement) });
auto &[achievementKey, achievement] = *achievementIter;
achievementAdded();
return *achievement;
return addAchievementImpl(std::move(newAchievement));
}
/**
@@ -371,7 +362,7 @@ namespace hex {
* @brief Returns all registered achievements
* @return All achievements
*/
static std::unordered_map<std::string, std::unordered_map<std::string, std::unique_ptr<Achievement>>>& getAchievements();
static const std::unordered_map<UnlocalizedString, std::unordered_map<UnlocalizedString, std::unique_ptr<Achievement>>>& getAchievements();
/**
* @brief Returns all achievement start nodes
@@ -379,14 +370,14 @@ namespace hex {
* @param rebuild Whether to rebuild the list of start nodes
* @return All achievement start nodes
*/
static std::unordered_map<std::string, std::vector<AchievementNode*>>& getAchievementStartNodes(bool rebuild = true);
static const std::unordered_map<UnlocalizedString, std::vector<AchievementNode*>>& getAchievementStartNodes(bool rebuild = true);
/**
* @brief Returns all achievement nodes
* @param rebuild Whether to rebuild the list of nodes
* @return All achievement nodes
*/
static std::unordered_map<std::string, std::list<AchievementNode>>& getAchievementNodes(bool rebuild = true);
static const std::unordered_map<UnlocalizedString, std::list<AchievementNode>>& getAchievementNodes(bool rebuild = true);
/**
* @brief Loads the progress of all achievements from the achievements save file
@@ -398,11 +389,6 @@ namespace hex {
*/
static void storeProgress();
/**
* @brief Removes all registered achievements from the tree
*/
static void clear();
/**
* @brief Removes all temporary achievements from the tree
*/
@@ -416,6 +402,8 @@ namespace hex {
private:
static void achievementAdded();
static Achievement& addAchievementImpl(std::unique_ptr<Achievement> &&newAchievement);
};
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,43 +2,56 @@
#include <hex.hpp>
#include <algorithm>
#include <functional>
#include <list>
#include <mutex>
#include <map>
#include <string_view>
#include <functional>
#include <hex/api/imhex_api.hpp>
#include <hex/helpers/fs.hpp>
#include <hex/helpers/logger.hpp>
#include <wolv/types/type_name.hpp>
#define EVENT_DEF_IMPL(event_name, event_name_string, should_log, ...) \
struct event_name final : public hex::impl::Event<__VA_ARGS__> { \
constexpr static auto Id = [] { return hex::impl::EventId(event_name_string); }(); \
constexpr static auto ShouldLog = (should_log); \
explicit event_name(Callback func) noexcept : Event(std::move(func)) { } \
\
static EventManager::EventList::iterator subscribe(Event::Callback function) { return EventManager::subscribe<event_name>(function); } \
static void subscribe(void *token, Event::Callback function) { EventManager::subscribe<event_name>(token, function); } \
static void unsubscribe(const EventManager::EventList::iterator &token) noexcept { EventManager::unsubscribe(token); } \
static void unsubscribe(void *token) noexcept { EventManager::unsubscribe<event_name>(token); } \
static void post(auto &&...args) noexcept { EventManager::post<event_name>(std::forward<decltype(args)>(args)...); } \
};
#define EVENT_DEF_IMPL(event_name, event_name_string, should_log, ...) \
struct event_name final : public hex::impl::Event<__VA_ARGS__> { \
constexpr static auto Id = [] { return hex::impl::EventId(event_name_string); }(); \
constexpr static auto ShouldLog = (should_log); \
explicit event_name(Callback func) noexcept : Event(std::move(func)) { } \
\
static EventManager::EventList::iterator subscribe(Event::Callback function) { \
return EventManager::subscribe<event_name>(std::move(function)); \
} \
template<typename = void> \
static EventManager::EventList::iterator subscribe(Event::BaseCallback function) \
requires (!std::same_as<Event::Callback, Event::BaseCallback>) { \
return EventManager::subscribe<event_name>([function = std::move(function)](auto && ...) { function(); }); \
} \
static void subscribe(void *token, Event::Callback function) { \
EventManager::subscribe<event_name>(token, std::move(function)); \
} \
template<typename = void> \
static void subscribe(void *token, Event::BaseCallback function) \
requires (!std::same_as<Event::Callback, Event::BaseCallback>) { \
return EventManager::subscribe<event_name>(token, [function = std::move(function)](auto && ...) { function(); }); \
} \
static void unsubscribe(const EventManager::EventList::iterator &token) noexcept { \
EventManager::unsubscribe(token); \
} \
static void unsubscribe(void *token) noexcept { \
EventManager::unsubscribe<event_name>(token); \
} \
static void post(auto &&...args) { \
EventManager::post<event_name>(std::forward<decltype(args)>(args)...); \
} \
}
#define EVENT_DEF(event_name, ...) EVENT_DEF_IMPL(event_name, #event_name, true, __VA_ARGS__)
#define EVENT_DEF_NO_LOG(event_name, ...) EVENT_DEF_IMPL(event_name, #event_name, false, __VA_ARGS__)
/* Forward declarations */
struct GLFWwindow;
namespace hex {
class Achievement;
class View;
}
namespace hex {
EXPORT_MODULE namespace hex {
namespace impl {
@@ -46,7 +59,7 @@ namespace hex {
public:
explicit constexpr EventId(const char *eventName) {
m_hash = 0x811C'9DC5;
for (auto c : std::string_view(eventName)) {
for (const char c : std::string_view(eventName)) {
m_hash = (m_hash >> 5) | (m_hash << 27);
m_hash ^= c;
}
@@ -56,22 +69,34 @@ namespace hex {
return m_hash == other.m_hash;
}
constexpr auto operator<=>(const EventId &other) const {
return m_hash <=> other.m_hash;
}
private:
u32 m_hash;
};
struct EventBase {
EventBase() noexcept = default;
virtual ~EventBase() = default;
};
template<typename... Params>
struct Event : EventBase {
using Callback = std::function<void(Params...)>;
using BaseCallback = std::function<void()>;
explicit Event(Callback func) noexcept : m_func(std::move(func)) { }
void operator()(Params... params) const noexcept {
m_func(params...);
template<typename E>
void call(Params... params) const {
try {
m_func(params...);
} catch (const std::exception &e) {
log::error("An exception occurred while handling event {}: {}", wolv::type::getTypeName<E>(), e.what());
throw;
}
}
private:
@@ -86,11 +111,12 @@ namespace hex {
/**
* @brief The EventManager allows subscribing to and posting events to different parts of the program.
* To create a new event, use the EVENT_DEF macro. This will create a new event type with the given name and parameters
* To create a new event, use the EVENT_DEF macro. This will create a new event type with the given name and parameters.
* Events should be created in an `events_*.hpp` category file under the `events` folder, and never directly here.
*/
class EventManager {
public:
using EventList = std::list<std::pair<impl::EventId, std::unique_ptr<impl::EventBase>>>;
using EventList = std::multimap<impl::EventId, std::unique_ptr<impl::EventBase>>;
/**
* @brief Subscribes to an event
@@ -103,7 +129,7 @@ namespace hex {
std::scoped_lock lock(getEventMutex());
auto &events = getEvents();
return events.insert(events.end(), std::make_pair(E::Id, std::make_unique<E>(function)));
return events.insert({ E::Id, std::make_unique<E>(function) });
}
/**
@@ -116,15 +142,9 @@ namespace hex {
static void subscribe(void *token, typename E::Callback function) {
std::scoped_lock lock(getEventMutex());
if (getTokenStore().contains(token)) {
auto&& [begin, end] = getTokenStore().equal_range(token);
auto eventRegistered = std::any_of(begin, end, [&](auto &item) {
return item.second->first == E::Id;
});
if (eventRegistered) {
log::fatal("The token '{}' has already registered the same event ('{}')", token, wolv::type::getTypeName<E>());
return;
}
if (isAlreadyRegistered(token, E::Id)) {
log::fatal("The token '{}' has already registered the same event ('{}')", token, wolv::type::getTypeName<E>());
return;
}
getTokenStore().insert({ token, subscribe<E>(function) });
@@ -149,16 +169,7 @@ namespace hex {
static void unsubscribe(void *token) noexcept {
std::scoped_lock lock(getEventMutex());
auto &tokenStore = getTokenStore();
auto iter = std::find_if(tokenStore.begin(), tokenStore.end(), [&](auto &item) {
return item.first == token && item.second->first == E::Id;
});
if (iter != tokenStore.end()) {
getEvents().remove(*iter->second);
tokenStore.erase(iter);
}
unsubscribe(token, E::Id);
}
/**
@@ -167,21 +178,17 @@ namespace hex {
* @param args Arguments to pass to the event
*/
template<impl::EventType E>
static void post(auto &&...args) noexcept {
static void post(auto && ...args) {
std::scoped_lock lock(getEventMutex());
for (const auto &[id, event] : getEvents()) {
if (id == E::Id) {
try {
(*static_cast<E *const>(event.get()))(std::forward<decltype(args)>(args)...);
} catch (const std::exception &e) {
log::error("Event '{}' threw {}: {}", wolv::type::getTypeName<decltype(e)>(), wolv::type::getTypeName<E>(), e.what());
}
}
auto [begin, end] = getEvents().equal_range(E::Id);
for (auto it = begin; it != end; ++it) {
const auto &[id, event] = *it;
(*static_cast<E *const>(event.get())).template call<E>(std::forward<decltype(args)>(args)...);
}
#if defined (DEBUG)
if (E::ShouldLog)
if constexpr (E::ShouldLog)
log::debug("Event posted: '{}'", wolv::type::getTypeName<E>());
#endif
}
@@ -200,103 +207,9 @@ namespace hex {
static std::multimap<void *, EventList::iterator>& getTokenStore();
static EventList& getEvents();
static std::recursive_mutex& getEventMutex();
static bool isAlreadyRegistered(void *token, impl::EventId id);
static void unsubscribe(void *token, impl::EventId id);
};
/* Default Events */
/**
* @brief Called when Imhex finished startup, and will enter the main window rendering loop
*/
EVENT_DEF(EventImHexStartupFinished);
EVENT_DEF(EventFileLoaded, std::fs::path);
EVENT_DEF(EventDataChanged);
EVENT_DEF(EventHighlightingChanged);
EVENT_DEF(EventWindowClosing, GLFWwindow *);
EVENT_DEF(EventRegionSelected, ImHexApi::HexEditor::ProviderRegion);
EVENT_DEF(EventSettingsChanged);
EVENT_DEF(EventAbnormalTermination, int);
EVENT_DEF(EventThemeChanged);
EVENT_DEF(EventOSThemeChanged);
/**
* @brief Called when the provider is created.
* This event is responsible for (optionally) initializing the provider and calling EventProviderOpened
* (although the event can also be called manually without problem)
*/
EVENT_DEF(EventProviderCreated, prv::Provider *);
EVENT_DEF(EventProviderChanged, prv::Provider *, prv::Provider *);
/**
* @brief Called as a continuation of EventProviderCreated
* this event is normally called immediately after EventProviderCreated successfully initialized the provider.
* If no initialization (Provider::skipLoadInterface() has been set), this event should be called manually
* If skipLoadInterface failed, this event is not called
*
* @note this is not related to Provider::open()
*/
EVENT_DEF(EventProviderOpened, prv::Provider *);
EVENT_DEF(EventProviderClosing, prv::Provider *, bool *);
EVENT_DEF(EventProviderClosed, prv::Provider *);
EVENT_DEF(EventProviderDeleted, prv::Provider *);
EVENT_DEF(EventProviderSaved, prv::Provider *);
EVENT_DEF(EventWindowInitialized);
EVENT_DEF(EventBookmarkCreated, ImHexApi::Bookmarks::Entry&);
EVENT_DEF(EventPatchCreated, u64, u8, u8);
EVENT_DEF(EventPatternEvaluating);
EVENT_DEF(EventPatternExecuted, const std::string&);
EVENT_DEF(EventPatternEditorChanged, const std::string&);
EVENT_DEF(EventStoreContentDownloaded, const std::fs::path&);
EVENT_DEF(EventStoreContentRemoved, const std::fs::path&);
EVENT_DEF(EventImHexClosing);
EVENT_DEF(EventAchievementUnlocked, const Achievement&);
EVENT_DEF(EventSearchBoxClicked, u32);
EVENT_DEF(EventViewOpened, View*);
EVENT_DEF(EventProviderDataModified, prv::Provider *, u64, u64, const u8*);
EVENT_DEF(EventProviderDataInserted, prv::Provider *, u64, u64);
EVENT_DEF(EventProviderDataRemoved, prv::Provider *, u64, u64);
/**
* @brief Called when a project has been loaded
*/
EVENT_DEF(EventProjectOpened);
EVENT_DEF_NO_LOG(EventFrameBegin);
EVENT_DEF_NO_LOG(EventFrameEnd);
EVENT_DEF_NO_LOG(EventSetTaskBarIconState, u32, u32, u32);
EVENT_DEF(RequestAddInitTask, std::string, bool, std::function<bool()>);
EVENT_DEF(RequestAddExitTask, std::string, std::function<bool()>);
EVENT_DEF(RequestOpenWindow, std::string);
EVENT_DEF(RequestSelectionChange, Region);
EVENT_DEF(RequestAddBookmark, Region, std::string, std::string, color_t, u64*);
EVENT_DEF(RequestRemoveBookmark, u64);
EVENT_DEF(RequestSetPatternLanguageCode, std::string);
EVENT_DEF(RequestRunPatternCode);
EVENT_DEF(RequestLoadPatternLanguageFile, std::fs::path);
EVENT_DEF(RequestSavePatternLanguageFile, std::fs::path);
EVENT_DEF(RequestUpdateWindowTitle);
EVENT_DEF(RequestCloseImHex, bool);
EVENT_DEF(RequestRestartImHex);
EVENT_DEF(RequestOpenFile, std::fs::path);
EVENT_DEF(RequestChangeTheme, std::string);
EVENT_DEF(RequestOpenPopup, std::string);
/**
* @brief Creates a provider from it's unlocalized name, and add it to the provider list
*/
EVENT_DEF(RequestCreateProvider, std::string, bool, bool, hex::prv::Provider **);
EVENT_DEF(RequestInitThemeHandlers);
/**
* @brief Send an event to the main Imhex instance
*/
EVENT_DEF(SendMessageToMainInstance, const std::string, const std::vector<u8>&);
/**
* Move the data from all PerProvider instances from one provider to another.
* The 'from' provider should not have any per provider data after this, and should be immediately deleted
*/
EVENT_DEF(MovePerProviderData, prv::Provider *, prv::Provider *);
}

View File

@@ -0,0 +1,120 @@
#pragma once
#include <hex/api/event_manager.hpp>
/* Forward declarations */
struct GLFWwindow;
namespace hex { class View; }
/* GUI events definitions */
namespace hex {
/**
* @brief Signals a newly opened window
*
* This event is sent when the window has just been opened and docked by the Window manager.
*
* FIXME: In the event that a newly created window is already docked, this will not be sent.
*
* FIXME: This is currently only used for the introduction tutorial.
* If the event's only purpose is this, maybe rename it?
*
* @param view the new view reference
*/
EVENT_DEF(EventViewOpened, View*);
/**
* @brief Signals a change in the DPI scale.
*
* This event is called once at startup to signal native scale definition (by passing the same value twice).
* On Windows OS, this event can also be posted if the window DPI has been changed.
*
* @param oldScale the old scale
* @param newScale the current scale that's now in use
*/
EVENT_DEF(EventDPIChanged, float, float);
/**
* @brief Signals the focus of the ImHex main window.
*
* This is directly tied as a GLFW window focus callback, and will be called accordingly when GLFW detects
* a change in focus.
*
* @param isFocused true if the window is focused
*/
EVENT_DEF(EventWindowFocused, bool);
/**
* @brief Signals a window being closed.
*
* Allows reactive clean up of running tasks, and prevents ImHex from closing
* by displaying an exit confirmation popup.
*
* @param window The window reference
*/
EVENT_DEF(EventWindowClosing, GLFWwindow*);
/**
* @brief Informs that the main window is initialized
*
* On Windows OS, it is used to initialize system theme, if ImHex's theme is following it.
*
* FIXME: Change event name to reflect Theme detection, if it's only used for that purpose?
*/
EVENT_DEF(EventWindowInitialized);
/**
* @brief Informs that the main window is deinitializing
*
* Allows for lifecycle cleanup before ImHex shutdown.
*
* @param window The window reference
*/
EVENT_DEF(EventWindowDeinitializing, GLFWwindow*);
/**
* @brief Signals a theme change in the host OS
*
* Allows ImHex to react to OS theme changes dynamically during execution.
*/
EVENT_DEF(EventOSThemeChanged);
}
/* silent (no-logging) GUI events definitions */
namespace hex {
/**
* @brief Signals the start of a new ImGui frame
*/
EVENT_DEF_NO_LOG(EventFrameBegin);
/**
* @brief Signals the end of an ImGui frame
*/
EVENT_DEF_NO_LOG(EventFrameEnd);
/**
* @brief Windows OS: Sets the taskbar icon state
*
* This event is used on Windows OS to display progress through the taskbar icon (the famous "green loading bar"
* in the taskbar).
*
* @param progressState the progress state (converted from the TaskProgressState enum)
* @param progressType the type of progress (converted from the TaskProgressType enum)
* @param percentage actual progress percentage (expected from 0 to 100)
*
* @see hex::ImHexApi::System::TaskProgressState
* @see hex::ImHexApi::System::TaskProgressType
*/
EVENT_DEF_NO_LOG(EventSetTaskBarIconState, u32, u32, u32);
/**
* @brief Informs of an ImGui element being rendered
*
* @param elementId the element's ID
* @param boundingBox the bounding box (composed of 4 floats)
*/
EVENT_DEF_NO_LOG(EventImGuiElementRendered, ImGuiID, const std::array<float, 4>&);
}

View File

@@ -0,0 +1,158 @@
#pragma once
#include <hex/api/event_manager.hpp>
#include <hex/helpers/patches.hpp>
/* Forward declarations */
namespace hex { class Achievement; }
/* Interaction events definitions */
namespace hex {
/**
* @brief Signals a file was loaded
*
* FIXME: this event is unused and should be scrapped.
*
* @param path the loaded file's path
*/
EVENT_DEF(EventFileLoaded, std::fs::path);
/**
* @brief Signals a change in the current data
*
* Enables provider reaction to data change, especially the data inspector.
*
* This is caused by the following:
* - an explicit provider reload, requested by the user (Ctrl+R)
* - any user action that results in the creation of an "undo" stack action (generally a data modification)
*
* @param provider the Provider subject to the data change
*/
EVENT_DEF(EventDataChanged, prv::Provider *);
/**
* @brief Signals a change in highlighting
*
* The event's only purpose is for the Hex editor to clear highlights when receiving this event.
*/
EVENT_DEF(EventHighlightingChanged);
/**
* @brief Informs of a provider region being selected
*
* This is very generally used to signal user actions that select a specific region within the provider.
* It is also used to pass on regions when the provider changes.
*
* @param providerRegion the provider-aware region being selected
*/
EVENT_DEF(EventRegionSelected, ImHexApi::HexEditor::ProviderRegion);
/**
* @brief Signals a theme change
*
* On Windows OS, this is used to reflect the theme color onto the window frame.
*/
EVENT_DEF(EventThemeChanged);
/**
* @brief Signals that a bookmark was created
*
* For now, this event's only purpose is to unlock an achievement.
*
* @param entry the new bookmark
*/
EVENT_DEF(EventBookmarkCreated, ImHexApi::Bookmarks::Entry&);
/**
* @brief Called upon creation of an IPS patch.
* As for now, the event only serves a purpose for the achievement unlock.
*
* @param data the pointer to the patch content's start
* @param size the patch data size
* @param kind the patch's kind
*/
EVENT_DEF(EventPatchCreated, const u8*, u64, const PatchKind);
/**
* @brief Signals the beginning of evaluation of the current pattern
*
* This allows resetting the drawer view for the pattern data while we wait for the execution completion.
*/
EVENT_DEF(EventPatternEvaluating);
/**
* @brief Signals the completion of the pattern evaluation
*
* This causes another reset in the drawer view, to refresh the table displayed to the user.
*
* @param code the execution's status code
*/
EVENT_DEF(EventPatternExecuted, const std::string&);
/**
* @brief Denotes when pattern editor has changed
*
* FIXME: this event is unused and should be scrapped.
*/
EVENT_DEF(EventPatternEditorChanged, const std::string&);
/**
* @brief Signals that a Content Store item was downloaded
*
* FIXME: this event is unused and should be scrapped.
*
* @param path the item's path on the filesystem
*/
EVENT_DEF(EventStoreContentDownloaded, const std::fs::path&);
/**
* @brief Signals the removal of a Content Store item
*
* Note: at the time of the event firing, the item has already been removed from the filesystem.
*
* FIXME: this event is unused and should be scrapped.
*
* @param path the item's old file path where it used to be in the filesystem
*/
EVENT_DEF(EventStoreContentRemoved, const std::fs::path&);
/**
* @brief Signals the unlocking of an achievement
*
* This is used by the achievement manager to refresh the achievement display, as well as store progress to
* the appropriate storage file.
*
* @param achievement the achievement that was unlocked
*/
EVENT_DEF(EventAchievementUnlocked, const Achievement&);
/**
* @brief Signals a click on the search box
*
* As there are different behaviours depending on the click (left or right) done by the user,
* this allows the consequences of said click to be registered in their own components.
*
* @param button the ImGuiMouseButton's value
*/
EVENT_DEF(EventSearchBoxClicked, u32);
/**
* @brief Updates on whether a file is being dragged into ImHex
*
* Allows ImGUi to display a file dragging information on screen when a file is being dragged.
*
* @param isFileDragged true if a file is being dragged
*/
EVENT_DEF(EventFileDragged, bool);
/**
* @brief Triggers loading when a file is dropped
*
* The event fires when a file is dropped into ImHex, which passes it to file handlers to load it.
*
* @param path the dropped file's path
*/
EVENT_DEF(EventFileDropped, std::fs::path);
}

View File

@@ -0,0 +1,78 @@
#pragma once
#include <hex/api/event_manager.hpp>
/* Lifecycle events definitions */
namespace hex {
/**
* @brief Called when Imhex finished startup, and will enter the main window rendering loop
*/
EVENT_DEF(EventImHexStartupFinished);
/**
* @brief Called when ImHex is closing, to trigger the last shutdown hooks
*
* This is the last event to fire before complete graceful shutdown.
*/
EVENT_DEF(EventImHexClosing);
/**
* @brief Signals that it's ImHex first launch ever
*
* This event allows for the launch of the ImHex tutorial (also called Out of Box experience).
*/
EVENT_DEF(EventFirstLaunch);
/**
* FIXME: this event is unused and should be scrapped.
*/
EVENT_DEF(EventAnySettingChanged);
/**
* @brief Ensures correct plugin cleanup on crash
*
* This event is fired when catching an unexpected error that cannot be recovered and
* which forces Imhex to close immediately.
*
* Subscribing to this event ensures that the plugin can correctly clean up any mission-critical tasks
* before forceful shutdown.
*
* @param signal the POSIX signal code
*/
EVENT_DEF(EventAbnormalTermination, int);
/**
* @brief Informs of the ImHex versions (and difference, if any)
*
* Called on every startup to inform subscribers of the two versions picked up:
* - the version of the previous launch, gathered from the settings file
* - the current version, gathered directly from C++ code
*
* In most cases, and unless ImHex was updated, the two parameters will be the same.
*
* FIXME: Maybe rename the event to signal a startup information, instead of the misleading
* title that the event could be fired when ImHex detects that it was updated since last launch?
*
* @param previousLaunchVersion ImHex's version during the previous launch
* @param currentVersion ImHex's current version for this startup
*/
EVENT_DEF(EventImHexUpdated, SemanticVersion, SemanticVersion);
/**
* @brief Called when ImHex managed to catch an error in a general try/catch to prevent/recover from a crash
*/
EVENT_DEF(EventCrashRecovered, const std::exception &);
/**
* @brief Called when a project has been loaded
*/
EVENT_DEF(EventProjectOpened);
/**
* @brief Called when a native message was received from another ImHex instance
* @param rawData Raw bytes received from other instance
*/
EVENT_DEF(EventNativeMessageReceived, std::vector<u8>);
}

View File

@@ -0,0 +1,113 @@
#pragma once
#include <hex.hpp>
#include <hex/api/event_manager.hpp>
/* Provider events definitions */
namespace hex {
/**
* @brief Called when the provider is created.
* This event is responsible for (optionally) initializing the provider and calling EventProviderOpened
* (although the event can also be called manually without problem)
*/
EVENT_DEF(EventProviderCreated, prv::Provider *);
/**
* @brief Called as a continuation of EventProviderCreated
* this event is normally called immediately after EventProviderCreated successfully initialized the provider.
* If no initialization (Provider::skipLoadInterface() has been set), this event should be called manually
* If skipLoadInterface failed, this event is not called
*
* @note this is not related to Provider::open()
*/
EVENT_DEF(EventProviderOpened, prv::Provider *);
/**
* @brief Signals a change in provider (in-place)
*
* Note: if the provider was deleted, the new ("current") provider will be `nullptr`
*
* @param oldProvider the old provider
* @param currentProvider the current provider
*/
EVENT_DEF(EventProviderChanged, prv::Provider *, prv::Provider *);
/**
* @brief Signals that a provider was saved
*
* @param provider the saved provider
*/
EVENT_DEF(EventProviderSaved, prv::Provider *);
/**
* @brief Signals a provider is closing
*
* FIXME: as for now, this behaves as a request more than an event. Also, the boolean is always set to true,
* and serves no purpose. This should be moved into the Provider requests section and declared accordingly.
*
* @param provider the closing provider
* @param shouldClose whether the provider should close
*/
EVENT_DEF(EventProviderClosing, prv::Provider *, bool *);
/**
* @brief Signals that a provider was closed
*
* As this is a closure information broadcast, the provider should generally not be accessed, as it could
* result in problems.
*
* @param provider the now-closed provider
*/
EVENT_DEF(EventProviderClosed, prv::Provider *);
/**
* @brief Signals that a provider is being deleted
*
* Provider's data should not be accessed.
*
* @param provider the provider
*/
EVENT_DEF(EventProviderDeleted, prv::Provider *);
}
/* Provider data events definitions */
namespace hex {
/**
* @brief Signals the dirtying of a provider
*
* Any data modification that occurs in a provider dirties it, until its state is either saved or restored.
* This event signals that fact to subscribers so additional code can be executed for certain cases.
*/
EVENT_DEF(EventProviderDirtied, prv::Provider *);
/**
* @brief Signals an insertion of new data into a provider
*
* @param provider the provider
* @param offset the start of the insertion
* @param size the new data's size
*/
EVENT_DEF(EventProviderDataInserted, prv::Provider *, u64, u64);
/**
* @brief Signals a modification in the provider's data
*
* @param provider the provider
* @param offset the data modification's offset (start address)
* @param size the buffer's size
* @param buffer the modified data written at this address
*/
EVENT_DEF(EventProviderDataModified, prv::Provider *, u64, u64, const u8*);
/**
* @brief Signals a removal of some of the provider's data
*
* @param provider the provider
* @param offset the deletion offset (start address)
* @param size the deleted data's size
*/
EVENT_DEF(EventProviderDataRemoved, prv::Provider *, u64, u64);
}

View File

@@ -0,0 +1,37 @@
#pragma once
#include <hex/api/event_manager.hpp>
/* GUI requests definitions */
namespace hex {
/**
* @brief Requests the opening of a new window.
*
* @param name the window's name
*/
EVENT_DEF(RequestOpenWindow, std::string);
/**
* @brief Centralized request to update ImHex's main window title
*
* This request can be called to make ImHex refresh its main window title, taking into account a new project
* or file opened/closed.
*/
EVENT_DEF(RequestUpdateWindowTitle);
/**
* @brief Requests a theme type (light or dark) change
*
* @param themeType either `Light` or `Dark`
*/
EVENT_DEF(RequestChangeTheme, std::string);
/**
* @brief Requests the opening of a popup
*
* @param name the popup's name
*/
EVENT_DEF(RequestOpenPopup, std::string);
}

View File

@@ -0,0 +1,116 @@
#pragma once
#include <hex.hpp>
#include <hex/api/event_manager.hpp>
/* Forward declarations */
namespace pl::ptrn { class Pattern; }
/* Interaction requests definitions */
namespace hex {
/**
* @brief Requests a selection change in the Hex editor
*
* This request is handled by the Hex editor, which proceeds to check if the selection is valid.
* If it is invalid, the Hex editor fires the `EventRegionSelected` event with nullptr region info.
*
* @param region the region that should be selected
*/
EVENT_DEF(RequestHexEditorSelectionChange, ImHexApi::HexEditor::ProviderRegion);
/**
* @brief Requests the Pattern editor to move selection
*
* Requests the Pattern editor to move the cursor's position to reflect the user's click or movement.
*
* @param line the target line
* @param column the target column
*/
EVENT_DEF(RequestPatternEditorSelectionChange, u32, u32);
/**
* @brief Requests a jump to a given pattern
*
* This request is fired by the Hex editor when the user asks to jump to the pattern.
* It is then caught and reflected by the Pattern data component.
*
* @param pattern the pattern to jump to
*/
EVENT_DEF(RequestJumpToPattern, const pl::ptrn::Pattern*);
/**
* @brief Requests to add a bookmark
*
* @param region the region to be bookmarked
* @param name the bookmark's name
* @param comment a comment
* @param color the color
* @param id the bookmark's unique ID
*/
EVENT_DEF(RequestAddBookmark, Region, std::string, std::string, color_t, u64*);
/**
* @brief Requests a bookmark removal
*
* @param id the bookmark's unique ID
*/
EVENT_DEF(RequestRemoveBookmark, u64);
/**
* @brief Request the Pattern editor to set its code
*
* This request allows the rest of ImHex to interface with the Pattern editor component, by setting its code.
* This allows for `.hexpat` file loading, and more.
*
* @param code the code's string
*/
EVENT_DEF(RequestSetPatternLanguageCode, std::string);
/**
* @brief Requests the Pattern editor to run the current code
*
* This is only ever used in the introduction tutorial.
*
* FIXME: the name is misleading, as for now this activates the pattern's auto-evaluation rather than a
* one-off execution
*/
EVENT_DEF(RequestRunPatternCode);
/**
* @brief Request to load a pattern language file
*
* FIXME: this request is unused, as now another component is responsible for pattern file loading.
* This request should be scrapped.
*
* @param path the pattern file's path
*/
EVENT_DEF(RequestLoadPatternLanguageFile, std::fs::path);
/**
* @brief Request to save a pattern language file
*
* FIXME: this request is unused, as now another component is responsible for pattern file saving.
* This request should be scrapped.
*
* @param path the pattern file's path
*/
EVENT_DEF(RequestSavePatternLanguageFile, std::fs::path);
/**
* @brief Requests ImHex to open and process a file
*
* @param path the file's path
*/
EVENT_DEF(RequestOpenFile, std::fs::path);
/**
* @brief Adds a virtual file in the Pattern editor
*
* @param path the file's path
* @param data the file's data
* @param region the impacted region
*/
EVENT_DEF(RequestAddVirtualFile, std::fs::path, std::vector<u8>, Region);
}

View File

@@ -0,0 +1,84 @@
#pragma once
#include <hex.hpp>
#include <hex/api/event_manager.hpp>
/* Lifecycle requests definitions */
namespace hex {
/**
* @brief Emit a request to add an initialization task to the list
*
* These tasks will be executed at startup.
*
* @param name Name of the init task
* @param isAsync Whether the task is asynchronous (true if yes)
* @param callbackFunction The function to call to execute the task
*/
EVENT_DEF(RequestAddInitTask, std::string, bool, std::function<bool()>);
/**
* @brief Emit a request to add an exit task to the list
*
* These tasks will be executed during the exit phase.
*
* FIXME: request is unused and should be scrapped.
*
* @param name Name of the exit task
* @param callbackFunction The function to call to execute the task
*/
EVENT_DEF(RequestAddExitTask, std::string, std::function<bool()>);
/**
* @brief Requests ImHex's graceful shutdown
*
* If there are no questions (bool set to true), ImHex closes immediately.
* If set to false, there is a procedure run to prompt a confirmation to the user.
*
* @param noQuestions true if no questions
*/
EVENT_DEF(RequestCloseImHex, bool);
/**
* @brief Requests ImHex's restart
*
* This event is necessary for ImHex to restart in the main loop for native and web platforms,
* as ImHex cannot simply close and re-open.
*
* This event serves no purpose on Linux, Windows and macOS platforms.
*/
EVENT_DEF(RequestRestartImHex);
/**
* @brief Requests the initialization of theme handlers
*
* This is called during ImGui bootstrapping, and should not be called at any other time.
*/
EVENT_DEF(RequestInitThemeHandlers);
/**
* @brief Requests version and first-startup checks
*
* This request is called during ImHex's startup, and allows ImHex to check if it was updated since last launch.
* It also ensures newcomers (that open ImHex for the first time) are greeted with the tutorial.
*
* FIXME: the name is misleading, as this request does not effectively start any migration. It only executes
* checks about ImHex's version. The name should be changed to reflect this behaviour.
*/
EVENT_DEF(RequestStartMigration);
/**
* @brief Send a subcommand to the main Imhex instance
*
* This request is called to send a subcommand to the main ImHex instance.
* This subcommand will then be executed by a handler when ImHex finishing initializing
* (`EventImHexStartupFinished`).
*
* FIXME: change the name so that it is prefixed with "Request" like every other request.
*
* @param name the subcommand's name
* @param data the subcommand's data
*/
EVENT_DEF(SendMessageToMainInstance, const std::string, const std::vector<u8>&);
}

View File

@@ -0,0 +1,22 @@
#pragma once
#include <hex/api/event_manager.hpp>
/* Provider requests definitions */
namespace hex {
/**
* @brief Creates a provider from its unlocalized name, and add it to the provider list
*/
EVENT_DEF(RequestCreateProvider, std::string, bool, bool, hex::prv::Provider **);
/**
* @brief Move the data from all PerProvider instances from one provider to another
*
* The 'from' provider should not have any per provider data after this, and should be immediately deleted
*
* FIXME: rename with the "Request" prefix to apply standard naming convention.
*/
EVENT_DEF(MovePerProviderData, prv::Provider *, prv::Provider *);
}

View File

@@ -2,25 +2,39 @@
#include <hex.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/helpers/semantic_version.hpp>
#include <hex/helpers/utils.hpp>
#include <hex/helpers/fs.hpp>
#include <functional>
#include <optional>
#include <span>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <memory>
#include "imgui_internal.h"
#include <wolv/io/fs.hpp>
#if !defined(HEX_MODULE_EXPORT)
using ImGuiID = unsigned int;
struct ImVec2;
struct ImFontAtlas;
struct ImFont;
#endif
struct GLFWwindow;
using ImGuiID = unsigned int;
struct ImVec2;
struct ImFontAtlas;
struct ImFont;
EXPORT_MODULE namespace hex {
namespace hex {
#if !defined(HEX_MODULE_EXPORT)
namespace impl {
class AutoResetBase;
}
namespace prv {
class Provider;
}
namespace prv {
class Provider;
}
#endif
namespace ImHexApi {
@@ -34,8 +48,8 @@ namespace hex {
Highlighting() = default;
Highlighting(Region region, color_t color);
[[nodiscard]] const Region &getRegion() const { return m_region; }
[[nodiscard]] const color_t &getColor() const { return m_color; }
[[nodiscard]] const Region& getRegion() const { return m_region; }
[[nodiscard]] const color_t& getColor() const { return m_color; }
private:
Region m_region = {};
@@ -47,9 +61,9 @@ namespace hex {
Tooltip() = default;
Tooltip(Region region, std::string value, color_t color);
[[nodiscard]] const Region &getRegion() const { return m_region; }
[[nodiscard]] const color_t &getColor() const { return m_color; }
[[nodiscard]] const std::string &getValue() const { return m_value; }
[[nodiscard]] const Region& getRegion() const { return m_region; }
[[nodiscard]] const color_t& getColor() const { return m_color; }
[[nodiscard]] const std::string& getValue() const { return m_value; }
private:
Region m_region = {};
@@ -68,15 +82,18 @@ namespace hex {
namespace impl {
using HighlightingFunction = std::function<std::optional<color_t>(u64, const u8*, size_t, bool)>;
using HoveringFunction = std::function<std::set<Region>(const prv::Provider *, u64, size_t)>;
std::map<u32, Highlighting> &getBackgroundHighlights();
std::map<u32, HighlightingFunction> &getBackgroundHighlightingFunctions();
std::map<u32, Highlighting> &getForegroundHighlights();
std::map<u32, HighlightingFunction> &getForegroundHighlightingFunctions();
std::map<u32, Tooltip> &getTooltips();
std::map<u32, TooltipFunction> &getTooltipFunctions();
const std::map<u32, Highlighting>& getBackgroundHighlights();
const std::map<u32, HighlightingFunction>& getBackgroundHighlightingFunctions();
const std::map<u32, Highlighting>& getForegroundHighlights();
const std::map<u32, HighlightingFunction>& getForegroundHighlightingFunctions();
const std::map<u32, HoveringFunction>& getHoveringFunctions();
const std::map<u32, Tooltip>& getTooltips();
const std::map<u32, TooltipFunction>& getTooltipFunctions();
void setCurrentSelection(const std::optional<ProviderRegion> &region);
void setHoveredRegion(const prv::Provider *provider, const Region &region);
}
/**
@@ -165,6 +182,19 @@ namespace hex {
*/
void removeForegroundHighlightingProvider(u32 id);
/**
* @brief Adds a hovering provider to the Hex Editor using a callback function
* @param function Function that draws the highlighting based on the hovered region
* @return Unique ID used to remove the highlighting again later
*/
u32 addHoverHighlightProvider(const impl::HoveringFunction &function);
/**
* @brief Removes a hovering color highlighting from the Hex Editor
* @param id The ID of the highlighting to remove
*/
void removeHoverHighlightProvider(u32 id);
/**
* @brief Checks if there's a valid selection in the Hex Editor right now
*/
@@ -202,6 +232,20 @@ namespace hex {
*/
void setSelection(u64 address, size_t size, prv::Provider *provider = nullptr);
/**
* @brief Adds a virtual file to the list in the Hex Editor
* @param path The path of the file
* @param data The data of the file
* @param region The location of the file in the Hex Editor if available
*/
void addVirtualFile(const std::fs::path &path, std::vector<u8> data, Region region = Region::Invalid());
/**
* @brief Gets the currently hovered cell region in the Hex Editor
* @return
*/
const std::optional<Region>& getHoveredRegion(const prv::Provider *provider);
}
/* Functions to interact with Bookmarks */
@@ -256,7 +300,7 @@ namespace hex {
namespace impl {
void resetClosingProvider();
const std::vector<prv::Provider*>& getClosingProviders();
std::set<prv::Provider*> getClosingProviders();
}
@@ -270,13 +314,19 @@ namespace hex {
* @brief Gets a list of all currently loaded data providers
* @return The currently loaded data providers
*/
const std::vector<prv::Provider *> &getProviders();
std::vector<prv::Provider*> getProviders();
/**
* @brief Sets the currently selected data provider
* @param index Index of the provider to select
*/
void setCurrentProvider(u32 index);
void setCurrentProvider(i64 index);
/**
* @brief Sets the currently selected data provider
* @param provider The provider to select
*/
void setCurrentProvider(NonNull<prv::Provider*> provider);
/**
* @brief Gets the index of the currently selected data provider
@@ -314,7 +364,7 @@ namespace hex {
* @param skipLoadInterface Whether to skip the provider's loading interface (see property documentation)
* @param select Whether to select the provider after adding it
*/
void add(prv::Provider *provider, bool skipLoadInterface = false, bool select = true);
void add(std::unique_ptr<prv::Provider> &&provider, bool skipLoadInterface = false, bool select = true);
/**
* @brief Creates a new provider and adds it to the list of providers
@@ -323,7 +373,7 @@ namespace hex {
*/
template<std::derived_from<prv::Provider> T>
void add(auto &&...args) {
add(new T(std::forward<decltype(args)>(args)...));
add(std::make_unique<T>(std::forward<decltype(args)>(args)...));
}
/**
@@ -339,42 +389,29 @@ namespace hex {
* @param skipLoadInterface Whether to skip the provider's loading interface (see property documentation)
* @param select Whether to select the provider after adding it
*/
prv::Provider* createProvider(const UnlocalizedString &unlocalizedName, bool skipLoadInterface = false, bool select = true);
prv::Provider* createProvider(
const UnlocalizedString &unlocalizedName,
bool skipLoadInterface = false,
bool select = true
);
}
/* Functions to interact with various ImHex system settings */
namespace System {
bool isMainInstance();
namespace impl {
void setMainInstanceStatus(bool status);
void setMainWindowPosition(i32 x, i32 y);
void setMainWindowSize(u32 width, u32 height);
void setMainDockSpaceId(ImGuiID id);
void setGlobalScale(float scale);
void setNativeScale(float scale);
void setBorderlessWindowMode(bool enabled);
void setGPUVendor(const std::string &vendor);
void setPortableVersion(bool enabled);
void addInitArgument(const std::string &key, const std::string &value = { });
void setLastFrameTime(double time);
}
struct ProgramArguments {
int argc;
char **argv;
char **envp;
};
struct InitialWindowProperties {
i32 x, y;
u32 width, height;
bool maximized;
};
enum class TaskProgressState {
Reset,
Progress,
@@ -387,6 +424,38 @@ namespace hex {
Error
};
namespace impl {
void setMainInstanceStatus(bool status);
void setMainWindowPosition(i32 x, i32 y);
void setMainWindowSize(u32 width, u32 height);
void setMainDockSpaceId(ImGuiID id);
void setMainWindowHandle(GLFWwindow *window);
void setGlobalScale(float scale);
void setNativeScale(float scale);
void setBorderlessWindowMode(bool enabled);
void setMultiWindowMode(bool enabled);
void setInitialWindowProperties(InitialWindowProperties properties);
void setGPUVendor(const std::string &vendor);
void setGLRenderer(const std::string &renderer);
void addInitArgument(const std::string &key, const std::string &value = { });
void setLastFrameTime(double time);
bool isWindowResizable();
void addAutoResetObject(hex::impl::AutoResetBase *object);
void removeAutoResetObject(hex::impl::AutoResetBase *object);
void cleanup();
}
/**
* @brief Closes ImHex
* @param noQuestions Whether to skip asking the user for confirmation
@@ -432,6 +501,7 @@ namespace hex {
*/
float getNativeScale();
float getBackingScaleFactor();
/**
* @brief Gets the current main window position
@@ -451,6 +521,11 @@ namespace hex {
*/
ImGuiID getMainDockSpaceId();
/**
* @brief Gets the main window's GLFW window handle
* @return GLFW window handle
*/
GLFWwindow* getMainWindowHandle();
/**
* @brief Checks if borderless window mode is enabled currently
@@ -458,11 +533,24 @@ namespace hex {
*/
bool isBorderlessWindowModeEnabled();
/**
* @brief Checks if multi-window mode is enabled currently
* @return Whether multi-window mode is enabled
*/
bool isMutliWindowModeEnabled();
/**
* @brief Gets the init arguments passed to ImHex from the splash screen
* @return Init arguments
*/
std::map<std::string, std::string> &getInitArguments();
const std::map<std::string, std::string>& getInitArguments();
/**
* @brief Gets a init arguments passed to ImHex from the splash screen
* @param key The key of the init argument
* @return Init argument
*/
std::string getInitArgument(const std::string &key);
/**
* @brief Sets if ImHex should follow the system theme
@@ -481,7 +569,7 @@ namespace hex {
* @brief Gets the currently set additional folder paths
* @return The currently set additional folder paths
*/
std::vector<std::filesystem::path> &getAdditionalFolderPaths();
const std::vector<std::filesystem::path>& getAdditionalFolderPaths();
/**
* @brief Sets the additional folder paths
@@ -494,7 +582,21 @@ namespace hex {
* @brief Gets the current GPU vendor
* @return The current GPU vendor
*/
const std::string &getGPUVendor();
const std::string& getGPUVendor();
/**
* @brief Gets the current GPU vendor
* @return The current GPU vendor
*/
const std::string& getGLRenderer();
/**
* @brief Checks if ImHex is being run in a "Corporate Environment"
* This function simply checks for common telltale signs such as if the machine is joined a
* domain. It's not super accurate, but it's still useful for statistics
* @return True if it is
*/
bool isCorporateEnvironment();
/**
* @brief Checks if ImHex is running in portable mode
@@ -520,11 +622,21 @@ namespace hex {
*/
std::string getArchitecture();
struct LinuxDistro {
std::string name;
std::string version;
};
/**
* @brief Gets information related to the Linux distribution, if running on Linux
*/
std::optional<LinuxDistro> getLinuxDistro();
/**
* @brief Gets the current ImHex version
* @return ImHex version
*/
std::string getImHexVersion(bool withBuildType = true);
SemanticVersion getImHexVersion();
/**
* @brief Gets the current git commit hash
@@ -545,6 +657,12 @@ namespace hex {
*/
bool isDebugBuild();
/**
* @brief Checks if this version of ImHex is a nightly build
* @return True if this version is a nightly, false if it's a release
*/
bool isNightlyBuild();
enum class UpdateType {
Stable,
Nightly
@@ -557,9 +675,51 @@ namespace hex {
*/
bool updateImHex(UpdateType updateType);
/**
* @brief Add a new startup task that will be run while ImHex's splash screen is shown
* @param name Name to be shown in the UI
* @param async Whether to run the task asynchronously
* @param function The function to run
*/
void addStartupTask(const std::string &name, bool async, const std::function<bool()> &function);
/**
* @brief Gets the time the previous frame took
* @return Previous frame time
*/
double getLastFrameTime();
/**
* @brief Sets the window resizable
* @param resizable Whether the window should be resizable
*/
void setWindowResizable(bool resizable);
/**
* @brief Checks if this window is the main instance of ImHex
* @return True if this is the main instance, false if another instance is already running
*/
bool isMainInstance();
/**
* @brief Gets the initial window properties
* @return Initial window properties
*/
std::optional<InitialWindowProperties> getInitialWindowProperties();
/**
* @brief Gets the module handle of libimhex
* @return Module handle
*/
void* getLibImHexModuleHandle();
/**
* Adds a new migration routine that will be executed when upgrading from a lower version than specified in migrationVersion
* @param migrationVersion Upgrade point version
* @param function Function to run
*/
void addMigrationRoutine(SemanticVersion migrationVersion, std::function<void()> function);
}
/**
@@ -569,11 +729,12 @@ namespace hex {
namespace Messaging {
namespace impl {
using MessagingHandler = std::function<void(const std::vector<u8> &)>;
std::map<std::string, MessagingHandler> &getHandlers();
const std::map<std::string, MessagingHandler>& getHandlers();
void runHandler(const std::string &eventName, const std::vector<u8> &args);
}
/**
@@ -593,17 +754,16 @@ namespace hex {
std::vector<GlyphRange> glyphRanges;
Offset offset;
u32 flags;
std::optional<bool> scalable;
std::optional<u32> defaultSize;
};
namespace impl {
std::vector<Font>& getFonts();
const std::vector<Font>& getFonts();
void setCustomFontPath(const std::fs::path &path);
void setFontSize(float size);
void setFontAtlas(ImFontAtlas *fontAtlas);
std::map<UnlocalizedString, ImFont*>& getFontDefinitions();
void setFonts(ImFont *bold, ImFont *italic);
}
GlyphRange glyph(const char *glyph);
@@ -611,31 +771,17 @@ namespace hex {
GlyphRange range(const char *glyphBegin, const char *glyphEnd);
GlyphRange range(u32 codepointBegin, u32 codepointEnd);
void loadFont(const std::fs::path &path, const std::vector<GlyphRange> &glyphRanges = {}, Offset offset = {}, u32 flags = 0);
void loadFont(const std::string &name, const std::span<const u8> &data, const std::vector<GlyphRange> &glyphRanges = {}, Offset offset = {}, u32 flags = 0);
void loadFont(const std::fs::path &path, const std::vector<GlyphRange> &glyphRanges = {}, Offset offset = {}, u32 flags = 0, std::optional<bool> scalable = std::nullopt, std::optional<u32> defaultSize = std::nullopt);
void loadFont(const std::string &name, const std::span<const u8> &data, const std::vector<GlyphRange> &glyphRanges = {}, Offset offset = {}, u32 flags = 0, std::optional<bool> scalable = std::nullopt, std::optional<u32> defaultSize = std::nullopt);
constexpr static float DefaultFontSize = 13.0;
constexpr float DefaultFontSize = 13.0;
ImFont* Bold();
ImFont* Italic();
void registerFont(const UnlocalizedString &fontName);
ImFont* getFont(const UnlocalizedString &fontName);
/**
* @brief Gets the current custom font path
* @return The current custom font path
*/
std::filesystem::path &getCustomFontPath();
/**
* @brief Gets the current font size
* @return The current font size
*/
float getFontSize();
/**
* @brief Gets the current font atlas
* @return Current font atlas
*/
ImFontAtlas* getFontAtlas();
float getDpi();
float pixelsToPoints(float pixels);
float pointsToPixels(float points);
}

View File

@@ -4,7 +4,11 @@
#include <string>
namespace hex {
#if !defined(HEX_MODULE_EXPORT)
struct ImGuiTextBuffer;
#endif
EXPORT_MODULE namespace hex {
class LayoutManager {
public:
@@ -13,6 +17,9 @@ namespace hex {
std::fs::path path;
};
using LoadCallback = std::function<void(std::string_view)>;
using StoreCallback = std::function<void(ImGuiTextBuffer *)>;
/**
* @brief Save the current layout
* @param name Name of the layout
@@ -41,7 +48,13 @@ namespace hex {
* @brief Get a list of all layouts
* @return List of all added layouts
*/
static std::vector<Layout> getLayouts();
static const std::vector<Layout> &getLayouts();
/**
* @brief Removes the layout with the given name
* @param name Name of the layout
*/
static void removeLayout(const std::string &name);
/**
* @brief Handles loading of layouts if needed
@@ -76,6 +89,12 @@ namespace hex {
*/
static void closeAllViews();
static void registerLoadCallback(const LoadCallback &callback);
static void registerStoreCallback(const StoreCallback &callback);
static void onStore(ImGuiTextBuffer *buffer);
static void onLoad(std::string_view line);
private:
LayoutManager() = default;
};

View File

@@ -1,12 +1,16 @@
#pragma once
#include <hex.hpp>
#include <map>
#include <string>
#include <string_view>
#include <vector>
#include <fmt/format.h>
#include <fmt/core.h>
#include <wolv/types/static_string.hpp>
namespace hex {
EXPORT_MODULE namespace hex {
namespace LocalizationManager {
@@ -21,23 +25,30 @@ namespace hex {
};
namespace impl {
void setFallbackLanguage(const std::string &language);
void resetLanguageStrings();
}
void loadLanguage(const std::string &language);
void loadLanguage(std::string language);
std::string getLocalizedString(const std::string &unlocalizedString, const std::string &language = "");
[[nodiscard]] const std::map<std::string, std::string> &getSupportedLanguages();
[[nodiscard]] const std::string &getFallbackLanguage();
[[nodiscard]] const std::string &getSelectedLanguage();
}
struct UnlocalizedString;
class LangConst;
class Lang {
public:
explicit Lang(const char *unlocalizedString);
explicit Lang(const std::string &unlocalizedString);
explicit(false) Lang(const LangConst &localizedString);
explicit Lang(const UnlocalizedString &unlocalizedString);
explicit Lang(std::string_view unlocalizedString);
@@ -45,31 +56,54 @@ namespace hex {
[[nodiscard]] operator std::string_view() const;
[[nodiscard]] operator const char *() const;
[[nodiscard]] const std::string &get() const;
const char* get() const;
private:
std::size_t m_entryHash;
std::string m_unlocalizedString;
};
[[nodiscard]] std::string operator+(const std::string &&left, const Lang &&right);
[[nodiscard]] std::string operator+(const Lang &&left, const std::string &&right);
[[nodiscard]] std::string operator+(const std::string_view &&left, const Lang &&right);
[[nodiscard]] std::string operator+(const Lang &&left, const std::string_view &&right);
[[nodiscard]] std::string operator+(const char *left, const Lang &&right);
[[nodiscard]] std::string operator+(const Lang &&left, const char *right);
[[nodiscard]] std::string operator+(const Lang &&left, const Lang &&right);
class LangConst {
public:
[[nodiscard]] operator std::string() const;
[[nodiscard]] operator std::string_view() const;
[[nodiscard]] operator const char *() const;
[[nodiscard]] inline Lang operator""_lang(const char *string, size_t) {
return Lang(string);
}
const char* get() const;
constexpr static size_t hash(std::string_view string) {
constexpr u64 p = 131;
constexpr u64 m = std::numeric_limits<std::uint32_t>::max() - 4;
u64 total = 0;
u64 currentMultiplier = 1;
for (char c : string) {
total = (total + currentMultiplier * c) % m;
currentMultiplier = (currentMultiplier * p) % m;
}
return total;
}
private:
constexpr explicit LangConst(std::size_t hash, const char *unlocalizedString) : m_entryHash(hash), m_unlocalizedString(unlocalizedString) {}
template<wolv::type::StaticString>
friend consteval LangConst operator""_lang();
friend class Lang;
private:
std::size_t m_entryHash;
const char *m_unlocalizedString = nullptr;
};
struct UnlocalizedString {
public:
UnlocalizedString() = default;
UnlocalizedString(auto && arg) : m_unlocalizedString(std::forward<decltype(arg)>(arg)) {
static_assert(!std::same_as<std::remove_cvref_t<decltype(arg)>, Lang>, "Expected a unlocalized name, got a localized one!");
}
UnlocalizedString(const std::string &string) : m_unlocalizedString(string) { }
UnlocalizedString(const char *string) : m_unlocalizedString(string) { }
UnlocalizedString(const Lang& arg) = delete;
[[nodiscard]] operator std::string() const {
return m_unlocalizedString;
@@ -100,12 +134,24 @@ namespace hex {
std::string m_unlocalizedString;
};
template<wolv::type::StaticString String>
[[nodiscard]] consteval LangConst operator""_lang() {
return LangConst(LangConst::hash(String.value.data()), String.value.data());
}
// {fmt} formatter for hex::Lang and hex::LangConst
inline auto format_as(const hex::Lang &entry) {
return entry.get();
}
inline auto format_as(const hex::LangConst &entry) {
return entry.get();
}
}
template<>
struct fmt::formatter<hex::Lang> : fmt::formatter<std::string_view> {
template<typename FormatContext>
auto format(const hex::Lang &entry, FormatContext &ctx) {
return fmt::formatter<std::string_view>::format(entry.get(), ctx);
struct std::hash<hex::UnlocalizedString> {
std::size_t operator()(const hex::UnlocalizedString &string) const noexcept {
return std::hash<std::string>{}(string.get());
}
};

View File

@@ -1,48 +1,69 @@
#pragma once
#include <functional>
#include <list>
#include <span>
#include <string>
#include <wolv/io/fs.hpp>
#include <hex/helpers/logger.hpp>
#include <hex/helpers/auto_reset.hpp>
struct ImGuiContext;
#if !defined(HEX_MODULE_EXPORT)
struct ImGuiContext;
#endif
namespace hex {
EXPORT_MODULE namespace hex {
struct SubCommand {
std::string commandKey;
std::string commandDesc;
enum class Type : u8 {
Option,
SubCommand
};
std::string commandLong;
std::string commandShort;
std::string commandDescription;
std::function<void(const std::vector<std::string>&)> callback;
Type type = Type::Option;
};
struct Feature {
std::string name;
bool enabled;
};
struct PluginFunctions {
using InitializePluginFunc = void (*)();
using InitializeLibraryFunc = void (*)();
using GetPluginNameFunc = const char *(*)();
using GetLibraryNameFunc = const char *(*)();
using GetPluginAuthorFunc = const char *(*)();
using GetPluginDescriptionFunc = const char *(*)();
using GetCompatibleVersionFunc = const char *(*)();
using SetImGuiContextFunc = void (*)(ImGuiContext *);
using IsBuiltinPluginFunc = bool (*)();
using GetSubCommandsFunc = void* (*)();
using GetFeaturesFunc = void* (*)();
InitializePluginFunc initializePluginFunction = nullptr;
InitializeLibraryFunc initializeLibraryFunction = nullptr;
GetPluginNameFunc getPluginNameFunction = nullptr;
GetLibraryNameFunc getLibraryNameFunction = nullptr;
GetPluginAuthorFunc getPluginAuthorFunction = nullptr;
GetPluginDescriptionFunc getPluginDescriptionFunction = nullptr;
GetCompatibleVersionFunc getCompatibleVersionFunction = nullptr;
SetImGuiContextFunc setImGuiContextFunction = nullptr;
IsBuiltinPluginFunc isBuiltinPluginFunction = nullptr;
SetImGuiContextFunc setImGuiContextLibraryFunction = nullptr;
GetSubCommandsFunc getSubCommandsFunction = nullptr;
GetFeaturesFunc getFeaturesFunction = nullptr;
};
class Plugin {
public:
explicit Plugin(const std::fs::path &path);
explicit Plugin(const PluginFunctions &functions);
explicit Plugin(const std::string &name, const PluginFunctions &functions);
Plugin(const Plugin &) = delete;
Plugin(Plugin &&other) noexcept;
@@ -57,7 +78,6 @@ namespace hex {
[[nodiscard]] std::string getPluginDescription() const;
[[nodiscard]] std::string getCompatibleVersion() const;
void setImGuiContext(ImGuiContext *ctx) const;
[[nodiscard]] bool isBuiltinPlugin() const;
[[nodiscard]] const std::fs::path &getPath() const;
@@ -65,14 +85,18 @@ namespace hex {
[[nodiscard]] bool isLoaded() const;
[[nodiscard]] std::span<SubCommand> getSubCommands() const;
[[nodiscard]] std::span<Feature> getFeatures() const;
[[nodiscard]] bool isLibraryPlugin() const;
[[nodiscard]] bool wasAddedManually() const;
private:
uintptr_t m_handle = 0;
std::fs::path m_path;
mutable bool m_initialized = false;
bool m_addedManually = false;
PluginFunctions m_functions = {};
@@ -88,14 +112,31 @@ namespace hex {
public:
PluginManager() = delete;
static bool load();
static bool load(const std::fs::path &pluginFolder);
static bool loadLibraries();
static bool loadLibraries(const std::fs::path &libraryFolder);
static void unload();
static void reload();
static void initializeNewPlugins();
static void addLoadPath(const std::fs::path &path);
static void addPlugin(PluginFunctions functions);
static void addPlugin(const std::string &name, PluginFunctions functions);
static std::vector<Plugin> &getPlugins();
static std::vector<std::fs::path> &getPluginPaths();
static Plugin* getPlugin(const std::string &name);
static const std::list<Plugin>& getPlugins();
static const std::vector<std::fs::path>& getPluginPaths();
static const std::vector<std::fs::path>& getPluginLoadPaths();
static bool isPluginLoaded(const std::fs::path &path);
private:
static std::list<Plugin>& getPluginsMutable();
static AutoReset<std::vector<std::fs::path>> s_pluginPaths, s_pluginLoadPaths;
static AutoReset<std::vector<uintptr_t>> s_loadedLibraries;
};
}

View File

@@ -9,7 +9,7 @@
* that want to store any data to a Project File.
*
*/
namespace hex {
EXPORT_MODULE namespace hex {
namespace prv {
class Provider;
@@ -93,30 +93,26 @@ namespace hex {
*
* @param handler The handler to register
*/
static void registerHandler(const Handler &handler) {
getHandlers().push_back(handler);
}
static void registerHandler(const Handler &handler);
/**
* @brief Register a handler for storing and loading per-provider data from a project file
*
* @param handler The handler to register
*/
static void registerPerProviderHandler(const ProviderHandler &handler) {
getProviderHandlers().push_back(handler);
}
static void registerPerProviderHandler(const ProviderHandler &handler);
/**
* @brief Get the list of registered handlers
* @return List of registered handlers
*/
static std::vector<Handler>& getHandlers();
static const std::vector<Handler>& getHandlers();
/**
* @brief Get the list of registered per-provider handlers
* @return List of registered per-provider handlers
*/
static std::vector<ProviderHandler>& getProviderHandlers();
static const std::vector<ProviderHandler>& getProviderHandlers();
private:
ProjectFile() = default;

View File

@@ -2,142 +2,33 @@
#include <hex.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/helpers/keys.hpp>
#include <functional>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <GLFW/glfw3.h>
#if !defined(HEX_MODULE_EXPORT)
struct ImGuiWindow;
#endif
struct ImGuiWindow;
struct KeyEquivalent {
bool valid;
bool ctrl, opt, cmd, shift;
int key;
};
namespace hex {
EXPORT_MODULE namespace hex {
class View;
enum class Keys {
Space = GLFW_KEY_SPACE,
Apostrophe = GLFW_KEY_APOSTROPHE,
Comma = GLFW_KEY_COMMA,
Minus = GLFW_KEY_MINUS,
Period = GLFW_KEY_PERIOD,
Slash = GLFW_KEY_SLASH,
Num0 = GLFW_KEY_0,
Num1 = GLFW_KEY_1,
Num2 = GLFW_KEY_2,
Num3 = GLFW_KEY_3,
Num4 = GLFW_KEY_4,
Num5 = GLFW_KEY_5,
Num6 = GLFW_KEY_6,
Num7 = GLFW_KEY_7,
Num8 = GLFW_KEY_8,
Num9 = GLFW_KEY_9,
Semicolon = GLFW_KEY_SEMICOLON,
Equals = GLFW_KEY_EQUAL,
A = GLFW_KEY_A,
B = GLFW_KEY_B,
C = GLFW_KEY_C,
D = GLFW_KEY_D,
E = GLFW_KEY_E,
F = GLFW_KEY_F,
G = GLFW_KEY_G,
H = GLFW_KEY_H,
I = GLFW_KEY_I,
J = GLFW_KEY_J,
K = GLFW_KEY_K,
L = GLFW_KEY_L,
M = GLFW_KEY_M,
N = GLFW_KEY_N,
O = GLFW_KEY_O,
P = GLFW_KEY_P,
Q = GLFW_KEY_Q,
R = GLFW_KEY_R,
S = GLFW_KEY_S,
T = GLFW_KEY_T,
U = GLFW_KEY_U,
V = GLFW_KEY_V,
W = GLFW_KEY_W,
X = GLFW_KEY_X,
Y = GLFW_KEY_Y,
Z = GLFW_KEY_Z,
LeftBracket = GLFW_KEY_LEFT_BRACKET,
Backslash = GLFW_KEY_BACKSLASH,
RightBracket = GLFW_KEY_RIGHT_BRACKET,
GraveAccent = GLFW_KEY_GRAVE_ACCENT,
World1 = GLFW_KEY_WORLD_1,
World2 = GLFW_KEY_WORLD_2,
Escape = GLFW_KEY_ESCAPE,
Enter = GLFW_KEY_ENTER,
Tab = GLFW_KEY_TAB,
Backspace = GLFW_KEY_BACKSPACE,
Insert = GLFW_KEY_INSERT,
Delete = GLFW_KEY_DELETE,
Right = GLFW_KEY_RIGHT,
Left = GLFW_KEY_LEFT,
Down = GLFW_KEY_DOWN,
Up = GLFW_KEY_UP,
PageUp = GLFW_KEY_PAGE_UP,
PageDown = GLFW_KEY_PAGE_DOWN,
Home = GLFW_KEY_HOME,
End = GLFW_KEY_END,
CapsLock = GLFW_KEY_CAPS_LOCK,
ScrollLock = GLFW_KEY_SCROLL_LOCK,
NumLock = GLFW_KEY_NUM_LOCK,
PrintScreen = GLFW_KEY_PRINT_SCREEN,
Pause = GLFW_KEY_PAUSE,
F1 = GLFW_KEY_F1,
F2 = GLFW_KEY_F2,
F3 = GLFW_KEY_F3,
F4 = GLFW_KEY_F4,
F5 = GLFW_KEY_F5,
F6 = GLFW_KEY_F6,
F7 = GLFW_KEY_F7,
F8 = GLFW_KEY_F8,
F9 = GLFW_KEY_F9,
F10 = GLFW_KEY_F10,
F11 = GLFW_KEY_F11,
F12 = GLFW_KEY_F12,
F13 = GLFW_KEY_F13,
F14 = GLFW_KEY_F14,
F15 = GLFW_KEY_F15,
F16 = GLFW_KEY_F16,
F17 = GLFW_KEY_F17,
F18 = GLFW_KEY_F18,
F19 = GLFW_KEY_F19,
F20 = GLFW_KEY_F20,
F21 = GLFW_KEY_F21,
F22 = GLFW_KEY_F22,
F23 = GLFW_KEY_F23,
F24 = GLFW_KEY_F24,
F25 = GLFW_KEY_F25,
KeyPad0 = GLFW_KEY_KP_0,
KeyPad1 = GLFW_KEY_KP_1,
KeyPad2 = GLFW_KEY_KP_2,
KeyPad3 = GLFW_KEY_KP_3,
KeyPad4 = GLFW_KEY_KP_4,
KeyPad5 = GLFW_KEY_KP_5,
KeyPad6 = GLFW_KEY_KP_6,
KeyPad7 = GLFW_KEY_KP_7,
KeyPad8 = GLFW_KEY_KP_8,
KeyPad9 = GLFW_KEY_KP_9,
KeyPadDecimal = GLFW_KEY_KP_DECIMAL,
KeyPadDivide = GLFW_KEY_KP_DIVIDE,
KeyPadMultiply = GLFW_KEY_KP_MULTIPLY,
KeyPadSubtract = GLFW_KEY_KP_SUBTRACT,
KeyPadAdd = GLFW_KEY_KP_ADD,
KeyPadEnter = GLFW_KEY_KP_ENTER,
KeyPadEqual = GLFW_KEY_KP_EQUAL,
Menu = GLFW_KEY_MENU,
};
class Key {
public:
constexpr Key() = default;
constexpr Key(Keys key) : m_key(static_cast<u32>(key)) { }
bool operator==(const Key &) const = default;
auto operator<=>(const Key &) const = default;
[[nodiscard]] constexpr u32 getKeyCode() const { return m_key; }
@@ -152,224 +43,32 @@ namespace hex {
constexpr static auto SUPER = Key(static_cast<Keys>(0x0800'0000));
constexpr static auto CurrentView = Key(static_cast<Keys>(0x1000'0000));
constexpr static auto AllowWhileTyping = Key(static_cast<Keys>(0x2000'0000));
#if defined (OS_MACOS)
constexpr static auto CTRLCMD = SUPER;
#else
constexpr static auto CTRLCMD = CTRL;
#endif
constexpr static auto CTRLCMD = Key(static_cast<Keys>(0x4000'0000));
class Shortcut {
public:
Shortcut() = default;
Shortcut(Keys key) : m_keys({ key }) { }
explicit Shortcut(std::set<Key> keys) : m_keys(std::move(keys)) { }
Shortcut(Keys key);
explicit Shortcut(std::set<Key> keys);
Shortcut(const Shortcut &other) = default;
Shortcut(Shortcut &&) noexcept = default;
Shortcut& operator=(const Shortcut &other) = default;
constexpr static auto None = Keys(0);
Shortcut& operator=(const Shortcut &other) = default;
Shortcut& operator=(Shortcut &&) noexcept = default;
constexpr static inline auto None = Keys(0);
Shortcut operator+(const Key &other) const;
Shortcut &operator+=(const Key &other);
bool operator<(const Shortcut &other) const;
bool operator==(const Shortcut &other) const;
Shortcut operator+(const Key &other) const {
Shortcut result = *this;
result.m_keys.insert(other);
return result;
}
Shortcut &operator+=(const Key &other) {
m_keys.insert(other);
return *this;
}
bool operator<(const Shortcut &other) const {
return m_keys < other.m_keys;
}
bool operator==(const Shortcut &other) const {
auto thisKeys = m_keys;
auto otherKeys = other.m_keys;
thisKeys.erase(CurrentView);
thisKeys.erase(AllowWhileTyping);
otherKeys.erase(CurrentView);
otherKeys.erase(AllowWhileTyping);
return thisKeys == otherKeys;
}
bool isLocal() const {
return m_keys.contains(CurrentView);
}
std::string toString() const {
std::string result;
#if defined(OS_MACOS)
constexpr static auto CTRL_NAME = "CTRL";
constexpr static auto ALT_NAME = "OPT";
constexpr static auto SHIFT_NAME = "SHIFT";
constexpr static auto SUPER_NAME = "CMD";
#else
constexpr static auto CTRL_NAME = "CTRL";
constexpr static auto ALT_NAME = "ALT";
constexpr static auto SHIFT_NAME = "SHIFT";
constexpr static auto SUPER_NAME = "SUPER";
#endif
constexpr static auto Concatination = " + ";
auto keys = m_keys;
if (keys.erase(CTRL) > 0) {
result += CTRL_NAME;
result += Concatination;
}
if (keys.erase(ALT) > 0) {
result += ALT_NAME;
result += Concatination;
}
if (keys.erase(SHIFT) > 0) {
result += SHIFT_NAME;
result += Concatination;
}
if (keys.erase(SUPER) > 0) {
result += SUPER_NAME;
result += Concatination;
}
keys.erase(CurrentView);
for (const auto &key : keys) {
switch (Keys(key.getKeyCode())) {
case Keys::Space: result += "SPACE"; break;
case Keys::Apostrophe: result += "'"; break;
case Keys::Comma: result += ","; break;
case Keys::Minus: result += "-"; break;
case Keys::Period: result += "."; break;
case Keys::Slash: result += "/"; break;
case Keys::Num0: result += "0"; break;
case Keys::Num1: result += "1"; break;
case Keys::Num2: result += "2"; break;
case Keys::Num3: result += "3"; break;
case Keys::Num4: result += "4"; break;
case Keys::Num5: result += "5"; break;
case Keys::Num6: result += "6"; break;
case Keys::Num7: result += "7"; break;
case Keys::Num8: result += "8"; break;
case Keys::Num9: result += "9"; break;
case Keys::Semicolon: result += ";"; break;
case Keys::Equals: result += "="; break;
case Keys::A: result += "A"; break;
case Keys::B: result += "B"; break;
case Keys::C: result += "C"; break;
case Keys::D: result += "D"; break;
case Keys::E: result += "E"; break;
case Keys::F: result += "F"; break;
case Keys::G: result += "G"; break;
case Keys::H: result += "H"; break;
case Keys::I: result += "I"; break;
case Keys::J: result += "J"; break;
case Keys::K: result += "K"; break;
case Keys::L: result += "L"; break;
case Keys::M: result += "M"; break;
case Keys::N: result += "N"; break;
case Keys::O: result += "O"; break;
case Keys::P: result += "P"; break;
case Keys::Q: result += "Q"; break;
case Keys::R: result += "R"; break;
case Keys::S: result += "S"; break;
case Keys::T: result += "T"; break;
case Keys::U: result += "U"; break;
case Keys::V: result += "V"; break;
case Keys::W: result += "W"; break;
case Keys::X: result += "X"; break;
case Keys::Y: result += "Y"; break;
case Keys::Z: result += "Z"; break;
case Keys::LeftBracket: result += "["; break;
case Keys::Backslash: result += "\\"; break;
case Keys::RightBracket: result += "]"; break;
case Keys::GraveAccent: result += "`"; break;
case Keys::World1: result += "WORLD1"; break;
case Keys::World2: result += "WORLD2"; break;
case Keys::Escape: result += "ESC"; break;
case Keys::Enter: result += "ENTER"; break;
case Keys::Tab: result += "TAB"; break;
case Keys::Backspace: result += "BACKSPACE"; break;
case Keys::Insert: result += "INSERT"; break;
case Keys::Delete: result += "DELETE"; break;
case Keys::Right: result += "RIGHT"; break;
case Keys::Left: result += "LEFT"; break;
case Keys::Down: result += "DOWN"; break;
case Keys::Up: result += "UP"; break;
case Keys::PageUp: result += "PAGEUP"; break;
case Keys::PageDown: result += "PAGEDOWN"; break;
case Keys::Home: result += "HOME"; break;
case Keys::End: result += "END"; break;
case Keys::CapsLock: result += "CAPSLOCK"; break;
case Keys::ScrollLock: result += "SCROLLLOCK"; break;
case Keys::NumLock: result += "NUMLOCK"; break;
case Keys::PrintScreen: result += "PRINTSCREEN"; break;
case Keys::Pause: result += "PAUSE"; break;
case Keys::F1: result += "F1"; break;
case Keys::F2: result += "F2"; break;
case Keys::F3: result += "F3"; break;
case Keys::F4: result += "F4"; break;
case Keys::F5: result += "F5"; break;
case Keys::F6: result += "F6"; break;
case Keys::F7: result += "F7"; break;
case Keys::F8: result += "F8"; break;
case Keys::F9: result += "F9"; break;
case Keys::F10: result += "F10"; break;
case Keys::F11: result += "F11"; break;
case Keys::F12: result += "F12"; break;
case Keys::F13: result += "F13"; break;
case Keys::F14: result += "F14"; break;
case Keys::F15: result += "F15"; break;
case Keys::F16: result += "F16"; break;
case Keys::F17: result += "F17"; break;
case Keys::F18: result += "F18"; break;
case Keys::F19: result += "F19"; break;
case Keys::F20: result += "F20"; break;
case Keys::F21: result += "F21"; break;
case Keys::F22: result += "F22"; break;
case Keys::F23: result += "F23"; break;
case Keys::F24: result += "F24"; break;
case Keys::F25: result += "F25"; break;
case Keys::KeyPad0: result += "KP0"; break;
case Keys::KeyPad1: result += "KP1"; break;
case Keys::KeyPad2: result += "KP2"; break;
case Keys::KeyPad3: result += "KP3"; break;
case Keys::KeyPad4: result += "KP4"; break;
case Keys::KeyPad5: result += "KP5"; break;
case Keys::KeyPad6: result += "KP6"; break;
case Keys::KeyPad7: result += "KP7"; break;
case Keys::KeyPad8: result += "KP8"; break;
case Keys::KeyPad9: result += "KP9"; break;
case Keys::KeyPadDecimal: result += "KPDECIMAL"; break;
case Keys::KeyPadDivide: result += "KPDIVIDE"; break;
case Keys::KeyPadMultiply: result += "KPMULTIPLY"; break;
case Keys::KeyPadSubtract: result += "KPSUBTRACT"; break;
case Keys::KeyPadAdd: result += "KPADD"; break;
case Keys::KeyPadEnter: result += "KPENTER"; break;
case Keys::KeyPadEqual: result += "KPEQUAL"; break;
case Keys::Menu: result += "MENU"; break;
default:
continue;
}
result += " + ";
}
if (result.ends_with(" + "))
result = result.substr(0, result.size() - 3);
return result;
}
const std::set<Key>& getKeys() const { return m_keys; }
bool isLocal() const;
std::string toString() const;
KeyEquivalent toKeyEquivalent() const;
const std::set<Key>& getKeys() const;
bool has(Key key) const;
bool matches(const Shortcut &other) const;
private:
friend Shortcut operator+(const Key &lhs, const Key &rhs);
@@ -377,12 +76,7 @@ namespace hex {
std::set<Key> m_keys;
};
inline Shortcut operator+(const Key &lhs, const Key &rhs) {
Shortcut result;
result.m_keys = { lhs, rhs };
return result;
}
Shortcut operator+(const Key &lhs, const Key &rhs);
/**
* @brief The ShortcutManager handles global and view-specific shortcuts.
@@ -391,10 +85,12 @@ namespace hex {
class ShortcutManager {
public:
using Callback = std::function<void()>;
using EnabledCallback = std::function<bool()>;
struct ShortcutEntry {
Shortcut shortcut;
UnlocalizedString unlocalizedName;
std::vector<UnlocalizedString> unlocalizedName;
Callback callback;
EnabledCallback enabledCallback;
};
/**
@@ -402,8 +98,10 @@ namespace hex {
* @param shortcut The shortcut to add.
* @param unlocalizedName The unlocalized name of the shortcut
* @param callback The callback to call when the shortcut is triggered.
* @param enabledCallback Callback that's called to check if this shortcut is enabled
*/
static void addGlobalShortcut(const Shortcut &shortcut, const UnlocalizedString &unlocalizedName, const Callback &callback);
static void addGlobalShortcut(const Shortcut &shortcut, const std::vector<UnlocalizedString> &unlocalizedName, const Callback &callback, const EnabledCallback &enabledCallback = []{ return true; });
static void addGlobalShortcut(const Shortcut &shortcut, const UnlocalizedString &unlocalizedName, const Callback &callback, const EnabledCallback &enabledCallback = []{ return true; });
/**
* @brief Add a view-specific shortcut. View-specific shortcuts can only be triggered when the specified view is focused.
@@ -411,8 +109,10 @@ namespace hex {
* @param shortcut The shortcut to add.
* @param unlocalizedName The unlocalized name of the shortcut
* @param callback The callback to call when the shortcut is triggered.
* @param enabledCallback Callback that's called to check if this shortcut is enabled
*/
static void addShortcut(View *view, const Shortcut &shortcut, const UnlocalizedString &unlocalizedName, const Callback &callback);
static void addShortcut(View *view, const Shortcut &shortcut, const std::vector<UnlocalizedString> &unlocalizedName, const Callback &callback, const EnabledCallback &enabledCallback = []{ return true; });
static void addShortcut(View *view, const Shortcut &shortcut, const UnlocalizedString &unlocalizedName, const Callback &callback, const EnabledCallback &enabledCallback = []{ return true; });
/**
@@ -425,7 +125,7 @@ namespace hex {
* @param focused Whether the current view is focused
* @param keyCode The key code of the key that was pressed
*/
static void process(const std::unique_ptr<View> &currentView, bool ctrl, bool alt, bool shift, bool super, bool focused, u32 keyCode);
static void process(const View *currentView, bool ctrl, bool alt, bool shift, bool super, bool focused, u32 keyCode);
/**
* @brief Process a key event. This should be called from the main loop.
@@ -437,6 +137,14 @@ namespace hex {
*/
static void processGlobals(bool ctrl, bool alt, bool shift, bool super, u32 keyCode);
/**
* @brief Runs the callback of a shortcut as if it was pressed on the keyboard
* @param shortcut Shortcut to run
* @param view View the shortcut belongs to or nullptr to run a global shortcut
* @return True if a callback was executed, false if not
*/
static bool runShortcut(const Shortcut &shortcut, const View *view = nullptr);
/**
* @brief Clear all shortcuts
*/
@@ -445,12 +153,17 @@ namespace hex {
static void resumeShortcuts();
static void pauseShortcuts();
static void enableMacOSMode();
[[nodiscard]] static std::optional<UnlocalizedString> getLastActivatedMenu();
static void resetLastActivatedMenu();
[[nodiscard]] static std::optional<Shortcut> getPreviousShortcut();
[[nodiscard]] static std::vector<ShortcutEntry> getGlobalShortcuts();
[[nodiscard]] static std::vector<ShortcutEntry> getViewShortcuts(const View *view);
[[nodiscard]] static bool updateShortcut(const Shortcut &oldShortcut, const Shortcut &newShortcut, View *view = nullptr);
[[nodiscard]] static bool updateShortcut(const Shortcut &oldShortcut, Shortcut newShortcut, View *view = nullptr);
};
}

View File

@@ -9,8 +9,9 @@
#include <memory>
#include <list>
#include <condition_variable>
#include <source_location>
namespace hex {
EXPORT_MODULE namespace hex {
class TaskHolder;
class TaskManager;
@@ -21,7 +22,7 @@ namespace hex {
class Task {
public:
Task() = default;
Task(UnlocalizedString unlocalizedName, u64 maxValue, bool background, std::function<void(Task &)> function);
Task(const UnlocalizedString &unlocalizedName, u64 maxValue, bool background, bool blocking, std::function<void(Task &)> function);
Task(const Task&) = delete;
Task(Task &&other) noexcept;
@@ -31,7 +32,9 @@ namespace hex {
* @brief Updates the current process value of the task
* @param value Current value
*/
void update(u64 value = 0);
void update(u64 value);
void update() const;
void increment();
/**
* @brief Sets the maximum value of the task
@@ -54,6 +57,7 @@ namespace hex {
void setInterruptCallback(std::function<void()> callback);
[[nodiscard]] bool isBackgroundTask() const;
[[nodiscard]] bool isBlocking() const;
[[nodiscard]] bool isFinished() const;
[[nodiscard]] bool hadException() const;
[[nodiscard]] bool wasInterrupted() const;
@@ -81,6 +85,7 @@ namespace hex {
std::atomic<bool> m_shouldInterrupt = false;
std::atomic<bool> m_background = true;
std::atomic<bool> m_blocking = false;
std::atomic<bool> m_interrupted = false;
std::atomic<bool> m_finished = false;
@@ -127,20 +132,55 @@ namespace hex {
/**
* @brief Creates a new asynchronous task that gets displayed in the Task Manager in the footer
* @param name Name of the task
* @param unlocalizedName Name of the task
* @param maxValue Maximum value of the task
* @param function Function to be executed
* @return A TaskHolder holding a weak reference to the task
*/
static TaskHolder createTask(std::string name, u64 maxValue, std::function<void(Task &)> function);
static TaskHolder createTask(const UnlocalizedString &unlocalizedName, u64 maxValue, std::function<void(Task &)> function);
/**
* @brief Creates a new asynchronous task that gets displayed in the Task Manager in the footer
* @param unlocalizedName Name of the task
* @param maxValue Maximum value of the task
* @param function Function to be executed
* @return A TaskHolder holding a weak reference to the task
*/
static TaskHolder createTask(const UnlocalizedString &unlocalizedName, u64 maxValue, std::function<void()> function);
/**
* @brief Creates a new asynchronous task that does not get displayed in the Task Manager
* @param name Name of the task
* @param unlocalizedName Name of the task
* @param function Function to be executed
* @return A TaskHolder holding a weak reference to the task
*/
static TaskHolder createBackgroundTask(std::string name, std::function<void(Task &)> function);
static TaskHolder createBackgroundTask(const UnlocalizedString &unlocalizedName, std::function<void(Task &)> function);
/**
* @brief Creates a new asynchronous task that does not get displayed in the Task Manager
* @param unlocalizedName Name of the task
* @param function Function to be executed
* @return A TaskHolder holding a weak reference to the task
*/
static TaskHolder createBackgroundTask(const UnlocalizedString &unlocalizedName, std::function<void()> function);
/**
* @brief Creates a new asynchronous task that shows a blocking modal window
* @param unlocalizedName Name of the task
* @param maxValue Maximum value of the task
* @param function Function to be executed
* @return A TaskHolder holding a weak reference to the task
*/
static TaskHolder createBlockingTask(const UnlocalizedString &unlocalizedName, u64 maxValue, std::function<void(Task &)> function);
/**
* @brief Creates a new asynchronous task that shows a blocking modal window
* @param unlocalizedName Name of the task
* @param maxValue Maximum value of the task
* @param function Function to be executed
* @return A TaskHolder holding a weak reference to the task
*/
static TaskHolder createBlockingTask(const UnlocalizedString &unlocalizedName, u64 maxValue, std::function<void()> function);
/**
* @brief Creates a new synchronous task that will execute the given function at the start of the next frame
@@ -148,22 +188,47 @@ namespace hex {
*/
static void doLater(const std::function<void()> &function);
/**
* @brief Creates a new synchronous task that will execute the given function at the start of the next frame
* @param function Function to be executed
* @param location Source location of the function call. This is used to make sure repeated calls to the function at the same location are only executed once
*/
static void doLaterOnce(const std::function<void()> &function, std::source_location location = std::source_location::current());
/**
* @brief Creates a callback that will be executed when all tasks are finished
* @param function Function to be executed
*/
static void runWhenTasksFinished(const std::function<void()> &function);
/**
* @brief Sets the name of the current thread
* @param name Name of the thread
*/
static void setCurrentThreadName(const std::string &name);
/**
* @brief Gets the name of the current thread
* @return Name of the thread
*/
static std::string getCurrentThreadName();
/**
* @brief Cleans up finished tasks
*/
static void collectGarbage();
static Task& getCurrentTask();
static size_t getRunningTaskCount();
static size_t getRunningBackgroundTaskCount();
static size_t getRunningBlockingTaskCount();
static std::list<std::shared_ptr<Task>> &getRunningTasks();
static const std::list<std::shared_ptr<Task>>& getRunningTasks();
static void runDeferredCalls();
private:
static TaskHolder createTask(std::string name, u64 maxValue, bool background, std::function<void(Task &)> function);
static TaskHolder createTask(const UnlocalizedString &unlocalizedName, u64 maxValue, bool background, bool blocking, std::function<void(Task &)> function);
};
}

View File

@@ -9,7 +9,7 @@
#include <nlohmann/json_fwd.hpp>
#include <imgui.h>
namespace hex {
EXPORT_MODULE namespace hex {
/**
* @brief The Theme Manager takes care of loading and applying themes
@@ -56,6 +56,7 @@ namespace hex {
*/
static void addStyleHandler(const std::string &name, const StyleMap &styleMap);
static void reapplyCurrentTheme();
static std::vector<std::string> getThemeNames();
static const std::string &getImageTheme();
@@ -66,6 +67,7 @@ namespace hex {
static void reset();
static void setAccentColor(const ImColor &color);
public:
struct ThemeHandler {
@@ -78,8 +80,9 @@ namespace hex {
StyleMap styleMap;
};
static std::map<std::string, ThemeHandler>& getThemeHandlers();
static std::map<std::string, StyleHandler>& getStyleHandlers();
static const std::map<std::string, ThemeHandler>& getThemeHandlers();
static const std::map<std::string, StyleHandler>& getStyleHandlers();
private:
ThemeManager() = default;

View File

@@ -10,7 +10,7 @@
#include <hex/ui/imgui_imhex_extensions.h>
namespace hex {
EXPORT_MODULE namespace hex {
class TutorialManager {
public:
@@ -119,6 +119,8 @@ namespace hex {
decltype(m_steps)::iterator m_currentStep, m_latestStep;
};
static void init();
/**
* @brief Gets a list of all tutorials
* @return List of all tutorials
@@ -145,6 +147,13 @@ namespace hex {
*/
static void startTutorial(const UnlocalizedString &unlocalizedName);
static void startHelpHover();
static void addInteractiveHelpText(std::initializer_list<std::variant<Lang, std::string, int>> &&ids, UnlocalizedString unlocalizedString);
static void addInteractiveHelpLink(std::initializer_list<std::variant<Lang, std::string, int>> &&ids, std::string link);
static void setLastItemInteractiveHelpPopup(std::function<void()> callback);
static void setLastItemInteractiveHelpLink(std::string link);
/**
* @brief Draws the tutorial

View File

@@ -1,37 +1,39 @@
#pragma once
#include <wolv/io/fs.hpp>
#include <hex/helpers/auto_reset.hpp>
#include <map>
#include <string>
namespace hex {
EXPORT_MODULE namespace hex {
class WorkspaceManager {
public:
struct Workspace {
std::string layout;
std::fs::path path;
bool builtin;
};
static void createWorkspace(const std::string &name, const std::string &layout = "");
static void switchWorkspace(const std::string &name);
static void importFromFile(const std::fs::path &path);
static bool exportToFile(std::fs::path path = {}, std::string workspaceName = {});
static bool exportToFile(std::fs::path path = {}, std::string workspaceName = {}, bool builtin = false);
static const auto& getWorkspaces() { return s_workspaces; }
static const auto& getCurrentWorkspace() { return s_currentWorkspace; }
static void removeWorkspace(const std::string &name);
static const std::map<std::string, Workspace>& getWorkspaces();
static const std::map<std::string, Workspace>::iterator& getCurrentWorkspace();
static void reset();
static void reload();
static void process();
private:
WorkspaceManager() = default;
static std::map<std::string, Workspace> s_workspaces;
static decltype(s_workspaces)::iterator s_currentWorkspace, s_previousWorkspace;
};
}

View File

@@ -3,7 +3,6 @@
#include <hex.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/helpers/intrinsics.hpp>
#include <hex/data_processor/attribute.hpp>
#include <set>
@@ -12,6 +11,7 @@
#include <nlohmann/json_fwd.hpp>
#include <imgui.h>
#include <hex/providers/provider_data.hpp>
namespace hex::prv {
class Provider;
@@ -42,11 +42,12 @@ namespace hex::dp {
m_overlay = overlay;
}
virtual void drawNode() { }
void draw();
virtual void process() = 0;
virtual void reset() { }
virtual void store(nlohmann::json &j) const { hex::unused(j); }
virtual void load(const nlohmann::json &j) { hex::unused(j); }
virtual void store(nlohmann::json &j) const { std::ignore = j; }
virtual void load(const nlohmann::json &j) { std::ignore = j; }
struct NodeError {
Node *node;
@@ -80,6 +81,11 @@ namespace hex::dp {
void setIntegerOnOutput(u32 index, i128 integer);
void setFloatOnOutput(u32 index, double floatingPoint);
static void interrupt();
protected:
virtual void drawNode() { }
private:
int m_id;
UnlocalizedString m_unlocalizedTitle, m_unlocalizedName;
@@ -90,45 +96,16 @@ namespace hex::dp {
static int s_idCounter;
Attribute& getAttribute(u32 index) {
if (index >= this->getAttributes().size())
throw std::runtime_error("Attribute index out of bounds!");
return this->getAttributes()[index];
}
Attribute *getConnectedInputAttribute(u32 index) {
const auto &connectedAttribute = this->getAttribute(index).getConnectedAttributes();
if (connectedAttribute.empty())
return nullptr;
return connectedAttribute.begin()->second;
}
void markInputProcessed(u32 index) {
const auto &[iter, inserted] = m_processedInputs.insert(index);
if (!inserted)
throwNodeError("Recursion detected!");
}
void unmarkInputProcessed(u32 index) {
m_processedInputs.erase(index);
}
Attribute& getAttribute(u32 index);
Attribute *getConnectedInputAttribute(u32 index);
void markInputProcessed(u32 index);
void unmarkInputProcessed(u32 index);
protected:
[[noreturn]] void throwNodeError(const std::string &message) {
throw NodeError { this, message };
}
[[noreturn]] void throwNodeError(const std::string &message);
void setOverlayData(u64 address, const std::vector<u8> &data);
void setAttributes(std::vector<Attribute> attributes) {
m_attributes = std::move(attributes);
for (auto &attr : m_attributes)
attr.setParentNode(this);
}
void setAttributes(std::vector<Attribute> attributes);
};
}

View File

@@ -0,0 +1,102 @@
#pragma once
#include <hex/api/imhex_api.hpp>
namespace hex {
namespace impl {
class AutoResetBase {
public:
virtual ~AutoResetBase() = default;
virtual void reset() = 0;
};
}
template<typename T>
class AutoReset : public impl::AutoResetBase {
public:
using Type = T;
AutoReset() {
ImHexApi::System::impl::addAutoResetObject(this);
}
AutoReset(const T &value) : AutoReset() {
m_value = value;
m_valid = true;
}
AutoReset(T &&value) noexcept : AutoReset() {
m_value = std::move(value);
m_valid = true;
}
~AutoReset() {
ImHexApi::System::impl::removeAutoResetObject(this);
}
T* operator->() {
return &m_value;
}
const T* operator->() const {
return &m_value;
}
T& operator*() {
return m_value;
}
const T& operator*() const {
return m_value;
}
operator T&() {
return m_value;
}
operator const T&() const {
return m_value;
}
T& operator=(const T &value) {
m_value = value;
m_valid = true;
return m_value;
}
T& operator=(T &&value) noexcept {
m_value = std::move(value);
m_valid = true;
return m_value;
}
bool isValid() const {
return m_valid;
}
private:
friend void ImHexApi::System::impl::cleanup();
void reset() override {
if constexpr (requires { m_value.reset(); }) {
m_value.reset();
} else if constexpr (requires { m_value.clear(); }) {
m_value.clear();
} else if constexpr (requires(T t) { t = nullptr; }) {
m_value = nullptr;
} else {
m_value = { };
}
m_valid = false;
}
private:
bool m_valid = true;
T m_value;
};
}

View File

@@ -0,0 +1,16 @@
#pragma once
#include <hex.hpp>
#include <span>
#include <string>
#include <vector>
namespace hex::clipboard {
void init();
void setBinaryData(std::span<const u8> data);
[[nodiscard]] std::vector<u8> getBinaryData();
void setTextData(const std::string &string);
[[nodiscard]] std::string getTextData();
}

View File

@@ -2,10 +2,15 @@
#include <hex.hpp>
#include <wolv/utils/expected.hpp>
#include <array>
#include <string>
#include <vector>
#define CRYPTO_ERROR_INVALID_KEY_LENGTH (-1)
#define CRYPTO_ERROR_INVALID_MODE (-2)
namespace hex::prv {
class Provider;
}
@@ -60,5 +65,5 @@ namespace hex::crypt {
Key256Bits = 2
};
std::vector<u8> aesDecrypt(AESMode mode, KeyLength keyLength, const std::vector<u8> &key, std::array<u8, 8> nonce, std::array<u8, 8> iv, const std::vector<u8> &input);
wolv::util::Expected<std::vector<u8>, int> aesDecrypt(AESMode mode, KeyLength keyLength, const std::vector<u8> &key, std::array<u8, 8> nonce, std::array<u8, 8> iv, const std::vector<u8> &input);
}

View File

@@ -44,4 +44,7 @@ namespace hex::dbg {
}
}
bool debugModeEnabled();
void setDebugModeEnabled(bool enabled);
}

View File

@@ -0,0 +1,114 @@
#pragma once
#include <hex/helpers/fs.hpp>
#include <array>
#include <vector>
namespace hex::paths {
namespace impl {
class DefaultPath {
protected:
constexpr DefaultPath() = default;
virtual ~DefaultPath() = default;
public:
DefaultPath(const DefaultPath&) = delete;
DefaultPath(DefaultPath&&) = delete;
DefaultPath& operator=(const DefaultPath&) = delete;
DefaultPath& operator=(DefaultPath&&) = delete;
virtual std::vector<std::fs::path> all() const = 0;
virtual std::vector<std::fs::path> read() const;
virtual std::vector<std::fs::path> write() const;
};
class ConfigPath : public DefaultPath {
public:
explicit ConfigPath(std::fs::path postfix) : m_postfix(std::move(postfix)) {}
std::vector<std::fs::path> all() const override;
private:
std::fs::path m_postfix;
};
class DataPath : public DefaultPath {
public:
explicit DataPath(std::fs::path postfix) : m_postfix(std::move(postfix)) {}
std::vector<std::fs::path> all() const override;
std::vector<std::fs::path> write() const override;
private:
std::fs::path m_postfix;
};
class PluginPath : public DefaultPath {
public:
explicit PluginPath(std::fs::path postfix) : m_postfix(std::move(postfix)) {}
std::vector<std::fs::path> all() const override;
private:
std::fs::path m_postfix;
};
}
std::vector<std::fs::path> getDataPaths(bool includeSystemFolders);
std::vector<std::fs::path> getConfigPaths(bool includeSystemFolders);
const static inline impl::ConfigPath Config("config");
const static inline impl::ConfigPath Recent("recent");
const static inline impl::PluginPath Libraries("lib");
const static inline impl::PluginPath Plugins("plugins");
const static inline impl::DataPath Patterns("patterns");
const static inline impl::DataPath PatternsInclude("includes");
const static inline impl::DataPath Magic("magic");
const static inline impl::DataPath Yara("yara");
const static inline impl::DataPath YaraAdvancedAnalysis("yara/advanced_analysis");
const static inline impl::DataPath Backups("backups");
const static inline impl::DataPath Resources("resources");
const static inline impl::DataPath Constants("constants");
const static inline impl::DataPath Encodings("encodings");
const static inline impl::DataPath Logs("logs");
const static inline impl::DataPath Scripts("scripts");
const static inline impl::DataPath Inspectors("scripts/inspectors");
const static inline impl::DataPath Themes("themes");
const static inline impl::DataPath Nodes("scripts/nodes");
const static inline impl::DataPath Layouts("layouts");
const static inline impl::DataPath Workspaces("workspaces");
const static inline impl::DataPath Disassemblers("disassemblers");
constexpr static inline std::array<const impl::DefaultPath*, 21> All = {
&Config,
&Recent,
&Libraries,
&Plugins,
&Patterns,
&PatternsInclude,
&Magic,
&Yara,
&YaraAdvancedAnalysis,
&Backups,
&Resources,
&Constants,
&Encodings,
&Logs,
&Scripts,
&Inspectors,
&Themes,
&Nodes,
&Layouts,
&Workspaces,
&Disassemblers
};
}

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