Function list

From sc2k-reverse
Revision as of 01:47, 6 March 2025 by Araxestroy (talk | contribs)
Jump to navigationJump to search
1195
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
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.
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.
0x402464 0x450890 int __stdcall SimulationDoThingTick Barely explored Called from GameDoIdleUpkeep via sub_401DBB Does the individual simulation ticks for Things every 30-45 ms.
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
0x403017 0x4142C0 int __stdcall SimulationProposeMilitaryBase Somewhat understood Called from SimulationProcessTick day 23 and from "gilmartin" cheat
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