Oni (folder)/persist.dat: Difference between revisions

added plain-English lede; linked to save-gamed editors; noted that cheats are always unlocked these days; various wording
mNo edit summary
(added plain-English lede; linked to save-gamed editors; noted that cheats are always unlocked these days; various wording)
Line 1: Line 1:
{{Retitle|persist.dat}}
{{Retitle|persist.dat}}
As players of Oni are well aware, the game does not allow arbitrary saving ("save anywhere"), but relies on the use of fixed savepoints activated through level scripting by reaching certain places in each level. This means that by setting a maximum number of levels and savepoints for Oni, the developer could store the total state of the player's progress in a single, fixed-size file -- a 206,496 byte file, to be exact. In addition to savepoint data, persist.dat has a header which stores Oni's player settings (besides [[Oni (folder)/key_config.txt|key bindings]]). It also records whether the cheats are enabled (i.e. whether you have beaten the game), and whether you killed Griffin in {{C|13}}.
Persist.dat is the save-game and preference file for Oni. It can be edited most easily with GUI tools such as [[OSGE]] for Windows and [http://mods.oni2.net/node/155 OniLib] for Mac, though a hex-based examination of this file is given below for the curious.
 
==Introduction==
As players of Oni are well aware, the game does not allow arbitrary saving ("save anywhere"), but relies on the use of fixed savepoints activated through level scripting by reaching certain places in each level. This means that by setting a maximum number of levels and savepoints for Oni, the developer could store the total state of the player's progress in a single, fixed-size file -- a 206,496 byte file, to be exact.
 
In addition to savepoint data, persist.dat has a header which stores Oni's preferences as chosen on the Options screen (note that this does not include [[Oni (folder)/key_config.txt|key bindings]]). It also records whether the cheats are enabled, i.e. whether you have beaten the game (however, cheats are unlocked at all times when playing with the [[Daodan DLL]] installed or when using a [[AE:FERAL|Intel Mac build]]), and whether you killed Griffin in {{C|13}}.


The persist.dat file has nothing to do with Oni's [[Dat|instance files]] despite the ".dat" extension (it looks like Bungie West simply used .dat for every kind of file Oni read and wrote -- saved_film####.dat, lvl_#_###_corpse.dat, etc., then later on added .raw and then .sep as unique suffixes when they needed to break out the level data .dats).
The persist.dat file has nothing to do with Oni's [[Dat|instance files]] despite the ".dat" extension (it looks like Bungie West simply used .dat for every kind of file Oni read and wrote -- saved_film####.dat, lvl_#_###_corpse.dat, etc., then later on added .raw and then .sep as unique suffixes when they needed to break out the level data .dats).


The original Mac game application and the Omni Group build were for PPC Macs, thus numbers were written big-endian (e.g., the 0x08 field in the header would be 00 0C 7F 5C). This meant that the saved-game files were not interchangeable between PC and Mac versions of Oni. However, with modern Macs running a [[AE:FERAL|native Intel build]], the files are now all in little-endian format, as in Windows.
The original Mac game application and the Omni Group build were for PPC Macs, thus numbers were written big-endian (e.g., the 0x08 field in the header would be 00 0C 7F 5C). This meant that the saved-game files were not interchangeable between PC and Mac versions of Oni. However, with modern Macs running a native Intel build, the files are now saved in little-endian format, as in Windows.


The header of the file is 0x60=96 bytes long. It is followed by an array of 400 savepoints, 0x204=516 bytes each, grouped implicitly into 40 levels, 10 savepoints per level. The first 10 savepoints belong to level 0 and are never written to. The savepoints of the original 14 levels follow. This leaves 25 unused levels at the end of the saved-game file.
The header of the file is 0x60=96 bytes long. It is followed by an array of 400 savepoints, 0x204=516 bytes each, grouped implicitly into 40 levels, 10 savepoints per level. The first 10 savepoints belong to level 0, which contains global game data rather than a specific level, thus they are never written to. The savepoints of the original 14 levels follow. This leaves 25 unused level slots at the end of the saved-game file.


Only savepoint names are stored in this file (and they are all named uniformly as "Save Point ''x''" even though they could say anything). The actual level names are taken from the [[ONLD]] files of level 0, except for Chapters 0 and 1: "TCTF Training" and "Syndicate Warehouse" are hard-coded into the engine.  
Only the names of savepoints, not levels, are stored in this file (and they are all named uniformly as "Save Point ''x''" even though they could say anything). The actual level names are taken from the [[ONLD]] files of level 0, except for Chapters 0 and 1: "TCTF Training" and "Syndicate Warehouse" are hard-coded into the engine for some reason.


==Unlocking more levels==
==Unlocking more levels==
To unlock all possible levels, fill the range 0x08 to 0x28 with "FF". So far this has caused no problems, and allows you to add more levels to the game. Levels will not be visible unless there is a corresponding level''x''_Final.dat in the GameDataFolder, and an ONLD which matches this level number is found in level0_Final.dat. Levels above 39 are not currently unlockable due to the 40-level savepoint limit in the persist.dat (probably reflecting an underlying engine restriction).
To unlock all possible levels, fill the range 0x08 to 0x28 with "FF". So far this has caused no problems, and allows you to add more levels to the game. Levels will not be visible unless there is a corresponding level''x''_Final.dat in the GameDataFolder, and an ONLD which matches this level number is found in level0_Final.dat. Levels above 39 are not currently unlockable due to the 40-level savepoint limit in the persist.dat (probably reflecting an underlying engine restriction).


==Header==
==Header data==
[[Image:Persist_header.gif]]
[[Image:Persist_header.gif]]


Line 69: Line 74:
After this header is an array of 400 savepoints (40 levels, 10 savepoints per level). The size of a savepoint is 516 bytes so the array size is 206,400 bytes.
After this header is an array of 400 savepoints (40 levels, 10 savepoints per level). The size of a savepoint is 516 bytes so the array size is 206,400 bytes.


 
==Savepoint data==
==Savepoint==
[[Image:Persist dat.gif]]
[[Image:Persist dat.gif]]