Open vulpes2 opened 1 year ago
Yes please, or just a way to set attributes programmatically.
This is not allowed:
struct palette_entry_t {
u24 color;
} [[inline, color(color)]];
And while there is e.g.:
builtin::std::core::get_attribute_value(this, "color");
There's no set_attribute_value
.
This has been partially implemented now. It's not possible yet to assign attributes conditionally but they aren't limited to taking string literals as inputs anymore and can access the current pattern's fields
so can i now set a palette entry to its color?
You can indeed. Something like this should work now provided you're using the latest nightly version of ImHex
#include <std/io.pat>
struct PaletteEntry {
u8 r, g, b;
} [[color(std::format("{:02X}{:02X}{:02X}", r, g, b))]];
nice :D i will give it a try in the png pattern
It would be great if there's a way to conditionally assign attributes to a variable. This would be pretty nice for verifying checksums included in some file formats, where the pattern language can verify the checksum for the data chunks if the algorithm is known, and dynamically rename the variable to something like CRC(verified) and CRC(unverified) depending on the result. Currently there does not seem to be a way to implement this if the variable is a part of a struct.