WerWolv / ImHex

🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
https://imhex.werwolv.net
GNU General Public License v2.0
37.41k stars 1.64k forks source link

[Feature] Access prior items in Array #1759

Open Nemrav opened 2 weeks ago

Nemrav commented 2 weeks ago

What feature would you like to see?

If I load an array like so: Chunk chunks[while($ < std::mem::size()-start)] @ start; or

struct ChunkList {
   Chunk chunks[]
};
ChunkList list @ start;

While initializing a chunk I would like to be able to access a prior chunk already added to the array, perhaps with syntax like get_container.search(pattern) or get_container[container::get_index()-1].

How will this feature be useful to you and others?

Some files (like the one I'm making a pattern for) might have structs which require information from elsewhere in an array that is not emplaced yet, this feature would help parsing such files. Or there already is a way to do this, and this issue is unnecessary

Request Type

Additional context?

As part of trying out ImHex, I am parsing a 3d model file which uses a chunk array of undetermined size. The chunks come in several types and do not come in a fixed order, but in my case, bone weight chunks require finding a prior mesh chunk with a matching id property. Not all possible chunk types in the chunk list have this id property.