-
Hi all, I just found ImHex. It is a piece of incredible software. For this I am reverse engineering a map file of a game. This file contains an s32 field, which indicates the length of an array of "\n" (0x0a) terminated strings. First of all, is there a nice way to read those strings dynamically into a struct? Also all following offsets after the array depend on the length of that array. Could you please give me a hint how a good approach looks like in this situation? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey! Something like this should work for you I believe struct NewLineTerminatedString {
char string[while($[$] != '\n')];
char newLine;
};
struct StringList {
u32 numEntries;
NewLineTerminatedString strings[numEntries];
};
StringList list @ 0x08; This defines a type called Then we simply create an array out of that type, given the array length value as the size of the array :) |
Beta Was this translation helpful? Give feedback.
-
Awesome. Thank you for the quick reply. I will test this and report back :D Also you are correct, it is an u32 because the array cannot have a negative length. |
Beta Was this translation helpful? Give feedback.
Hey! Something like this should work for you I believe
This defines a type called
NewLineTerminatedString
which contains an array that keeps expanding until it hits a new line character. Then, since it stopped when reaching that character, it places another char down to catch that.Then we simply create an array out of that type, given the array length value as the size of the array :)