Almost, but you're on the right track.
input code block is off by 1 byte again
Code: Select all
4a 38 00 00 00 00 00 00 01 00 08 00 00 00 00 05
00 00 aa 3c 7c 0f 38 8e e3 3f 18 00 00 00 00 1b
00 00 f6 ba 7e ff a7 39 61 94 28 00 00 00 00 00
03 00 00 d3 8d 32 d4 00 00 00 00 00 00 00 00
the output conversion has some minor issues too
Code: Select all
07 03 // correct
16 aa 3c 7c 0f 07 1a 38 8e e3 3f // correct
18 00 00 00 // this is a pointer to the next structure item and needs to be removed
00 1b 00 00 // this is a structure qbkey data type, there should be a 16 at the beginning of the next line and these bytes should be removed
f6 ba 7e ff 07 16 a7 39 61 94 // correct once you make the changes stated above
28 00 00 00 // this is a pointer to the next structure item and needs to be removed
00 // some how you have an extra byte
00 03 00 00// this is a structure integer item
this
07 16 d3 8d 32 d4 07 18 00 00 00 00 00 00 00 00
should look like this
16 d3 8d 32 d4 07 17 d4 00 00 00
and finish it off with a structure close 04
I use the base converter that comes with hex workshop for basic base conversions. But someone might find them useful
A THAW structure item
will always be a minimum of 16 bytes. If the type has a child it will be larger.
The general make up of a structure item is always the same
4 byte data type
4 byte qbkey, name identifier of this item. this can be null i'll show an example below
4 byte value, the value of the item dependent on its type. If this item has a child this field is a pointer to the beginning of the child
4 byte pointer, points to the next item in the structure UNLESS this is the last item in the structure then this value is null.
Here's an example of THAW structure items that will have their name field null.
You might not see this exact code in a section script but I picked something simple not to over complicate things.
take for example the following code
Code: Select all
:i call $wait$ arguments
%i(3,00000003)$seconds$
the 3 integer value doesn't have a name property nor does the seconds qbkey
the above code would look something like this as a THAW structure
Code: Select all
01 16 1a 7c 11 82 4a 28 00 00 00 00 00 00 01 00
08 00 00 00 00 03 00 00 00 00 00 00 03 00 00 00
18 00 00 00 00 1b 00 00 00 00 00 00 19 f6 29 d0
00 00 00 00
Notice how both the structure integer item and the structure qbkey item don't have qbkey names
the output of the second code block should look like the first code block after conversion.
EDIT:
I'd like to go over the last instruction 4a in the larger code block you posted
this is a structure string this item displays key aspects to the THAW structure alignment that I think should be mentioned
Code: Select all
01 16 0e c6 e8 2d 4a 30 00 00 00 00 00 00 01 00
08 00 00 00 00 07 00 00 00 00 00 00 18 00 00 00
00 00 00 00 63 68 61 6e 67 65 20 74 6f 20 77 69
64 65 73 63 72 65 65 6e 00 00 00 00
The structures are on a 4 byte boundary, basically you could write a loop that reads 4 bytes at a time and read from start to finish an entire THAW qb file without going out of bounds
anything that isn't of this boundary is padded, in the case of script structures they are padded before the struct header to align them properly. Also, strings are padded to keep alignment.
Code: Select all
4a 30 00 // thaw structure with a length of 48 bytes from the start of the structure header
00 00 01 00 08 00 00 00 // structure header item, data type + pointer to the first structure item
00 07 00 00 // structure string item data type
00 00 00 00 // name field
18 00 00 00 // value field, string items have a child that is the string so this points to the beginning of the string
00 00 00 00 // pointer field, this is the last item in the structure so this pointer is null
63 68 61 6e 67 65 20 74 6f 20 77 69 // the next 2 lines are the string + padding, because the string must contain a null byte terminator the full string length
64 65 73 63 72 65 65 6e 00 00 00 00 // becomes 21 characters long which can't be divided by 4 evenly, it is then padded with 3 null bytes to align to the boundary
conversion
Code: Select all
01 16 0e c6 e8 2d 1b 15 00 00 00 63 68 61 6e 67
65 20 74 6f 20 77 69 64 65 73 63 72 65 65 6e 00
output
Code: Select all
:i $printf$%s(21,"change to widescreen")