Difference between revisions of "Sims 3:0x06B981ED"

From SimsWiki
Jump to: navigation, search
(Primitive Types)
(Primitive Types)
Line 74: Line 74:
  
 
== Primitive Types ==
 
== Primitive Types ==
 +
 +
Defined in ScriptCore.PersistedTypeCode
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 81: Line 83:
 
!  Data format
 
!  Data format
 
!  Notes
 
!  Notes
 +
|-
 +
|  0x00
 +
|  Null
 +
|
 +
|
 
|-
 
|-
 
|  0x01
 
|  0x01
Line 95: Line 102:
 
|  Byte
 
|  Byte
 
|  BYTE
 
|  BYTE
 +
 +
|-
 +
|  0x04
 +
|  Char
 +
|  Unknown
 
|   
 
|   
 
|-
 
|-
Line 101: Line 113:
 
|  QWORD
 
|  QWORD
 
|  [http://msdn.microsoft.com/en-us/library/system.datetime.frombinary.aspx System.DateTime] FromBinary() and ToBinary() format
 
|  [http://msdn.microsoft.com/en-us/library/system.datetime.frombinary.aspx System.DateTime] FromBinary() and ToBinary() format
 +
|-
 +
|  0x06
 +
|  Decimal
 +
|  Unknown
 +
|
 +
|-
 +
|  0x07
 +
|  Double
 +
|  QWORD
 +
|
 
|-
 
|-
 
|  0x08
 
|  0x08
Line 123: Line 145:
 
|-
 
|-
 
|  0x0C
 
|  0x0C
Float
+
Single
FLOAT
+
DWORD
 
|  Single precision floating point number
 
|  Single precision floating point number
 
|-
 
|-
Line 143: Line 165:
 
|-
 
|-
 
|  0x10
 
|  0x10
Struct
+
Object
 
|  DWORD type<br>
 
|  DWORD type<br>
 
Various data
 
Various data
Line 150: Line 172:
 
|-
 
|-
 
|  0x10
 
|  0x10
|  Object reference
+
|  Object
 
|  DWORD type<br>
 
|  DWORD type<br>
 
Count * DWORD instance reference
 
Count * DWORD instance reference
Line 162: Line 184:
 
Data type 0x10 is treated as an object reference rather than the direct formatted data
 
Data type 0x10 is treated as an object reference rather than the direct formatted data
 
|  Referenced by most single member collection classes as well (List, ArrayList, Queue, Stack, etc)
 
|  Referenced by most single member collection classes as well (List, ArrayList, Queue, Stack, etc)
 +
|-
 +
|  0x12
 +
|  Type Zero based
 +
|  Unknown
 +
|  Assume this is like the one based, but the values are 1 lower.  Not seen in the wild.
 +
|-
 +
|  0x13
 +
|  Broken Protected Object
 +
|  Unknown
 +
|
 +
|-
 +
|  0x14
 +
|  External Object
 +
|  Unknown
 +
|
 +
|-
 +
|  0x15
 +
|  Broken Enum
 +
|  Unknown
 +
|
 
|-
 
|-
 
|  0x16
 
|  0x16
Opaque object
+
Protected Object
 
|  BYTE length<br>
 
|  BYTE length<br>
 
DWORD type<br>
 
DWORD type<br>
 
BYTE x (length - 4)
 
BYTE x (length - 4)
Seems to be used for storing opaque type data, possibly for classes representing non-managed interfaces.  Currently only seen referring to DriverHandleWrapper class.
+
Stores "protected" objects in an opaque manner.  Currently only seen referring to DriverHandleWrapper class.
 
|-
 
|-
 
|  0x17
 
|  0x17
Line 179: Line 221:
 
|-
 
|-
 
|  0x18
 
|  0x18
MethodInfo
+
Method
 
|  DWORD<br>DWORD<br>DWORD<br>DWORD
 
|  DWORD<br>DWORD<br>DWORD<br>DWORD
Part of the definition of a serialized delegate
+
Used to encode MethodInfo from a delegate
 
|-
 
|-
 
|  0x19
 
|  0x19
Line 190: Line 232:
 
|-
 
|-
 
|  0x1A
 
|  0x1A
|  Type
+
|  Type One Based
 
|  BYTE+<br>
 
|  BYTE+<br>
 
(BYTE)s as needed for the type ID
 
(BYTE)s as needed for the type ID
 
|  Corresponds to System.Type, and references the type by ID<br>
 
|  Corresponds to System.Type, and references the type by ID<br>
 
Same format used for Enum definition where it encodes the type of the enum<br>
 
Same format used for Enum definition where it encodes the type of the enum<br>
For example, 0x82 0x0A would encode the value 266.
+
For example, 0x82 0x0A would encode the value 266.  This indexes the types starting at 1 rather than 0, so the actual type value is one less than the number (So the type number in the exampe would be 265).
 
|}
 
|}
 
Finding the rest of the primitive types would involve trial and error using custom scripts to create objects to be persisted.
 

Revision as of 07:17, 22 June 2009

OBJS - Serialized script objects
By Tiger

The data is divided into four sections

Contents

Data sections

Header (28 bytes)

DWORD version?		- currently 0x00000500
DWORD magic value	- ("OBJS")
DWORD count1		- Count of defined object types
DWORD count2		- Count of number of saved instances
DWORD			- Offset from the start of the header of the type definitions
DWORD			- Offset from the start of the header to the instance pointer table
DWORD			- Offset from the start of the header to a TGI index

Instances

count2 (above) entries:

BYTE - Data type
{Data}

See below for the types of data and the format of the data. Most common here are 0x10 and 0x11, but boxed value types can appear here as well, for example when a number or enum is added to a System.List<System.Object> collection.

Instance index

count2 repeats of
DWORD - Pointer to the start of the serialized instance data

This index is 1 based, with the first entry referenced as entry 1.  0 is reserved to indicate null references

Type definitions

Very loosely structured data, with lots of flags and optional values including count1 entries

Each entry consists of
TYPE_SIGNATURE {TYPE_METHODS | INTERFACE}

TYPE_SIGNATURE =
[TYPE_MODIFIERS] [GENERIC_DEFINITION] NAMESTRING

TYPE_MODIFIERS =
[DUPLICATE_DEFINITION] [GENERIC_PARAMETERS] NULLBYTE

DUPLICATE_DEFINITION = 0x02

GENERIC_PARAMETERS = 0x2x where x is gemeric parameter count - 1

GENERIC_DEFINITION = x+1 (If x was specified) repeats of
  TYPE_SIGNATURE

NAME =
CHAR_COUNT BYTE(With CHARCOUNT repeats)

CHAR_COUNT =
BYTE [BYTE] (7 bit MSB order bytes, with the high bit indicating continuation)

TYPE_METHODS =
METHOD_COUNT [(1..N)METHOD_DEFINITION]

METHODCOUNT =
BYTE [BYTE] (7 bit MSB order bytes, with the high bit indicating continuation and the first byte having a 7 bit value no higher than 0x3f)

METHOD_DEFINITION =
NAME PRIMITIVE_TYPE

PRIMITIVE_TYPE =
BYTE (See section below)

INTERFACE =
0x7F

Generic parameter definitions can be nested in the data structure, as would be required by System.Dictionary<System.UInt32,System.List<Sims3.CAS.SimDescription>>

TGI

DWORD count5 - count of TGI entries
TGI entries, in standard order

Primitive Types

Defined in ScriptCore.PersistedTypeCode

Byte Type of data Data format Notes
0x00 Null
0x01 Reference DWORD of instance ID
0x02 Boolean BYTE 0 for false, 1 for true
0x03 Byte BYTE
0x04 Char Unknown
0x05 DateTime QWORD System.DateTime FromBinary() and ToBinary() format
0x06 Decimal Unknown
0x07 Double QWORD
0x08 Short WORD
0x09 Int DWORD
0x0A Long QWORD
0x0B SByte BYTE Signed byte
0x0C Single DWORD Single precision floating point number
0x0D Ushort WORD Unsigned
0x0E Uint DWORD Unsigned
0x0F Ulong QWORD Unsigned
0x10 Object DWORD type

Various data

Type references a defined structure, with the fields for that object immediately following

Usually appears as the type of an instance, but it can appear in the middle of formatted data to represent a non-system defined value type (IE a struct)

0x10 Object DWORD type

Count * DWORD instance reference

When in the context of an array (Type 0x11)
0x11 Array DWORD Length

BYTE Primitive type
Length * format appropriate for data type
Data type 0x10 is treated as an object reference rather than the direct formatted data

Referenced by most single member collection classes as well (List, ArrayList, Queue, Stack, etc)
0x12 Type Zero based Unknown Assume this is like the one based, but the values are 1 lower. Not seen in the wild.
0x13 Broken Protected Object Unknown
0x14 External Object Unknown
0x15 Broken Enum Unknown
0x16 Protected Object BYTE length

DWORD type
BYTE x (length - 4)

Stores "protected" objects in an opaque manner. Currently only seen referring to DriverHandleWrapper class.
0x17 Enum BYTE+ Type of enum

(BYTES) optional additional as needed for the size of the type ID
BYTE Numerical primitive type (3, 8, 9, 10, etc)
BYTE/WORD/DWORD/QWORD Enum value

The length is encoded as 7 bits, with the high bit indicating the value continues to further bytes. The value is in MSB order (Opposite normal byte order)
0x18 Method DWORD
DWORD
DWORD
DWORD
Used to encode MethodInfo from a delegate
0x19 ResKey DWORD Index into the TGI table. Corresponds to Sims3.SimIFace.ResourceKey
0x1A Type One Based BYTE+

(BYTE)s as needed for the type ID

Corresponds to System.Type, and references the type by ID

Same format used for Enum definition where it encodes the type of the enum
For example, 0x82 0x0A would encode the value 266. This indexes the types starting at 1 rather than 0, so the actual type value is one less than the number (So the type number in the exampe would be 265).

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox