Difference between revisions of "TS3PR/Sims3Common"

From SimsWiki
Jump to: navigation, search
(About Sims3Common)
(About Sims3Common)
 
Line 31: Line 31:
 
<pre>
 
<pre>
 
[DllImport("Sims3Common.dll")]
 
[DllImport("Sims3Common.dll")]
 
 
public static extern void Animation_CreateTransformController();
 
public static extern void Animation_CreateTransformController();
 
</pre>
 
</pre>
Line 39: Line 38:
 
<pre>
 
<pre>
 
[DllImport("Sims3Common.dll")]
 
[DllImport("Sims3Common.dll")]
 
 
public static extern void Animation_CreateTransformController(ulong objId);
 
public static extern void Animation_CreateTransformController(ulong objId);
 
</pre>
 
</pre>

Latest revision as of 04:57, 26 January 2021

This Page is currently simply a stub, if you have information to contribute on any of these classes, please create the page and add info about it to this page.

[edit] About Sims3Common

Research on the Sims3Common library

So far, it's been discovered that sims3common is inlined inside the TS3W.exe and can't, therefore, be 'cracked open'. However, It is been discovered that CAW (Create-a-World) does contain an 'exposed' Sims3Common.dll, and will be able to be found inside the program's files where you can also find CAW.exe. This does have all the functions that we find in the ScriptCore.dll; a library that directly communicates with the sims3Common.dll. So far, that's all the known discoveries done on it so far.


What is the Sims3Common library exactly?

The Sims3Common.dll is a C++ dll, as the sims 3 has been primarily been developed in C++. It's only the functionality of the game (Think: animations, Gameplay, CameraControlls, UI, etc) that is written in C#. For animations as an example, the ScriptCore.dll Has a direct call function to the sims3Common library to say to the engine to 'stop' an animation, or even 'start' one. Or to create the bones of the sims' rig and initiates them.

So the best way to think of it, is that the C# script is always the first to call and make a function ready. After that, the C# script communicates with the C++ dll to fire the function that is being called. (Unless the sims3Common function is a callback of some sorts)

Is the Sims3Common library only being used just to communicate with the C# scripts?

Now, it has also been found that the Sims3Common library doesn't always expose functions to be used to C#. That's mostly since some functions are simply just more important for the engine to know about and just not for the C# scripts. Or at least the nature of the C#.

A big example are shaders. The Sims3Common library has a 'LoadShaderSet' function that can't be found inside the sets of functions being called in the ScriptCore.dll. Instead, it's probably only being called inside the engine itself from the Sims3Common library. Which makes sense, since shaders can only be initiated on the startup of a 3D program, usually. Especially since shaders mostly get cached inside the CPU.

How do we crack open the Sims3Common.dll?

First, we do need to clear the illusion that the game will react on the Sims3Common.dll that is found in the CAW application. Unfortunately, this only seems to show changes inside CAW, not the game itself. But if for research purposes you want to see if you can call a hidden function inside your C# script, you can do the following:

  • 1. Download either Snowman or one of these programs(Which are more about reverse engineering most of it yourself, so be aware!)
  • 2. In the case of Snowman, Click File > Open and get it to direct to Create-a-World's Sims3Common.dll
  • 3. This will take a while to decompile as the library is quite big. Once it's decompiled, you'll find most of the more readable functions at the bottom. Everything above is mostly helper functions for the functions with proper ASCII names.
  • 4. If you find anything you'd want to use, in your C# script, import it like so:
[DllImport("Sims3Common.dll")]
public static extern void Animation_CreateTransformController();

If the function expects you to return a parameter, do this instead:

[DllImport("Sims3Common.dll")]
public static extern void Animation_CreateTransformController(ulong objId);
Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox