Fixed improper parsing of particles with version 5.2#270
Conversation
|
Related issue #143 |
|
For the most part, this is a step in the right direction. My previous research shows that the real struct is in fact typeNameIndex is always a ushort across all versions. v5 introduces a description string. I haven't looked into PCF in a LONG time, so I advise to double check carefully. Without having ran the code myself, my intuition is that typeNameIndex isn't going to be read properly in many cases because of this. |
|
Also you've missed this one which is a uint32 in v5 (as stated by the wiki) I'm really happy someone is looking into this btw <3 |
|
Thanks for catching that typeID! I'll look into the structure more, 2 shorts would make sense there |
|
It's difficult to tell if it's or I checked all 5.2 pcfs from momentum mod ( I believe that also includes all cs:go pcfs ) and last 2 bytes of the nameIndex are always 00 00. If it's meant to be a descriptionIndex it seems to be unused. Do you have any pcfs where that is not the case? |
|
Added a commit to always prepend "materials" and "models" to fully close #143 |
I'll have a look when I have the time, very glad to close the books on this old issue ^^ |
36cf4c0 to
f0ebf4c
Compare
|
If you don't manage to find any pcfs that don't have those bytes as 00 00 I think it's still safer to just read the name as ushort and skip next 2 bytes. There would need to be over 65535 strings in a pcf to use them anyway and I don't think any pcf even approaches that number. If you somehow manage to confirm it's an int I'll rebase and drop this last commit but I think it's safe to merge like this |
|
tldr: I've refreshed my memory by looking at the portal 2 and csgo files. nameIndex being a short or an int is not going to have any incidence as far as I can tell from all official pcf flles. That being said, I'm still going to make a case for the ushort description to anyone willing to hear me out (altho pointless it might be) Pcf stores all its strings in an array. I was attempting to be as thorough as possible when I wrote my own pcf parser back in the days. One thing I took the time to verify was the strings that were unaccounted for. In portal 2 and csgo, there are only 3 strings that come up all the time: "DmElement", "name" and "type_dictionary". For "DmElement", it seems somewhat obvious that it's an adequate description for the CDmxElement struct. I have not found the reason behind "name" and "type_dictionary". Those strings are a mystery to me to this day. Good luck to everyone on your future reverse engineering journeys ✌️ |
|
Thank you for looking into this! |
Changes
Followed Valve Developer Wiki to make parsing changes
Important Note
These changes were made and tested in my packing tool ( bspPack ) stripped out of CompilePal packing functionality.
I do not currently have access to windows to properly test them in CompilePal.
EDIT: Added a commit to fully close #143