GothicKit / ZenKit

A re-implementation of file formats used by the early 2000's ZenGin
http://zk.gothickit.dev/
MIT License
44 stars 10 forks source link

[v2.0.0] Investigate `§`-VObs #29

Closed lmichaelis closed 1 year ago

lmichaelis commented 1 year ago

These VObs are empty though they seem to be related to zCCSCamera keyframes. ZenLib calles them zReference but does not use them anywhere. Reverse-engineering of the original game binary might be required.

Leads:

lmichaelis commented 1 year ago

I believe I understand now how they are supposed to work since I had to use them in the new save-game parser here:

https://github.com/lmichaelis/phoenix/blob/224514412fbb72d0739a1f7ae19380a739889a26/source/vobs/misc.cc#L233-L254

It looks like these are actually references to other VObs in the same archive. Their index field contains the index of the object being referenced. Basically, any object within the archive can be referenced this way.

Implementing this fully, as originally intended, in phoenix would require additional memory overhead since we'd have to (at least) store the start position of each object in the VOb. We probably wouldn't be able to fully implement them anyways since the original archive implementation was tightly integrated in the game engine so this kind of reference would actually be able to grab a fully initialized VOb pointer and put it right there.

This means, the only real way to handle these is to save the object indices only where required and then use the references on a case-by-case basis. This means we need to find where §-VObs are actually used and make sure we're parsing them correctly (looking at you cs_camera).

lmichaelis commented 1 year ago

Hm it looks like this feature is not generally used within most archives. For now, it looks like we don't need to worry about supporting this in general.