Difference between revisions of "Sims 3:0x073FAA07"

From SimsWiki
Jump to: navigation, search
(Encryption Method)
m (Note on d3dx9_31.dll needed pre-EP2/patch)
 
(23 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[Sims 3:Main Page]] -> [[Sims 3:PackedFileTypes]]
+
{{TS3AdvancedModdingHeader}}
<hr/>
+
{{TS3Resource
 +
|name=Signed Assemblies - MSIL
 +
|typeid= 0x073FAA07
 +
|expansion=The Sims 3
 +
}}
 +
<br clear="all">
 +
 
 +
==Overview==
 
Signed assemblies, encrypted .NET assemblies. They function as the game scripts.
 
Signed assemblies, encrypted .NET assemblies. They function as the game scripts.
  
Line 7: Line 14:
 
Currently no way is known to get the game to accept piecemeal overrides, so global hacks for a particular assembly as of 6 / 6 / 2009 are having to replace the entire set - meaning that you can only have global hacks for a particular assembly from one creator at a time.
 
Currently no way is known to get the game to accept piecemeal overrides, so global hacks for a particular assembly as of 6 / 6 / 2009 are having to replace the entire set - meaning that you can only have global hacks for a particular assembly from one creator at a time.
  
It is probably possible to create new scripts for new custom objects, however.  Technical details coming later.
+
It is possible to create new scripts for new custom objects, however.
  
== Where used ==
+
For some information about how to import/export scripts in s3pi DemoFE, in a way that you can look at them in Reflector, see [[http://www.simlogical.com/Sims3ToolsForum/index.php?topic=107.0| this thread]].
 +
 
 +
There some more in depth technical guidance on how to get your code to be run by the game in [[http://www.simlogical.com/Sims3ToolsForum/index.php?topic=160.msg1240#msg1240| this thread]].
 +
=== Where used ===
 
* gameplay.package
 
* gameplay.package
 
* scripts.package
 
* scripts.package
 
* simcore.package
 
* simcore.package
  
In addition, scripts can be placed in custom content packages and the game will load them when they are referenced.  Use of "bare" assemblies via ddfmap.txt is still under investigation.
+
In addition, scripts can be placed in custom content packages and the game will load them when they are referenced.
  
== Data format ==
+
== Format ==
(Provided by [[User:Rick|Rick]].)
+
Provided by [[User:Rick|Rick]]. Modified for EP2 by [[User:granthes|Grant]].
  BOOL                    is_encrypted ;; must be 1
+
  BYTE Version // Pre-EP2: 1; EP2+: 2
  DWORD                   checksum_typeid ;; must be 0x2BC4F79F
+
--if Version >= 2
  BYTE[64]                 checksum_data
+
DWORD strLen // Number of UNICODE (2-byte) characters
  WORD                     block_count
+
UNICODE[strLen] gameversion // from Game/bin/code_version.txt ([[User:AD85|AD85]])
  QWORD[block_count]       ''decryption table''
+
  DWORD checksum_typeid // 0x2BC4F79F
  BYTE[block_count*512]   ''encrypted data''
+
  BYTE[64] checksum_data
 +
  WORD block_count
 +
  QWORD[block_count] // ''decryption table''
 +
  BYTE[block_count*512] // ''encrypted data''
 
(I think the checksum and encryption method are MD5Cng -- PLJ.)
 
(I think the checksum and encryption method are MD5Cng -- PLJ.)
  
Line 45: Line 58:
 
=== Encryption Method ===
 
=== Encryption Method ===
  
To encrypt, reverse the process for [[#Decryption Method|decryption]].  We cannot currently create our own signatures of data, as this requires EA's private key (the signature is created with a private / public key pair). Therefore you must use the [[#Fake Sign Method |fake sign method]].
+
To encrypt, reverse the process for [[#Decryption Method|decryption]].  We cannot currently create our own signatures of data, as this requires EA's private key (the signature is created with a private / public key pair).
  
=== Fake Sign Method ===
+
Prior to June 2010, there was no alternative supported by the game.  To circumvent the process, you required a special hack that disables the validation of signed assemblies, d3dx9_31.dll.
 
+
Fake signed assemblies require a special hack that disables the validation of signed assemblies, d3dx9_31.dll.
+
  
 
* Download [http://mod.gib.me/sims3/files/d3dx9_31.dll d3dx9_31.dll].
 
* Download [http://mod.gib.me/sims3/files/d3dx9_31.dll d3dx9_31.dll].
 
* Place in <code>Game\Bin</code>.
 
* Place in <code>Game\Bin</code>.
  
Creating a fake signed assembly is simple. To fake sign, reverse the process for [[#Decryption|decryption]].
+
As of EP2 and the associated game patch (June 2010), this is no longer required (...---someone complete details, please---...).
  
There is no need to create a valid checksum and the ''decryption table'' table can be left full of zeros (which saves identifying empty 512 byte chunks). I would suggest including "This is a fake signed assembly." in the checksum data to make it obvious to others what it is.
+
There is no need to create a valid checksum and the ''decryption table'' table can be left full of zeros (which saves identifying empty 512 byte chunks).
  
== Data Content ==
+
==== Note on d3dx9_31.dll needed pre-June 2010 ====
 +
This DLL is a wrapper for the real DLL that resides in system32, it was chosen because The Sims 3 loads this DLL pretty early on.  What the wrapper does is effectively disable a specific Windows API function used in the validation of signed assembly data.
 +
 
 +
== Data content ==
 
The decrypted content is a [http://wikipedia.org/wiki/Common_Language_Runtime Common Language Runtime] [http://wikipedia.org/wiki/.NET_assembly assembly].
 
The decrypted content is a [http://wikipedia.org/wiki/Common_Language_Runtime Common Language Runtime] [http://wikipedia.org/wiki/.NET_assembly assembly].
  
 
== How the game uses Assemblies ==
 
== How the game uses Assemblies ==
 
TBC
 
TBC
<hr/>
+
 
[[Sims 3:Main Page]] -> [[Sims 3:PackedFileTypes]]
+
{{TS3AdvancedModdingHeader}}

Latest revision as of 19:51, 4 June 2010

Modding Reference by Category

Sims 3 :DBPF | File Types | RCOL(Scene) | Catalog Resource | String Table | Key Table | TS3 Programmer's Reference 

Signed Assemblies - MSIL
TypeID:0x073FAA07
Game Version:The Sims 3



Contents

[edit] Overview

Signed assemblies, encrypted .NET assemblies. They function as the game scripts.

These are the scripts that run when a Sim interacts with an object, or another Sim, or just performs its own inner metabolic processes.

Currently no way is known to get the game to accept piecemeal overrides, so global hacks for a particular assembly as of 6 / 6 / 2009 are having to replace the entire set - meaning that you can only have global hacks for a particular assembly from one creator at a time.

It is possible to create new scripts for new custom objects, however.

For some information about how to import/export scripts in s3pi DemoFE, in a way that you can look at them in Reflector, see [this thread].

There some more in depth technical guidance on how to get your code to be run by the game in [this thread].

[edit] Where used

  • gameplay.package
  • scripts.package
  • simcore.package

In addition, scripts can be placed in custom content packages and the game will load them when they are referenced.

[edit] Format

Provided by Rick. Modified for EP2 by Grant.

BYTE Version		// Pre-EP2: 1; EP2+: 2
--if Version >= 2
	DWORD strLen	// Number of UNICODE (2-byte) characters
	UNICODE[strLen] gameversion	// from Game/bin/code_version.txt (AD85)
DWORD checksum_typeid	// 0x2BC4F79F
BYTE[64] checksum_data
WORD block_count
QWORD[block_count]	// decryption table
BYTE[block_count*512]	// encrypted data

(I think the checksum and encryption method are MD5Cng -- PLJ.)

[edit] Decryption method

Initialise the decryption seed by scanning the decryption table:

foreach(QWORD q in decryption table) decryption seed += q

Truncate (mask off) the decryption seed to the length of decryption table:

decryption seed = decryption seed & (decryption table Length - 1)

Now process each QWORD in the decryption table. Where an entry has bit 0 set, write 512 zero bytes to the output, otherwise, read 512 bytes into a buffer from the encrypted data and process as follows:

foreach(byte b in buffer)
{
  byte value = b;
  b ^= decryption table[decryption seed];
  decryption seed = (decryption seed + value) % (decryption table Length);
}

Then write out the decrypted buffer.

[edit] Encryption Method

To encrypt, reverse the process for decryption. We cannot currently create our own signatures of data, as this requires EA's private key (the signature is created with a private / public key pair).

Prior to June 2010, there was no alternative supported by the game. To circumvent the process, you required a special hack that disables the validation of signed assemblies, d3dx9_31.dll.

As of EP2 and the associated game patch (June 2010), this is no longer required (...---someone complete details, please---...).

There is no need to create a valid checksum and the decryption table table can be left full of zeros (which saves identifying empty 512 byte chunks).

[edit] Note on d3dx9_31.dll needed pre-June 2010

This DLL is a wrapper for the real DLL that resides in system32, it was chosen because The Sims 3 loads this DLL pretty early on. What the wrapper does is effectively disable a specific Windows API function used in the validation of signed assembly data.

[edit] Data content

The decrypted content is a Common Language Runtime assembly.

[edit] How the game uses Assemblies

TBC

Modding Reference by Category

Sims 3 :DBPF | File Types | RCOL(Scene) | Catalog Resource | String Table | Key Table | TS3 Programmer's Reference 

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox