Skip to content
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] [[hidden]] values being shown in value summary for struct #1697

Open
1 task done
Kein opened this issue May 22, 2024 · 4 comments
Open
1 task done

[Bug] [[hidden]] values being shown in value summary for struct #1697

Kein opened this issue May 22, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Kein
Copy link

Kein commented May 22, 2024

Operating System

Windows

What's the issue you encountered?

[[hidden]] values being shown in value summary for struct

How can the issue be reproduced?

bitfield ElevatorsData {
    BlueRat : 1 [[comment("0 down, 1 up")]];
    RedRat : 1  [[comment(" 0 right, 1 left")]];
    Ostrich : 1 [[comment(" 0 right, 1 left")]];
    Dog : 1     [[comment("0 down, 1 up")]];

    pad : 4 [[hidden]];
};

struct MapData {
    // ---
    float            SimFloats[16] [[comment("Unrelated to map data")]];
    ElevatorsData    ElevatorStates;
};

ImHex Version

1.33.0

ImHex Build Type

  • Nightly or built from sources

Installation type

manual

Additional context?

The hidden pad value is being displayed, essentially ignoring [[hidden]]:
image

@Kein Kein added the bug Something isn't working label May 22, 2024
@paxcut
Copy link
Contributor

paxcut commented May 22, 2024

Hidden means that its variable will not be seen in the set of variables shown in pattern data window not that the value will be ignored if accessed. Why is it not printing for the two rats?

@Kein
Copy link
Author

Kein commented May 22, 2024

There is no way for me to access this value from the constructed pattern table (because it is set to hidden), so why would it display it in the value overview? It makes no logical sense.
I specifically want it to be hidden so I set it to hidden.

@Kein Kein changed the title [Bug] [Bug] [[hidden]] values being shown in value summary for struct May 22, 2024
@paxcut
Copy link
Contributor

paxcut commented May 22, 2024

Again, that's not what hidden does. The attribute [[hidden]] doesn't erase the variable and its value can be displayed, but the member variable will not be listed in the contents of the pattern that contains it.

Perhaps you should use the padding data type which will be non-existent as a variable.From online docs:

Padding

It’s also possible to insert padding in between fields using the padding syntax.

bitfield Flags {
  a : 1;
  b : 2;
  padding : 4;
  c : 1;
};

This inserts a 4 bit padding between field b and c.

If this was a struct you could also leave the field anonymous, but i don't think bit-fields can have anonymous members.

@Kein
Copy link
Author

Kein commented May 22, 2024

I dont want to use padding, it is ImHex specific.
If [[hidden]] does not do what it is logically and empirically supposed to do (or what its alternative does in 010 Editor) then it needs to be/should be/could be updated to be wider or have a modifier that can do full hide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants