19,656
edits
(corrected PS2 checksum; *someone* appears to have typed in this checksum instead of copy-pasting it ^_^) |
m (wording tweaks, mostly in the introduction) |
||
Line 1: | Line 1: | ||
{{UpdatedForOniX|1.0.0}} | {{UpdatedForOniX|1.0.0}}<!--Documentation below is waiting to be un-commented.--> | ||
{{OBD Home}} | {{OBD Home}} | ||
{{Hatnote|".dat" redirects here; for other files ending in ".dat", see [[Oni (folder)]].<br> | {{Hatnote|".dat" redirects here; for other files ending in ".dat", see [[Oni (folder)]].<br> | ||
:You should read the [[Game data terminology]] page before this one.<br> | :You should read the [[Game data terminology]] page before this one.<br> | ||
:The [[Raw|Raw and separate file formats]] page should be read after this one.}} | :The [[Raw|Raw and separate file formats]] page should be read after this one.}} | ||
Files in GameDataFolder/ named "level[0-19]_Final.dat", together with ".raw" and sometimes ".sep" counterparts, contain the game data for Oni. | Files in GameDataFolder/ named "level[0-19]_Final.dat", together with ".raw" and sometimes ".sep" counterparts, contain the game data for Oni. These are called "instance files" internally, but a more common-sense name for them is level data files. The format described below was also used for the tool files which supplied the GUI for the in-game editor, however the retail Oni game application refuses to load tool files; for the story behind the tool files, see [[level0_Tools]]. | ||
The level 0 files do not contain resources for a specific level but rather resources (instances) shared across all levels. Level 0 is loaded when the game starts and is never unloaded. All other level files, 1-19, are only loaded when their corresponding level starts and then unloaded when it ends. Oni can only hold two level files in memory concurrently. Thus, resources have to be duplicated on disk whenever a character class, sound effect, etc. occurs in more than one level. For instance, although there are only 2,380 unique sounds in the game, there are 7,386 sounds stored across all level data files. | |||
The level 0 files do not | |||
{{TOClimit}} | {{TOClimit}} | ||
==Backwards and garbage data== | ==Backwards and garbage data== | ||
As mentioned, the game's developers used the in-game editor to create AIs, particles, etc. in a level. When one of these developers saved his work, the contents of the level, stored in his PC's RAM, were flushed directly to disk. Thus the structure of the .dat/.raw/.sep files reflects the way in which Bungie West chose to store levels in memory. So when we read the data in the files with a hex editor, we can see eccentricities such as blank space (coming from unused fields and byte-alignment padding) and garbage data (such as now-meaningless pointer values). [[OBD:Raw and separate file formats#Gaps|Further gaps]], mostly representing orphaned obsolete resources, add up to about 25 MB for the whole game. | |||
Additionally, because the levels were built on Intel-based machines, which use a little-endian architecture, sequences of bytes which represent numbers were written from least-significant to most-significant byte. [[wp:FourCC|FourCCs]] in the data are stored "backwards", such as "13RV" which is meant to be read "VR31", because Bungie defined those four bytes as a 32-bit integer, not a string, causing them to be written to disk in little-endian order. | Additionally, because the levels were built on Intel-based machines, which use a little-endian architecture, sequences of bytes which represent numbers were written from least-significant to most-significant byte. [[wp:FourCC|FourCCs]] in the data are stored "backwards", such as "13RV" which is meant to be read "VR31", because Bungie defined those four bytes as a 32-bit integer, not a string, causing them to be written to disk in little-endian order. | ||
Line 24: | Line 22: | ||
==Header== | ==Header== | ||
Here is a walkthrough of an instance file using the level0_Final.dat in English Windows Oni. Follow along in a hex editor for maximum | Here is a walkthrough of an instance file using the level0_Final.dat in English Windows Oni. Follow along in a hex editor for maximum educational value. Each term will be explained in-depth when we fully consider the related data. First, here is how the file begins: | ||
{{Table}} | {{Table}} | ||
{{OBD_Table_Header}} | {{OBD_Table_Header}} | ||
Line 31: | Line 29: | ||
*0x0003BCDF23C13061 (v1.1) - templates compatible with Windows demo and Mac engines | *0x0003BCDF23C13061 (v1.1) - templates compatible with Windows demo and Mac engines | ||
*0x0003BA70A8DBAE11 (PS2) - templates compatible with PlayStation 2 engine(s) | *0x0003BA70A8DBAE11 (PS2) - templates compatible with PlayStation 2 engine(s) | ||
*0x0000000000000000 (blank) - for use with [[OniX]] engine(s) | *0x0000000000000000 (blank) - for use with [[OniX]] engine(s)<!--, which instead handle data versioning using the 0x3C field below--> | ||
OniSplit's .oni files | OniSplit's .oni files use PC 1.0 checksum by default and 1.1 checksums when holding data that is stored differently in the 1.1 format (SNDD, TXMP, AGQG, M3GM, IGSt, TSFT/TSGA, TRAM/TREX) }} | ||
{{OBDtr| 0x08 | uint32 | | 31 33 52 56 | '13RV' | .dat version (meant to be read as "VR31")<br>OniSplit's .oni files use '23RV' ("VR32") instead<br>OniX's [[Oni (folder)|GDFX]] uses '33RV' ("VR33") to signify that the new data versioning system is in use }} | {{OBDtr| 0x08 | uint32 | | 31 33 52 56 | '13RV' | .dat version (meant to be read as "VR31")<br>OniSplit's .oni files use '23RV' ("VR32") instead<br>OniX's [[Oni (folder)|GDFX]] uses '33RV' ("VR33") to signify that the new data versioning system is in use }} | ||
{{OBDtr| 0x0C | uint16 | | 40 00 | 64 | size of this header }} | {{OBDtr| 0x0C | uint16 | | 40 00 | 64 | size of this header }} |