Post by Reflet on Dec 1, 2017 22:28:32 GMT
One section of .pet files is known as the "Veterinary History". It starts off small but as a pet gains life experiences, it will grow to contain various sections: YALP, DEFB, CSID, AERT, ELFM, and ETAM. YALP is PLAY backwards, and the same applies to the other sections: BFED, DISC, TREA, MFLE, and MATE. If I had to make a rough estimate, PLAY deals with toyz, BFED deals with food, DISC deals with frisbees, TREA deals with treats, MFLE deals with... fleas?? and MATE deals with mates. Here is a screenshot of a pet's YALP section of the Veterinary History.
It may seem confusing, but I can break down at least part of it. As you can see by the ASCII on the right, the first long number is simply the string "YALP". On the next line, we have 0x1E, which is hexadecimal for 30. After that, 0x04, which obviously is 4. Then we have 4 hexadecimal timestamps. Immediately after the 4 timestamps is another 0x04.
From this, we can infer that 30 is the maximum length of this "list", and 4 is the number of items currently in the "list". This is confirmed by the fact that the list never grows larger than 30 items.
Next, there are 4 consecutive instances of 0x64 (decimal 100). While I was reversing the trick section of a .pet file, I discovered each trick slot had a byte that ranged from 0 - 100 in value. It would increase when I gave the pet a treat for the trick and decrease when I didn't give the pet a trick. A function called AssociationMatrix::ReinforceAssociation accessed that value to modify it. I don't think it's a stretch to say that these numbers are the "association" values for each of the long numbers. I'd have to do a bit more testing to say for sure, though.
The timestamps are what puzzle me. When put into a hexadecimal timestamp converter, they give the correct date, but not the correct time. These sorts of timestamps count the number of seconds since January 1st, 1970. Above the trick section are more examples of these timestamps, controlling how the game calculates the elapsed time of when you last played with the pet and stuff. Those give the correct time, so it's not a timezone issue. Besides, time does its calculations according to your computer's system time.
It's possible that the programmers, in the interest of space, combined a timestamp with an ID number for these lists. It's hard to say, though. I need to research these more and do more experiments. The other numbers in this, as far as I know, are static and don't change. Or they may change between pets? Not sure yet.