1195 SimCopter One reporting heavy traffic! This page or section is under significant construction. It may be a large repository of data that's constantly being updated, or there may be a large rework in progress. There is a good chance the contents of this page will have dramatically changed next time you look at it. Please check the history before making any edits to ensure any changes you make won't conflict with anyone else's.
This is a table of functions in SimCity 2000 that have been at least partially reverse engineered and given names. It is probably going to be unpleasant to update, but at least it looks nice and you can sort it.
When adding new functions to the table, please make sure you insert them into the appropriate order by thunk address (the function that just has a jmp ActualFunctionBody
instruction in it). If/when it gets too unwieldy we can split it out into multiple tables.
Uncategorized functions
Thunk address
Main address
Return type
Calling convention
Function name
Arguments
Status
Related functions
Notes
0x401262
0x468D30
int
__stdcall
EQ_LE_Processing
Somewhat understood
Called from SimulationProcessTick day 22?
Handles EQ and LE simulation for the month.
0x40130C
0x45F760
BOOL
__stdcall
SimulationDoDisasterTick
Barely explored
Called from SimulationStartDisaster
0x4013ED
0x42BCA0
int
__cdecl
SimulationCalculateOrdinanceCost
DWORD dwOrdinance
Mostly understood
Returns the effective cost of an ordinance
0x401460
0x44CF60
char
__cdecl
SimulationProvisionMicrosim
__int16 a1, int a2, __int16 iTileID
Barely explored
iTileID is the only argument used; needs some RE work for sure
0x4015E6
0x4731E0
int
__cdecl
SimulationPrepareBudgetDialog
int a1
Mostly understood
arg a1 only referenced on line, seems to be more like "BOOL bUseParentWindow"
0x401672
0x441E50
int
__cdecl
SimulationGrantReward
__int16 iRewardID, BOOL bAddReward
Mostly understood
Adds a city progression reward if (bAddReward), removes it if (!bAddReward).
0x40174E
0x42B4D0
int
__cdecl
SimulationPrepareDisaster
DWORD *a1, __int16 a2, __int16 a3
Somewhat understood
Seems to prepare the starting location for disasters.
0x401820
0x413520
void
__stdcall
SimulationProcessTick
Mostly understood
Called from GameDoIdleUpkeep based on game speed
Advances the calendar date and performs all appropriate daily/monthly/etc. tasks. May need better name?
0x401CA8
0x464550
int
__stdcall
SimulationUpdateWaterConsumption
Barely explored
Called whenever tiles are placed and on SimulationProcessTick day 2
Vanilla SC2K doesn't call this when tiles are placed on cities over 50,000 pop.
0x401E65
0x471BC0
char
__stdcall
SimulationDetermineCityCrisis
Somewhat understood
Called on the last day of the month and from sub_406A50
Changes the city status line if there's a new demand, and also starts disasters.
0x40217B
0x468150
int
__stdcall
RCIDemandUpdates
Somewhat understood
Called from SimulationProcessTick day 22?
Handles all RCI bar updates for "zone balance"
0x4022FC
0x4358B0
int
__cdecl
SimulationGrowthTick
__int16 a1, __int16 a2
Barely explored
Called from SimulationProcessTick on days 4-17
The arguments and algorithms are not yet understood.
0x402527
0x45CF10
int
__stdcall
SimulationStartDisaster
Somewhat understood
Called from GameDoIdleUpkeep
Calls the appropriate disaster creation function and then runs disaster ticks
0x4026B2
0x4734A0
int
__usercall
SimulationGrowSpecificZone
int a1@<ebp>, __int16 iX, __int16 iY, __int16 iTileID, __int16 iZoneType
Barely explored
Called from SimulationGrowthTick
Might be an omit-frame-pointer function?
0x4026F8
0x467860
int
__stdcall
SimulationUpdatePowerConsumption
Barely explored
Called whenever tiles are placed and on SimulationProcessTick day 21
Vanilla SC2K doesn't call this when tiles are placed on cities over 50,000 pop.
0x402A3B
0x405AB0
DWORD
__thiscall
GameDoIdleUpkeep
CWinApp* this
Somewhat understood
Called from CWinApp::OnIdle via the class CWinApp vtable
Could stand to have a better name.
0x402D2E
0x4734A0
__int16
__stdcall
SimulationCalculateBudgetUpdates
Barely explored
00
0x403017
0x4142C0
int
__stdcall
SimulationProposeMilitaryBase
Somewhat understood
Called from SimulationProcessTick day 23 and from "gilmartin" cheat
?
0x46A840
?
?
LandValueMapCalc
Somewhat understood
This should be called from SimulationProcessTick
This is where the land value simulator lives.
Thing functions
Thunk address
Main address
Return type
Calling convention
Function name
Arguments
Status
Related functions
Notes
0x40132A
0x4562E0
void
__cdecl
SimulationThingTickSailboat
__int16 iXTHGIndex
Barely explored
Called from SimulationDoThingTick
Has a rare chance of turning into Nessie
0x40137F
0x454EA0
void
__cdecl
SimulationThingTickTornado
__int16 iXTHGIndex
Barely explored
Called from SimulationDoThingTick
0x401992
0x4548C0
void
__usercall
SimulationThingTickMonster
int a1@<ebx>, __int16 iXTHGIndex
Barely explored
Called from SimulationDoThingTick
The function signature of this one is odd and needs investigation.
0x401B6D
0x455500
void
__cdecl
SimulationThingTickTrain
__int16 iXTHGIndex
Barely explored
Called from SimulationDoThingTick
Used for XTHG_TRAIN_ENGINE and XTHG_UNKNOWN_3
0x401EBA
0x452FA0
int
__cdecl
SimulationSpawnMaxisMan
__int16 iDisasterID
Barely explored
Called from SimulationStartDisaster
Creates the Thing for Maxis Man and determines based on iDisasterID what his behavior should be
0x40236F
0x456760
void
__usercall
SimulationThingTickCargoShip
int a1@<ebx>, __int16 iXTHGIndex
Barely explored
Called from SimulationDoThingTick
IDA really doesn't like this function for some reason
0x402464
0x450890
int
__stdcall
SimulationDoThingTick
Barely explored
Called from GameDoIdleUpkeep via sub_401DBB
Does the individual simulation ticks for Things every 30-45 ms.
0x4024AA
0x455020
void
__cdecl
SimulationThingTickMaxisMan
__int16 iXTHGIndex
Barely explored
Called from SimulationDoThingTick
If you shoot down a helicopter and it lights something on fire, it's your own dang fault
0x4027A2
0x453980
void
__usercall
SimulationThingTickAirplane
int a1@<ebx>, __int16 iXTHGIndex
Barely explored
Called from SimulationDoThingTick
Another one with a bizarre function signature
0x4028D3
0x4546F0
void
__cdecl
SimulationThingTickExplosion
__int16 iXTHGIndex
Barely explored
Called SimulationDoThingTick
0x402ED2
0x4540C0
void
__cdecl
SimulationThingTickHelicopter
__int16 iXTHGIndex
Barely explored
Called from SimulationDoThingTick
Sound and music functions
Thunk address
Main address
Return type
Calling convention
Function name
Arguments
Status
Related functions
Notes
0x401096
0x4251D0
int
__thiscall
SoundPlaySound
int* this, int iSoundID
Mostly understood
Called in so many places
Calls through to sub_4802B0 , which does the buffer loads and calls to sndPlaySoundA
0x401389
0x480890
MCIERROR
__thiscall
MusicSendMCICommands
unsigned __int16* this, char* szMidiPath
Understood
Called by MusicPlayMidi
Sends the actual MCI commands to play/stop a MIDI file
0x401479
0x480770
MCIERROR
__thiscall
MusicPlayMidi
unsigned __int16* this, int iSongID
Understood
Called by MusicPlay
Turns iSongID into szMidiPath
0x4015FF
0x480B20
void
__thiscall
AllocateSoundBuffers
DWORD *this, int a2
Barely explored
Called by CMainFrame:OnCreate
Allocates sound buffers; replaced by sc2kfix
0x401A9B
0x425290
int
__thiscall
MusicPlayNextRefocusSong
unsigned __int16** this
Understood
Called in a few places
Loops through the non-event music; replaced by sc2kfix
0x401CE9
0x425220
int
__thiscall
SoundStopSound
int* this, int iSoundID
Understood
Called in so many places
Does a few checks then blasts out sndPlaySoundA(0, 0)
0x401F9B
0x480140
void
__stdcall
LoadSoundBuffer
int iSoundID, void* lpBuffer
Understood
Called before a few sound calls
This and many other sound functions are replaced by sc2kfix
0x402414
0x425260
int
__thiscall
MusicPlay
unsigned __int16** this, iSongID
Understood
Called by anything that changes the music
Basically just a trampoline to MusicPlayMidi
0x402BE4
0x480AE0
MCIERROR
__thiscall
MusicStop
int this
Understood
Called by anything that stops the music
Sends an MCI_CLOSE command to the sequencer device
Randomness functions
Thunk address
Main address
Return type
Calling convention
Function name
Arguments
Status
Related functions
Notes
0x401019
0x47FC30
__int16
__stdcall
RandomWordLFSRMod32
Understood
Returns a random word from the LFSR modulo 32
0x40116D
0x47FAA0
__int16
__cdecl
RandomWordLCGMod
__int16 iModulus
Understood
Returns a random word from the LCG modulo iModulus
0x401415
0x47FC70
__int16
__stdcall
RandomWordLFSRMod64
Understood
Returns a random word from the LFSR modulo 64
0x4017AD
0x47FAE0
int
__stdcall
GetRandomLFSRState
Understood
Returns the state of the LFSR
0x401CAD
0x47FAF0
__int16
__cdecl
RandomWordLFSRMod
__int16 iModulus
Understood
Returns a random word from the LFSR modulo iModulus
0x401D9D
0x47FCF0
unsigned __int16
__stdcall
RandomWordLFSR
Understood
Returns a random word from the LFSR
0x401F19
0x47FA80
int
__cdecl
SeedRandomLCG
int iSeed
Understood
Sets the LCG state
0x402261
0x47FB70
__int16
__stdcall
RandomWordLFSRMod4
Understood
Returns a random word from the LFSR modulo 4
0x4025E5
0x47FBF0
__int16
__stdcall
RandomWordLFSRMod16
Understood
Returns a random word from the LFSR modulo 16
0x402626
0x47FAD0
int
__cdecl
SeedRandomLFSR
int iSeed
Understood
Sets the LFSR state
0x40288D
0x47FBB0
__int16
__stdcall
RandomWordLFSRMod8
Understood
Returns a random word from the LFSR modulo 8
0x402946
0x47FB30
__int16
__stdcall
RandomWordLFSRMod2
Understood
Called by SimulationThingTickTrain and SimulationDoDisasterTick
Returns a random word from the LFSR modulo 2
0x402B3F
0x47FCB0
__int16
__stdcall
RandomWordLFSRMod128
Understood
Returns a random word from the LFSR modulo 128
Frequently-reused MFC class functions
Thunk address
Main address
Return type
Calling convention
Function name
Arguments
Status
Related functions
Notes
0x40219E
0x4815E0
INT_PTR
__thiscall
CGameDialog::DoModal
LPCDLGTEMPLATEA* this
Understood
Called in so many places
Seems to pause the simulation, call CDialog::DoModal(this), then restore the simulation.
0x40281A
0x481300
struct CRuntimeClass*
__stdcall
CGameDialog::GetRuntimeClass
Understood