ImHex icon indicating copy to clipboard operation
ImHex copied to clipboard

[Feature] Add ability to access Pattern data structures inside Data Processor

Open glpnk opened this issue 1 year ago • 4 comments

What feature would you like to see?

Annotating structures in Pattern editor looks simpler than same action in Data processor. This patterns could be easily ported from different language (like ACPI Source Language)

How will this feature be useful to you and others?

Analyzing structures from ACPI tables (like DSDT/SSDT) or similar case

Request Type

  • [ ] I can provide a PoC for this feature or am willing to work on it myself and submit a PR

Additional context?

Questions:

  • Adding new plugin require full project compilation?
  • Which header files I need to access Pattern Data?
  • Is Data Processor node code is stored in plugins/builtin/source/content/data_processor_nodes?

glpnk avatar Jan 19 '24 16:01 glpnk

After some reading and playing with sources I can suggest several solutions for this idea:

  • it will be node with single out
  • ... with multiple outs
  • ... with interface like in custom one
  • with internal code interpreter (probably not, I don't know how to do it)
  • like basic data R/W nodes but for Sections (sounds pretty easy)

Anyway it will require some state preserve mechanism.

glpnk avatar Jan 24 '24 00:01 glpnk

Hey! There is a node available currently called the Out variable node which can access out variables of the current pattern evaluation. Would that work for you?

As for your questions:

Adding new plugin require full project compilation?

No not anymore. You can use the new plugin template now: https://github.com/WerWolv/ImHex-Plugin-Template

Which header files I need to access Pattern Data?

That should be part of the Content Registry I think so <hex/api/content_registry.hpp>

Is Data Processor node code is stored in plugins/builtin/source/content/data_processor_nodes?

Yes, that's where all the node implementations are stored. The implementation of the view is in the view_data_processor.cpp file.

WerWolv avatar Jan 24 '24 22:01 WerWolv

Does this out variable always fixed size of 64 bit ? It seems so, connecting it to buffer display always shows 8 bytes. u32 typed variable shows 8 bytes. I changed it to u8 and u128 it doesn't change. 2024-02-07_22-23 2024-02-07_22-23_1

eybisi avatar Feb 07 '24 19:02 eybisi

@eybisi https://github.com/WerWolv/ImHex/blob/61bfe10bc2ac6231af47c44609c9dbb9d577d41f/plugins/builtin/source/content/data_processor_nodes/other_nodes.cpp#L395

Look like max out buffer size is 8*u8 (64 bits), technically it can be smaller, but why it not, I don't know

glpnk avatar Feb 07 '24 20:02 glpnk