PyPoE icon indicating copy to clipboard operation
PyPoE copied to clipboard

RFC: Add new field type to support dat64

Open SnosMe opened this issue 3 years ago • 1 comments

Currently, foreign keys are treated as ulong. While it seems to work on .dat, the correct type of field is (ptr_size + ptr_size). The first pointer is an actual row index in foreign dat file, the second pointer is always NULL.

I propose to add new field type foreignkey (or genericgeneric).

Specification can be auto updated thanks to the naming conventions

if (string.endsWith(field.name, "Keys") && field.type == "ref|list|ulong") {
  field.type = "ref|list|foreignkey"
}

if (string.endsWith(field.name, "Key") && field.type == "ulong") {
  field.type = "foreignkey"
}

Here's example from BaseItemTypes: .dat at top, .dat64 at bottom.

unknown


image

SnosMe avatar Oct 02 '20 09:10 SnosMe

Yeah, that's something I wanted to do for a while, though I've not considered supporting the 64 bit files a priority. I'm not really happy with ref|generic right now - I was thinking of renaming the stuff to ref|key and ref|foreignkey respectively

size_t can't be used in python while unpacking because that's based on the interpreter, not the file. So, effectively I still have to use 32/64 bit integers depending on the target file.

OmegaK2 avatar Oct 02 '20 14:10 OmegaK2