iff2html working

This commit is contained in:
Jip 2024-05-06 19:40:19 +02:00
parent deaf3327e0
commit 4cd716e94d
89 changed files with 7711 additions and 3 deletions

View file

@ -0,0 +1,19 @@
DLLs in The Sims Online (and also SimCity 4 and The Sims 2) use a special
interface, based on Microsoft COM.
These DLLs each export exactly one function:
void * GZDllGetGZCOMDirector(void)
This function creates and sets up a C++ object, with variables and member
functions, and returns a pointer to that object. This is your standard
C++ v-table.
TSOSimulatorClientD.dll is the most important DLL in the game. It implements
the SimAntics virtual machine which executes all the objects in the game.
In our situation, we need to figure out everything it does, because we lack
any information regarding the SimAntics instruction set architecture.
A text dump of this DLL is not nearly enough to find this. The files in the
objectdata/globals folder are not nearly enough. The page on
simtech.sourceforge.net documenting all they know about SimAntics is not
nearly enough. We need to run this DLL in a disassembler and figure out the
meaning of every opcode used in every behavior script of the game.

View file

@ -0,0 +1,52 @@
/*
TSOEdithEditor - TSOEdithEditorD.dll injector
TSOEdithEditor.cpp - Copyright (c) 2012 Niotso Project <http://niotso.org/>
Author(s): Fatbag <X-Fi6@phppoll.org>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <windows.h>
#include "TSOEdithEditor.hpp"
int main(){
HMODULE dllmodule = LoadLibrary("TSOEdithEditorD.dll");
if(dllmodule == NULL){
printf("TSOEdithEditor: Error: Failed to load DLL \"TSOEdithEditorD.dll\".");
return -1;
}
cTSOEdithEditorDCOMDirector * (__stdcall *GZDllGetGZCOMDirector)(void) =
(cTSOEdithEditorDCOMDirector * (__stdcall *)(void)) GetProcAddress(dllmodule, "GZDllGetGZCOMDirector");
if(GZDllGetGZCOMDirector == NULL){
printf("TSOEdithEditor: Error: Failed to find GZDllGetGZCOMDirector() in TSOEdithEditorD.dll.");
return -1;
}
printf("TSOEdithEditor: Calling GZDllGetGZCOMDirector() ...\n");
cTSOEdithEditorDCOMDirector * Edith = GZDllGetGZCOMDirector();
printf("TSOEdithEditor: Finished calling GZDllGetGZCOMDirector().\nThe value returned was: %p.\n", (void *) Edith);
while(true){
char buffer[8];
printf("\nCall a function (0, 1, 2, ...) or q to exit. ");
//fgets(buffer, 8, stdin);
//if(buffer[0] == 'q') break;
//Edith->Object1.vtable5[atoi(buffer)]();
}
printf("TSOEdithEditor: Exiting.\n");
FreeLibrary(dllmodule);
return 0;
}

View file

@ -0,0 +1,144 @@
/*
TSOEdithEditor - TSOEdithEditorD.dll injector
TSOEdithEditor.hpp - Copyright (c) 2012 Fatbag <X-Fi6@phppoll.org>
Author(s): Fatbag <X-Fi6@phppoll.org>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <basetyps.h>
#pragma pack(0)
DECLARE_INTERFACE(cRZString)
{
void * vtable1_cRZString;
char * mpBegin; //Pointer to beginning of string
char * mpEnd; //Pointer to null terminator
char * mpCapacity; //mpEnd + 1
DWORD mAllocator; //0
DWORD Zero1; //0
};
struct stringstruct
{
DWORD StringID;
DWORD Unknown;
char * PointerToBuffer; //Buffer
DWORD SizeOfBuffer; //256
char Buffer[256];
};
DECLARE_INTERFACE(cEdithEditorCOMDirector)
{
void * vtable_1_cEdithEditorCOMDirector;
void * vtable_2_cEdithEditorCOMDirector;
DWORD Zero1;
DWORD Zero2;
cRZString string;
DWORD Zero5;
DWORD Zero6;
DWORD Zero7;
DWORD Zero8;
DWORD Zero9;
DWORD Zero10;
DWORD Zero11;
void * ptr;
DWORD Value1; //2
DWORD Value2; //1
float Value3; //1.0f
DWORD Value4; //0x40000000
DWORD Value5; //2
DWORD Value6; //0
DWORD Value7; //1
DWORD Value8; //0
stringstruct string0; //StringID:0, Unknown:40, value:"index"
stringstruct string1; //StringID:1, Unknown:40, value:"value"
stringstruct string2; //StringID:2, Unknown:150, value:"Name"
stringstruct string3; //StringID:3, Unknown:200, value:"Description"
DWORD Value9; //0
DWORD Value10; //0
stringstruct string4; //StringID:0, Unknown:90, value:"Calling Tree"
stringstruct string5; //StringID:1, Unknown:86, value:"Type"
stringstruct string6; //StringID:2, Unknown:83, value:"Title"
stringstruct string7; //StringID:3, Unknown:65, value:"Yes"
stringstruct string8; //StringID:4, Unknown:65, value:"No"
stringstruct string9; //StringID:5, Unknown:65, value:"Cancel"
stringstruct string10; //StringID:6, Unknown:300, value:"Message"
stringstruct string11; //StringID:7, Unknown:45, value:"Tree ID"
stringstruct string12; //StringID:8, Unknown:50, value:"Node #"
};
DECLARE_INTERFACE(cTSOEdithEditorDCOMDirector)
{
void * vtable1_cTSOEdithEditorDCOMDirector;
void * vtable2_cTSOEdithEditorDCOMDirector;
DWORD Zero1;
DWORD Zero2;
cRZString String1;
DWORD Zero5;
DWORD Zero6;
cEdithEditorCOMDirector ** memptr_1;
void ** memptr_2;
void ** memptr_3; //Same as memptr_2
DWORD Zero7;
DWORD Zero8;
void * dllptr_4_100B5834; //CMemoryException TD
DWORD Value1; //1
DWORD Value2; //0
float Value3; //1.0f
DWORD Value4; //0x40000000
DWORD Value5; //0
DWORD Value6; //0
DWORD Value7; //1
cRZString String2;
cRZString String3;
cRZString String4;
cRZString String5;
cRZString String6;
cRZString String7;
cRZString String8;
cRZString String9;
DWORD Zero9;
DWORD Zero10;
DWORD Zero11;
DWORD Zero12;
DWORD Zero13;
DWORD Zero14;
DWORD Zero15;
cRZString String10;
cRZString String11;
cRZString String12;
cRZString String13;
cRZString String14;
DWORD Zero16;
DWORD Zero17;
DWORD Zero18;
DWORD Zero19;
DWORD Zero20;
cRZString String15;
cRZString String16;
cRZString String17;
cRZString String18;
cRZString String19;
cRZString String20;
cRZString String21;
cRZString String22;
cRZString String23;
cRZString String24;
cRZString String25;
cRZString String26;
cRZString String27;
cRZString String28;
cRZString String29;
cRZString String30;
};

View file

@ -0,0 +1 @@
gcc -Wall -Wextra -Wabi -pedantic -fno-exceptions -m32 -o TSOEdithEditor.exe TSOEdithEditor.cpp -mconsole

View file

@ -0,0 +1,46 @@
/*
TSOSimulatorClient - TSOSimulatorClientD.dll injector
TSOSimulatorClient.cpp - Copyright (c) 2012 Niotso Project <http://niotso.org/>
Author(s): Fatbag <X-Fi6@phppoll.org>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <windows.h>
#include "TSOSimulatorClient.hpp"
int main(){
HMODULE dllmodule = LoadLibrary("TSOSimulatorClientD.dll");
if(dllmodule == NULL){
printf("TSOSimulatorClient: Error: Failed to load DLL \"TSOSimulatorClientD.dll\".");
return -1;
}
cTSOSimulatorClientDCOMDirector * (__stdcall *GZDllGetGZCOMDirector)(void) =
(cTSOSimulatorClientDCOMDirector * (__stdcall *)(void)) GetProcAddress(dllmodule, "GZDllGetGZCOMDirector");
if(GZDllGetGZCOMDirector == NULL){
printf("TSOSimulatorClient: Error: Failed to find GZDllGetGZCOMDirector() in TSOSimulatorClientD.dll.");
return -1;
}
printf("TSOSimulatorClient: Calling GZDllGetGZCOMDirector() ...\n");
cTSOSimulatorClientDCOMDirector * Simulator = GZDllGetGZCOMDirector();
printf("TSOSimulatorClient: Finished calling GZDllGetGZCOMDirector().\nThe value returned was: %p.\n", (void *) Simulator);
printf("%s\n%s\n%s\n", Simulator->String1.Strings1[0], Simulator->String1.Strings2[0], Simulator->String1.Strings3[0]);
printf("TSOSimulatorClient: Exiting.\n");
FreeLibrary(dllmodule);
return 0;
}

View file

@ -0,0 +1,70 @@
/*
TSOSimulatorClient - TSOSimulatorClientD.dll injector
TSOSimulatorClient.hpp - Copyright (c) 2012 Fatbag <X-Fi6@phppoll.org>
Author(s): Fatbag <X-Fi6@phppoll.org>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <basetyps.h>
#pragma pack(0)
DECLARE_INTERFACE(cRZString)
{
//Base classes: cRZString, std::char_traits, ?$_String_base@DV?$__default_alloc_template@$00$0A@@std@@@std, cIGZString, cIGZUnknown
DWORD Zero1;
DWORD Zero2;
void * vtable5;
char ** Strings1;
char ** Strings2;
char ** Strings3;
DWORD Zero3;
DWORD Zero4;
DWORD Zero5;
void ** Pointer1; //12 bytes
void ** Pointer2; //4 bytes
void ** Pointer3;
DWORD Flags;
DWORD * Pointer4; //4 bytes
void * Pointer5;
void * Pointer6;
DWORD Unknown11;
DWORD Unknown12;
};
DECLARE_INTERFACE(cTSOSimulatorClientDCOMDirector)
{
//Base classes: cTSOSimulatorClientDCOMDirector, cRZCOMDllDirector, cIGZCOMDirector, cIGZUnknown, cIGZFrameWorkHooks, cIGZUnknown
void * vtable2;
void * vtable1;
cRZString String1;
void * vtable4;
void * vtable3;
cRZString String2;
cRZString String3;
DWORD Zero1;
DWORD Zero2;
DWORD Zero3;
DWORD Zero4;
DWORD Zero5;
DWORD Zero6;
DWORD Zero7;
DWORD Zero8;
DWORD Zero9;
DWORD Zero10;
DWORD Unknown1;
DWORD Pointer1;
DWORD Pointer2;
DWORD Zero11;
};

View file

@ -0,0 +1 @@
gcc -Wall -Wextra -Wabi -pedantic -fno-exceptions -m32 -o TSOSimulatorClient.exe TSOSimulatorClient.cpp -mconsole

View file

@ -0,0 +1,106 @@
CPU Dump
Address Hex dump
10102AF8 C4 61 0D 10|94 61 0D 10|00 00 00 00|00 00 00 00| 0
10102B08 08 7A 0D 10|F8 30 3D 00|F8 30 3D 00|00 31 3D 00| 4
10102B18 00 00 00 00|00 00 00 00|00 00 00 00|70 3B 3D 00| 8
10102B28 7C 3B 3D 00|80 3B 3D 00|10 10 10 00|E0 32 3D 00| 12
10102B38 E4 35 3D 00|E4 35 3D 00|00 00 00 00|01 00 00 00| 16
10102B48 A4 62 0D 10|78 62 0D 10|00 00 00 00|00 00 00 00| 20
10102B58 08 7A 0D 10|10 31 3D 00|10 31 3D 00|18 31 3D 00| 24
10102B68 00 00 00 00|00 00 00 00|00 00 00 00|00 00 00 00| 28
10102B78 00 00 00 00|00 00 00 00|10 10 10 00|58 3C 3D 00| 32
10102B88 5C 3F 3D 00|5C 3F 3D 00|0D 00 00 00|01 00 00 00| 36
10102B98 00 00 00 00|00 00 00 00|08 7A 0D 10|08 09 3D 00| 40
10102BA8 1D 09 3D 00|1E 09 3D 00|00 00 00 00|00 00 00 00| 44
10102BB8 00 00 00 00|18 31 3D 00|80 3B 3D 00|88 0A 3D 00| 48
10102BC8 A8 2D 3D 00|00 00 00 00|00 00 00 00|00 00 00 00| 52
10102BD8 00 00 00 00|00 00 00 00|00 00 00 00|00 00 00 00| 56
10102BE8 00 00 00 00|00 00 00 00|00 00 00 00|00 00 00 00| 60
10102BF8 00 00 00 00|00 00 00 00|00 00 00 00|00 00 00 00| 64
10102C08 10 0C 00 00|B0 3B 3D 00|40 3C 3D 00|00 00 00 00| 68
Offset: Meaning
0: Pointer to v-table 2 - 100D61C4
1: Pointer to v-table 1 - 100D6194
2: 0
3: 0
4: Pointer to v-table 5 - 100D7A08
5: Pointer
6: Pointer
7: Pointer
8: 0
9: 0
10: 0
11: Pointer
12: Pointer
13: Pointer
14: Flags? - 0x00101010
15: Pointer
16: Pointer
17: Pointer
18: 0
19: 1
20: Pointer to v-table 4 - 100D62A4
21: Pointer to v-table 3 - 100D6278
22: 0
23: 0
24: Pointer to v-table 5 - 100D7A08
25: Pointer
26: Pointer
27: Pointer
28: 0
29: 0
30: 0
31: 0
32: 0
33: 0
34: Flags? - 0x00101010
35: Pointer
36: Pointer
37: Pointer
38: 13
39: 1
40: 0
41: 0
42: Pointer to v-table 5 - 100D7A08
43: Pointer
44: Pointer
45: Pointer
46: 0
47: 0
48: 0
49: Pointer
50: Pointer
51: Pointer
52: Pointer
53: 0
54: 0
55: 0
56: 0
57: 0
58: 0
59: 0
60: 0
61: 0
62: 0
63: 0
64: 0
65: 0
66: 0
67: 0
68: 3088
69: Pointer
70: Pointer
71: 0
5 v-tables:
100D6194 (12 entries)
100D61C4 (17 entries)
100D6278 (11 entries)
100D62A4 (344 entries)
100D7A08 (695 entries)