This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Simca

Pages: [1]
1
Miscellaneous / Re: [Legion] WDB5 format
« on: May 04, 2016, 09:01:19 pm »
Yeah, basically old school DBC column guessing strategy.

I use a priority-based system, like:
1. If every value in the column is 0, it's an integer.
2. If every value in the column exists in our string position map, it's a string.
3. If every value in the column where it is not 0 has the exponent bits for floats set to a number greater than ~120, it's a float.
4. Else, it's an integer.

A couple notes for WDB5: string and float fields still -must- be 4 bytes. So if the field is less than 4 bytes, it is automatically an integer.

Also, there are going to be a lot of problems with signed and unsigned integers if you autodetect like this. Foreign keys are generally unsigned and it sometimes makes a big difference. Other values are generally signed, and it sometimes makes a big difference. You might be able to write some form of autodetection for signed vs unsigned (or take it from somewhere else) but it is going to be annoyingly complicated.

Lastly, I recommend against a dedicated flags column type. At the end of the day, displaying the numbers as 0x(some hex value) doesn't actually make flags significantly more clear or useful (imo), so it's best to just parse flags you want later, after converting to CSV or some other form.

2
Miscellaneous / Re: [Legion] WDB5 format
« on: April 18, 2016, 09:04:28 pm »
It is uint16; uint40 is an illusion created by record alignment.

When Blizzard writes records to files, the end of the record is aligned to the largest field size used.

In this file in question, the ID field starts at 0x1B into the record and lasts for 2 bytes according to the field structure block ((32 - 0x10) / 8 = 2). This puts the end of the field at 0x1D. However, the record size field in the header says the record is 0x20. The difference is because of the alignment I just mentioned. The largest field size used in the record is 4 bytes. The nearest values divisible by 4 bytes are 0x1C (which the ID field goes past) and 0x20, so the record is padded by 3 bytes to make it properly align at 0x20.

So yes, you can read it with that structure, but it would be better to read it as uint16 and then skip to the end of the record.

Pages: [1]