-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] hex::core::add_virtual_file does not accept char[] #2032
Comments
Hey |
In that case, is it possible to come up with a patch solution, to pass char arrays as-is? Or, is it possible to cast a char array to u8[] or something else? |
The easiest solution is to just not use the raw string arrays directly but to wrap them in a struct first. import hex.core;
import std.mem;
struct String {
char array[while(!std::mem::eof())];
};
String string @ 0x0;
hex::core::add_virtual_file("/", string); // This will work just fine |
This workaround works, but I am working with char arrays with different extent (including while() and even sections), therefore it becomes ugly and sometimes unusable. Simply we had better have a better solution rather than it. |
How about this then? import hex.core;
import std.mem;
struct Char {
char ch;
};
Char string[while(!std::mem::eof())]@0;
hex::core::add_virtual_file("/", string); // This will work just fine |
@WerWolv Edit: hex::dec functions do not work with char[]. |
from the docs: fn add_virtual_file(str path, auto pattern); |
Yeah, the conversion happens when accessing the variable, not when passing it to the function. |
Operating System
Linux
What's the issue you encountered?
How can the issue be reproduced?
Pass a char[] into it
ImHex Version
1.36.0
ImHex Build Type
Installation type
AUR imhex-bin
Additional context?
Is char[] not a pattern? A u8[] works.
The text was updated successfully, but these errors were encountered: