HearthSim / UnityPack

Python deserialization library for Unity3D Asset format
https://hearthsim.info/
MIT License
720 stars 153 forks source link

Parsing object tree #64

Closed kbrewer08 closed 6 years ago

kbrewer08 commented 6 years ago

This isn't so much an issue as it is a request for guidance. I have a web application I'm writing in java that uses the api of a mobile game I play to display in-game information without actually being in game.

Part of this is getting all the image assets from the game, so I'm working on porting the unity asset bundle extraction / parsing from various sources online and this project has been the most useful. For not knowing Python (hearthsim) or javascript (another project), I think I'm doing a pretty decent job of following what's going on, as I'm all the way through to ObjectInfo.load at this point (from Object.py).

First of all, as an aside, I'm not sure what to do about the 1300 bytes of all zeros from the point where the object meta data appears to end, to where the first object tree actually begins.

Anyhow, the more important part is that I'm having a little trouble following what's going on when it comes to actually parsing the object tree. It seems to involve the methods on line 80 and 86 in Object.py, but, as mentioned, since I don't know Python I'm having trouble seeing how goes from finishing object meta data (ObjectInfo.load()), to reaching ObjectInfo.read() and ObjectInfo.read_value(), although I do gather that ObjectInfo.read() seems to load the actual object block into a buffer. Do you have a more straightforward flow of how to parse the actual object tree, hopefully that's java (or c/c++) friendly?

ifeherva commented 6 years ago

I do have a rust implementation if that helps you.

kbrewer08 commented 6 years ago

I'd take a look at that, sure. Thanks.