Tes4Mod:Save File Format/REFR

The UESPWiki – Your source for The Elder Scrolls since 1995

Jump to: navigation, search

Contents

[edit] Overview

Warning: Everything else, except Moved record, is speculative at best. Other records are collected by using save game text dumps and automated parser from 15 save games that contained 90517 change records for this record type. Data is not verified from actual binary files.

Change records internal formats are still unknown. At best you can see here:

  1. Is change record's length constant or variable.
  2. Flags that are indicating change record's existence in the record.
    • It is assumed that "None", "Low", "High" and "Mid Low" change records doesn't have flags. Existence of these change records is depending to other - currently unknown - information.
    • If there is more than one flag, then it is possible that there multiple flags indicating change record - or there wasn't enough data to find single flag.
    • It is also possible that multiple change records are sharing same flags or change records are actually same record - they just have different name in dump file.
  3. Change record's minimal and maximal lengths.
  4. Possible substructures lengths inside change record. This length is largest common divider from all change records minimal and maximal lengths.


[edit] Form Flags (0)

Subrecords interpretation is still unknown.

This subrecord is used in BOOK, ACHR, ACRE, NPC_, REFR, KEYM record types.

Name Type/Size Info
flags ulong Flags related to record's form id ?Unknown interpretation?

[edit] Base Object (1)

Used for objectRefs "owned" by the savegame, i.e. objectRefs with modindex == 0xFF.

Name Type/Size Info
base iref Iref/formid for base object.

[edit] Moved (2)

This change record's length is constant 28 byte(s).

This change record is used in ACHR, ACRE, REFR record types. There was 4546 change records in save files.

Name Type/Size Info
moveData struct Movement data.
cell
ulong FormID of cell. (Not iref.)
x
float X coordinate.
y
float Y coordinate.
z
float Z coordinate.
rotationX
float
rotationY
float
rotationZ
float


[edit] Havok Moved (3) / Had Havok Move Flag (11)

This change record is used in ACHR, ACRE, REFR record types.

Name Type/Size Info
size ushort Size of havok move data.
data ubyte[size] Unknown structure.

[edit] Scale (4)

This change record is used in ACHR, ACRE, REFR record types.

Name Type/Size Info
scale float

[edit] All Extra (5)

This change record's length is between 7 and 12 bytes. Largest common divider in variable part is 5 byte(s). One possibility is that there is 7 byte(s) header and 5 byte(s) substructures in array which maximal size is 1 items.

This change record is used in REFR record types. There was 1426 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[7] Minimal length of observed change records.
unknownArray struct[0-1] Possible substructure array
item
ubyte[5] Possible substructure item


[edit] Lock (6)

This change record's length is constant 9 byte(s).

This change record is used in REFR record types. There was 4296 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[9] Constant length of observed change records.


[edit] Owner (7)

This change record's length is constant 7 byte(s).

This change record is used in REFR record types. There was 530 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[7] Constant length of observed change records.


[edit] Map Marker Flags (10)

This change record's length is constant 4 byte(s).

This change record is used in REFR record types. There was 267 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[4] Constant length of observed change records.

[edit] Empty Flag (16)

This change record's length is constant 2 byte(s).

This change record is used in REFR record types. There was 1951 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[2] Constant length of observed change records.


[edit] Dropped Item Flag (1, 17)

This change record's length is constant 0 byte(s).

This change record is used in REFR record types. There was 168 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[0] Constant length of observed change records.


[edit] Door Default State (18)

This change record's length is constant 2 byte(s).

This change record is used in REFR record types. There was 12 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[2] Constant length of observed change records.


[edit] Door State (19)

This change record's length is constant 0 byte(s).

This change record is used in REFR record types. There was 918 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[0] Constant length of observed change records.


[edit] Teleport (20)

This change record's length is constant 31 byte(s).

This change record is used in REFR record types. There was 2 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[31] Constant length of observed change records.


[edit] Extra Magic (21)

This change record's length is between 9 and 15 bytes. Largest common divider in variable part is 6 byte(s). One possibility is that there is 9 byte(s) header and 6 byte(s) substructures in array which maximal size is 1 items.

This change record is used in REFR record types. There was 167 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[9] Minimal length of observed change records.
unknownArray struct[0-1] Possible substructure array
item
ubyte[6] Possible substructure item


[edit] Furniture Markers (22)

This change record's length is constant 2 byte(s).

This change record is used in REFR record types. There was 9966 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[2] Constant length of observed change records.


[edit] Oblivion Flag (23)

This change record's length is constant 0 byte(s).

This change record is used in ACHR, ACRE, REFR record types. There was 18 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[0] Constant length of observed change records.


[edit] Movement Extra (24)

This change record's length is between 0 and 649 bytes. Largest common divider in variable part is 1 byte(s). One possibility is that there is 0 byte(s) header and 1 byte(s) substructures in array which maximal size is 649 items.

This change record is used in ACHR, ACRE, REFR record types. There was 914 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[0] Minimal length of observed change records.
unknownArray struct[0-649] Possible substructure array
item
ubyte[1] Possible substructure item


[edit] Animation (25)

This change record's length is between 0 and 145 bytes. Largest common divider in variable part is 1 byte(s). One possibility is that there is 0 byte(s) header and 1 byte(s) substructures in array which maximal size is 145 items.

This change record is used in ACHR, ACRE, REFR record types. There was 396 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[0] Minimal length of observed change records.
unknownArray struct[0-145] Possible substructure array
item
ubyte[1] Possible substructure item


[edit] Script (26)

This change record's length is between 8 and 108 bytes. Largest common divider in variable part is 4 byte(s). One possibility is that there is 8 byte(s) header and 4 byte(s) substructures in array which maximal size is 25 items.

This change record is used in ACHR, ACRE, REFR record types. There was 2171 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[8] Minimal length of observed change records.
unknownArray struct[0-25] Possible substructure array
item
ubyte[4] Possible substructure item

Wrye's Incomplete Tests: Seems to be some header stuff, then a count of number of variables with values, then array of index of variable then value of variable.

Length 10 (no variables):
\x01\x00\x12\x0f>\x00\x00\x00\x00\x00

Length 42 (3 vars: 2 shorts, 1 ref)
\x01\x00\x12\x0f>\x00\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00$@\x03
\x00\x00\x00\x00\x00\x00\x00\x00\x00>@\x04\x00\x00\xf0\xd9\x01\x00\x00\x00

So, at byte 8 is a count of the number of variables. After that is variable index 1 (4 byte integer), then the value, stored as a double (8 bytes). Then variable index 3, and its value. Then variable index 4 -- but here, the high 4 bits 'f' seem to flag that this is a reference, then the iref as a 4 byte integer. Finally something else (another counter??) wich is zero.

It seems that all numbers (but not refs), despite the script definition (short, long, float) are stored as doubles. Also, the variable index matches the index as defined in the source mod's SLSD/SCVR variable definition.

Variable storage in savegames: Numeric values of zero are not stored. Also, it seems that if the script for whatever reason undefines a variable, then the savegame will discard the values that it previously had saved for that variable.

This last may be important as it seems to allow "scrubbing" changes from scripts. E.g., supose Master A, then mod B, and mod C, both of which add new, conflicting variable lists to the same script from A. Now suppose a savegame running on mod B, where you want to switch to mod C. To do so: 1) Unload B. 2) Load the savegame and resave (this should scrub the scripts variables back to only those defined by master A). 3) Load C. 4) Load updated savegame and play.

[edit] Inventory (27)

Inventory subrecord contains items that character, creature or containers (drawers, chests, etc.) currently have - and doesn't have anymore. If your character (or other actor) removes item that was added to the inventory in ESM/ESP files, then inventory remembers also that item has be taken away from the inventory. You need to remember that these are change records and removing items from the inventory are also change actions. For example: If you buy storage area furniture to your Imperial City house and then take away rough leather shoes from the drawer next from the your bed, game will set "rough leather shoes" item count to 0 and store some addiotinal data so that it remembers what happened from them. Bit more bizarre example: At the startup your character receives "royal jewelry" a.k.a. wrist irons, if you never drop or sell them they are not listed in your characters inventory subrecord, because you are still carrying them.

If you want get completly list of inventory's contents, you need to read first the inventory's contents from ESM and ESP files. After that you can read save files contents and add or remove items to the inventory's final list. It is not enough if you just read save files inventory subrecord, because you wouldn't find "default" inventory items from there - unless they are removed from the inventory.

Inventory's data length is variable and you need to decode entire inventory, before you know it's final length. Basic inventory item entry have refid, count (ulong) and extra information count (ulong). There are multiple types of extra information substuctres. For example: substructure that is created when character removes item from the inventory and substructure that is storing item's script variables. Currently not all extra substructures are known - it also possible that all of them are never known.

This subrecord is used in ACHR, ACRE, REFR record types.

Name Type/Size Info
itemNum ushort How many items are stored to the inventory.
itemArray struct[itemNum] Items stored to the inventory.
itemId
refId Item's refid. If first byte is FF, item is crafted by player and item can be found from enchanced items array.
num
long How many items of this type stored to the inventory. If 0, item is moved to another place from the inventory, but it was orginally placed to this inventory in ESM/ESP file. Extra information should provide addiotional information. If -1, item is sold or deleted, and it can't be found from game anymore.
extraInformationNum
long How many extra information structures are stored to the item.
extraInformation
struct[ extraInformationNum ] Extra information. This doesn't exists in the inventory's item entry, if extraInformationCount is 0.
extraType
ubyte[ 3 ] Extra information's type. For example extraType 0x0001 0x12 is "Script" extra type.
extraTypesData
ubyte[ variable ] Extra type's data.

[edit] Script (0x0001 0x12)

This extra type stores script referenceid and script's variables that are attached to the item.

Name Type/Size Info
scriptId refId Script's reference id.
variableNum ushort How many variables are stored to extra information.
unknown1 ubyte ?Maybe how many times script has been run.?
variables struct[ variableNum ]
variableData
ubyte[ 12 ] It is still unknown are long type variable stored to 12 bytes.

[edit] Equipmented (0x0001 0x1B)

Item is currently equipmented by the actor. Extra type's data length is 0.

[edit] Light Source Info (0x0001 0x2D)

Item is light source (torch) and this information stores something related to it. Maybe how long torch still burns before, it burns out.

Name Type/Size Info
unknown1 float ?Maybe how long left before light source is burned out?

[edit] Quest Script (0x0002 0x12)

This extra information seem to be related to quest items. For example to Mysterium Xarxes have this extra information.

Name Type/Size Info
scriptId refId Script's reference id.
unknown1 ulong
unknown2 ulong

[edit] Equipmented Ammunition (0x0002 0x1B)

For ammunition that is equipmented.

Name Type/Size Info
unknown1 ubyte
count ushort Count of ammunition.


[edit] Moved (0x0002 0x36)

It seems like that this extra information is generated for items that are moved from their orginal inventory to another location. Item count for these items is 0.

Name Type/Size Info
unknown1 ubyte[ 8 ]

[edit] Unknown (0x0002 0x55)

This extra information is related to enhanced weapons like swords and bows that requires charges - and also to weapon that is equipmented. Also at least potions that are added to shorcut bar seem to generate this extra information. There is at least 4 variations from this extra information. Each have different lengths.

Variation Length Info
0 15 Potions that are added to shortcut bar.
1 1 Currently equipmented weapon that is not enhanced.
2 17 Magical swords.
3 8 Magical bows.


Name Type/Size Info
variation ubyte Variation 0 seem to have
variationData ubyte[ ? ] See variation data table for length.

[edit] Created (1, 28)

This change record's length is constant 36 byte(s).

This change record is used in ACHR, ACRE, REFR record types. There was 770 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[36] Constant length of observed change records.


[edit] Leveled Creature (1, 28)

This change record's length is constant 1 byte(s).

This change record is used in ACHR, ACRE, REFR record types. There was 770 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[1] Constant length of observed change records.


[edit] Enabled (30)

This change record's length is constant 0 byte(s).

This change record is used in ACHR, ACRE, REFR record types. There was 346 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[0] Constant length of observed change records.


[edit] Disabled (30)

This change record's length is constant 0 byte(s).

This change record is used in ACHR, ACRE, REFR record types. There was 149 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[0] Constant length of observed change records.


[edit] Disabled/Enabled (30)

This change record's length is unknown, because it never was loaded. Smallest record where it was stored, was 58 byte(s).

This change record is used in ACHR, ACRE, REFR record types. There was 163 change records in save files.

This information is NOT verified from actual save files.

Name Type/Size Info
unknown ubyte[58] Smallest record size where change record was stored.
Sponsored Links
Personal tools