Commit graph

4523 commits

Author SHA1 Message Date
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