mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-04 21:50:35 -04:00
iff2html is working and can properly parse STR# chunks.
I also added my TSOSimulatorClient work to the trunk.
This commit is contained in:
parent
a4a7b82bb7
commit
64fddcf78e
16 changed files with 963 additions and 80 deletions
19
Tools/TSOSimulatorClient/Readme.txt
Normal file
19
Tools/TSOSimulatorClient/Readme.txt
Normal 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.
|
40
Tools/TSOSimulatorClient/TSOSimulatorClient.cpp
Normal file
40
Tools/TSOSimulatorClient/TSOSimulatorClient.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
TSOSimulatorClient.cpp - Copyright (c) 2012 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>
|
||||
|
||||
int main(){
|
||||
HMODULE dllmodule = LoadLibrary("TSOSimulatorClientD.dll");
|
||||
if(dllmodule == NULL){
|
||||
printf("TSOSimulatorClient: Error: Failed to load DLL \"TSOSimulatorClientD.dll\".");
|
||||
return -1;
|
||||
}
|
||||
|
||||
void * (__stdcall *GZDllGetGZCOMDirector)(void) = (void * (__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");
|
||||
void * value = GZDllGetGZCOMDirector();
|
||||
printf("TSOSimulatorClient: Finished calling GZDllGetGZCOMDirector().\nThe value returned was: %p.\n", value);
|
||||
|
||||
printf("TSOSimulatorClient: Exiting.\n");
|
||||
FreeLibrary(dllmodule);
|
||||
return 0;
|
||||
}
|
116
Tools/TSOSimulatorClient/TSOSimulatorClient.hpp
Normal file
116
Tools/TSOSimulatorClient/TSOSimulatorClient.hpp
Normal file
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
TSOSimulatorClient.hpp - Copyright (c) 2012 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>
|
||||
|
||||
DECLARE_INTERFACE(IMMDeviceCollection);
|
||||
DECLARE_INTERFACE(IMMNotificationClient);
|
||||
DECLARE_INTERFACE(IPropertyStore);
|
||||
|
||||
/*
|
||||
** IMMDevice
|
||||
*/
|
||||
|
||||
DECLARE_INTERFACE_(IMMDevice, IUnknown)
|
||||
{
|
||||
STDMETHOD(Activate) (REFIID iid, DWORD dwClsCtx, PROPVARIANT *pActivationParams, void **ppInterface);
|
||||
STDMETHOD(OpenPropertyStore) (DWORD stgmAccess, IPropertyStore **ppProperties);
|
||||
STDMETHOD(GetId) (LPWSTR *ppstrId);
|
||||
STDMETHOD(GetState) (DWORD *pdwState);
|
||||
};
|
||||
|
||||
/*
|
||||
** IMMDeviceEnumerator
|
||||
*/
|
||||
|
||||
enum EDataFlow
|
||||
{
|
||||
eRender,
|
||||
eCapture,
|
||||
eAll
|
||||
};
|
||||
|
||||
enum ERole
|
||||
{
|
||||
eConsole,
|
||||
eMultimedia,
|
||||
eCommunications
|
||||
};
|
||||
|
||||
DECLARE_INTERFACE_(IMMDeviceEnumerator, IUnknown)
|
||||
{
|
||||
STDMETHOD(EnumAudioEndpoints) (EDataFlow dataFlow, DWORD dwStateMask, IMMDeviceCollection **ppDevices);
|
||||
STDMETHOD(GetDefaultAudioEndpoint) (EDataFlow dataFlow, ERole role, IMMDevice **ppEndpoint);
|
||||
STDMETHOD(GetDevice) (LPCWSTR pwstrId, IMMDevice **ppDevice);
|
||||
STDMETHOD(RegisterEndpointNotificationCallback) (IMMNotificationClient *pClient);
|
||||
STDMETHOD(UnregisterEndpointNotificationCallback) (IMMNotificationClient *pClient);
|
||||
};
|
||||
|
||||
/*
|
||||
** IAudioClient
|
||||
*/
|
||||
|
||||
enum AUDCLNT_SHAREMODE
|
||||
{
|
||||
AUDCLNT_SHAREMODE_SHARED,
|
||||
AUDCLNT_SHAREMODE_EXCLUSIVE
|
||||
};
|
||||
|
||||
enum AUDCLNT_STREAMFLAGS
|
||||
{
|
||||
AUDCLNT_STREAMFLAGS_CROSSPROCESS = 0x00010000,
|
||||
AUDCLNT_STREAMFLAGS_LOOPBACK = 0x00020000,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK = 0x00040000,
|
||||
AUDCLNT_STREAMFLAGS_NOPERSIST = 0x00080000,
|
||||
AUDCLNT_STREAMFLAGS_RATEADJUST = 0x00100000,
|
||||
AUDCLNT_SESSIONFLAGS_EXPIREWHENUNOWNED = 0x10000000,
|
||||
AUDCLNT_SESSIONFLAGS_DISPLAY_HIDE = 0x20000000,
|
||||
AUDCLNT_SESSIONFLAGS_DISPLAY_HIDEWHENEXPIRED = 0x40000000
|
||||
};
|
||||
|
||||
DECLARE_INTERFACE_(IAudioClient, IUnknown)
|
||||
{
|
||||
STDMETHOD(Initialize) (AUDCLNT_SHAREMODE ShareMode, DWORD StreamFlags, LONGLONG hnsBufferDuration,
|
||||
LONGLONG hnsPeriodicity, const WAVEFORMATEX *pFormat, LPCGUID AudioSessionGuid);
|
||||
STDMETHOD(GetBufferSize) (UINT32 *pNumBufferFrames);
|
||||
STDMETHOD(GetStreamLatency) (LONGLONG *phnsLatency);
|
||||
STDMETHOD(GetCurrentPadding) (UINT32 *pNumPaddingFrames);
|
||||
STDMETHOD(IsFormatSupported) (AUDCLNT_SHAREMODE ShareMode, const WAVEFORMATEX *pFormat, WAVEFORMATEX **ppClosestMatch);
|
||||
STDMETHOD(GetMixFormat) (WAVEFORMATEX **ppDeviceFormat);
|
||||
STDMETHOD(GetDevicePeriod) (LONGLONG *phnsDefaultDevicePeriod, LONGLONG *phnsMinimumDevicePeriod);
|
||||
STDMETHOD(Start) (void);
|
||||
STDMETHOD(Stop) (void);
|
||||
STDMETHOD(Reset) (void);
|
||||
STDMETHOD(SetEventHandle) (HANDLE eventHandle);
|
||||
STDMETHOD(GetService) (REFIID riid, void **ppv);
|
||||
};
|
||||
|
||||
/*
|
||||
** IAudioRenderClient
|
||||
*/
|
||||
|
||||
enum AUDCLNT_BUFFERFLAGS
|
||||
{
|
||||
AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY = 0x1,
|
||||
AUDCLNT_BUFFERFLAGS_SILENT = 0x2,
|
||||
AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR = 0x4
|
||||
};
|
||||
|
||||
DECLARE_INTERFACE_(IAudioRenderClient, IUnknown)
|
||||
{
|
||||
STDMETHOD(GetBuffer) (UINT32 NumFramesRequested, BYTE **ppData);
|
||||
STDMETHOD(ReleaseBuffer) (UINT32 NumFramesWritten, DWORD dwFlags);
|
||||
};
|
1
Tools/TSOSimulatorClient/compile.bat
Normal file
1
Tools/TSOSimulatorClient/compile.bat
Normal file
|
@ -0,0 +1 @@
|
|||
gcc -Wall -Wextra -Wabi -pedantic -m32 -o TSOSimulatorClient.exe TSOSimulatorClient.cpp -mconsole
|
106
Tools/TSOSimulatorClient/memory map.txt
Normal file
106
Tools/TSOSimulatorClient/memory map.txt
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue