OBD:Instance file format: Difference between revisions

m
using the engine term "placeholder" instead of "empty" because it's clearer
(discovered the hard way that the "+1" on the instance ID actually has value)
m (using the engine term "placeholder" instead of "empty" because it's clearer)
Line 166: Line 166:
;Flags - data usage
;Flags - data usage
:0x'''01''' 00 00 00 - unnamed
:0x'''01''' 00 00 00 - unnamed
:0x'''02''' 00 00 00 - empty
:0x'''02''' 00 00 00 - placeholder
:0x'''04''' 00 00 00 - never used; intended to mark instance as pointing to duplicate data rather than its own data
:0x'''04''' 00 00 00 - never used; intended to mark instance as pointing to duplicate data rather than its own data
:0x'''08''' 00 00 00 - instance's data is being used by duplicate instances as a source
:0x'''08''' 00 00 00 - instance's data is being used by duplicate instances as a source
Line 185: Line 185:
:0x00 00 '''00''' 00 - versioning timestamp – month
:0x00 00 '''00''' 00 - versioning timestamp – month
:0x00 00 00 '''00''' - versioning timestamp – year-->
:0x00 00 00 '''00''' - versioning timestamp – year-->
The flags "unnamed" and "empty" require special explanation.
The flags "unnamed" and "placeholder" require special explanation.


===Unnamed and empty resources===
===Unnamed and placeholder resources===
You'll notice that the level file header lists fewer names (7,124) than instances (9,347). That's because there are 3 types of instance:
You'll notice that the level file header lists fewer names (7,124) than instances (9,347). That's because there are 3 types of instance:
*Unnamed and not empty - they are only referenced by other instances in the same file, generally as child data (e.g., 3D geometry elements like ABNA are "contained" by AKEV, a level's environment).
*Unnamed and not placeholder - they are only referenced by other instances in the same file via instance ID; these are generally what can be considered child data of a named instance (e.g., 3D geometry elements like ABNA are "contained" by AKEV, a level's environment).
*:In vanilla Oni .dats there are some rare occurrences of unnamed non-empty ''orphan'' instances (e.g., [[OBD:File types/Naming#TRCM|TRCM]]). These are a form of garbage and are discarded by OniSplit when unpacking a level.  
*:In vanilla Oni .dats there are some rare occurrences of unnamed non-placeholder ''orphan'' instances (e.g., [[OBD:File types/Naming#TRCM|TRCM]]). These are a form of garbage and are discarded by OniSplit when unpacking a level.  
*Named and not empty - they can be referenced by other instances in any file and the engine can use their name or template tag to find them.
*Named and not placeholder - they can be referenced by other instances in any file and the engine can use their name or template tag to find them.
*Named and empty - "empty" instances are used in level-specific instance files (i.e. not in level0_Final.dat) to associate an instance ID with a name. For every empty resource, there's another one with a matching name in level0_Final.dat that has data in it. The empty resource in the instance file is (usually) looked up by ID, then the engine searches all the loaded files for a non-empty instance with the same name, causing it to find the actual file in the global data in level0_Final.dat.
*Named and placeholder - "placeholder" instances are used in level-specific instance files (i.e. not in level0_Final.dat) to associate an instance ID with a name. For every placeholder resource, there's another one with a matching name in level0_Final.dat that has data in it. The placeholder resource in the instance file is looked up by ID or name and then the engine searches all the loaded files for a non-placeholder instance with the same name, causing it to find the actual file in the global data in level0_Final.dat.


===Peeking ahead at instance name===
===Peeking ahead at instance name===