Skip to content

Serialization

Ryan edited this page May 9, 2019 · 12 revisions

Summary

SKSESerializationInterface can be accessed from SKSEInterface by calling SKSEInterface::QueryInterface(kInterface_Serialization). The serialization interface allows plugin authors to serialize data to the SKSE co-save. This can be useful if the author wishes to persist data between runs of the executable.

Class Interface

  • version: This is the version of the exported interface. Plugin authors should assert on this field if they require a certain version.
  • SetUniqueID: This is a unique signature for your plugin, which SKSE will use to call your plugin when serializing to/from the co-save. Give it a four letter signature that's a shorthand for your plugin name (i.e. 'PLGN').
  • SetRevertCallback:
  • SetSaveCallback: This assigns the function that will be called whenever the game saves.
  • SetLoadCallback: This assigns the function that will be called whenever the game loads.
  • SetFormDeleteCallback: This assigns the function that will be called whenever a form is deleted.
  • WriteRecord: This writes the buffer buf with the number of bytes length to the co-save under the signature type with the version version.
  • OpenRecord: This opens a record in the co-save with the given signature type and the version version. It returns a boolean indicating success.
  • WriteRecordData: This writes the buffer buf with the number of bytes length to the co-save. It returns a boolean indicating success.
  • GetNextRecordInfo: This reads the next record's info from the co-save, storing the signature in type, the version in version, and the number of bytes in length. It returns a boolean indicating success.
  • ReadRecordData: This reads the specified number of bytes length into the given buffer buf from the co-save. It returns the number of bytes actually read.
  • ResolveHandle: This takes a virtual machine handle handle as it was when the save was made and writes the handle as it is when the save is loaded into handleOut. It returns a boolean indicating success.
  • ResolveFormId: This takes a formID formId as it was when the save was made and writes the formID as it is when the save is loaded into formIdOut. It returns a boolean indicating success.

Usage

Clone this wiki locally