Function list: Difference between revisions
From sc2k-reverse
Jump to navigationJump to search
Araxestroy (talk | contribs) No edit summary |
Araxestroy (talk | contribs) No edit summary |
||
Line 23: | Line 23: | ||
|- | |- | ||
| 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. | | 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. | ||
|- | |- | ||
| 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? | | 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? | ||
Line 36: | Line 34: | ||
| 0x403017 || 0x4142C0 || int || __stdcall || '''SimulationProposeMilitaryBase''' || || Somewhat understood || Called from '''SimulationProcessTick''' day 23 and from "gilmartin" cheat || | | 0x403017 || 0x4142C0 || int || __stdcall || '''SimulationProposeMilitaryBase''' || || Somewhat understood || Called from '''SimulationProcessTick''' day 23 and from "gilmartin" cheat || | ||
|- | |- | ||
|} | |||
{| class="wikitable sortable" | |||
|+ [[Thing]] functions | |||
|- | |||
! {{tooltip|Thunk address|The address of the function thunk that other functions call.}} ! {{tooltip|Main address|The address that the thunk function jumps to, where the function actually starts}} ! {{tooltip|Return type|The function's return type from the C function signature.}} ! {{tooltip|Calling convention|Typically __cdecl, __stdcall, or __thiscall. Sometimes __usercall or __userpurge in IDA. Write __stdcall if it takes zero arguments.}} ! {{tooltip|Function name|Just the name, not the parameters}} ! {{tooltip|Arguments|What parameters the function takes, or blank for void.}} ! {{tooltip|Status|How well we know what goes on inside the function.}} ! {{tooltip|Related functions|If any, and if not too long to list.}} ! Notes | |||
|- | |||
| 0x402464 || 0x450890 || int || __stdcall || '''SimulationDoThingTick''' || || Barely explored || Called from '''GameDoIdleUpkeep''' via ''sub_401DBB'' || Does the individual simulation ticks for Things every 30-45 ms. | |||
|- | |||
| 0x401992 || 0x4548C0 || char || __usercall || '''SimulationThingTickMonster''' || int a1@<ebx>, __int16 iXTHGIndex || Barely explored || Called from '''SimulationDoThingTick''' || The function signature of this one is odd and needs investigation. | |||
|- | |||
| 0x4024AA || 0x455020 || char || __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 | |||
|- | |||
| 0x402ED2 || 0x4540C0 || __int16 || __cdecl || '''SimulationThingTickHelicopter''' || __int16 iXTHGIndex || Barely explored || Called from '''SimulationDoThingTick''' || | |||
|} | |} | ||
Revision as of 04:07, 6 March 2025
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.
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. |
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 |
Thunk address | Main address | Return type | Calling convention | Function name | Arguments | Status | Related functions | Notes |
---|---|---|---|---|---|---|---|---|
0x402464 | 0x450890 | int | __stdcall | SimulationDoThingTick | Barely explored | Called from GameDoIdleUpkeep via sub_401DBB | Does the individual simulation ticks for Things every 30-45 ms. | |
0x401992 | 0x4548C0 | char | __usercall | SimulationThingTickMonster | int a1@<ebx>, __int16 iXTHGIndex | Barely explored | Called from SimulationDoThingTick | The function signature of this one is odd and needs investigation. |
0x4024AA | 0x455020 | char | __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 |
0x402ED2 | 0x4540C0 | __int16 | __cdecl | SimulationThingTickHelicopter | __int16 iXTHGIndex | Barely explored | Called from SimulationDoThingTick |
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 |