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 1: | Line 1: | ||
{{Heavy construction}} | {{Heavy construction}} | ||
Line 9: | Line 12: | ||
|- | |- | ||
! {{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 | ! {{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 | ||
|- | |||
| 0x40130C || 0x45F760 || {{Win32_BOOL}} || __stdcall || '''SimulationDoDisasterTick''' || || Barely explored || Called from '''SimulationStartDisaster''' || | |||
|- | |||
| 0x4013ED || 0x42BCA0 || int || __cdecl || '''SimulationCalculateOrdinanceCost''' || DWORD dwOrdinance || || 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" | | 0x4015E6 || 0x4731E0 || int || __cdecl || '''SimulationPrepareBudgetDialog''' || int a1 || Mostly understood || || arg a1 only referenced on line, seems to be more like "BOOL bUseParentWindow" | ||
Line 23: | Line 32: | ||
|- | |- | ||
| 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. | ||
|- | |||
| 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? | | 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 44: | Line 55: | ||
|- | |- | ||
| 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. | | 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. | ||
|- | |||
| 0x401EBA || 0x452FA0 || int || __cdecl || '''SimulationSpawnMaxisMan''' || __int16 iDisasterID || Barely explored || Creates the Thing for Maxis Man and determines based on iDisasterID what his behavior should be | |||
|- | |- | ||
| 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 | | 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 |
Revision as of 05:18, 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 |
---|---|---|---|---|---|---|---|---|
0x40130C | 0x45F760 | BOOL | __stdcall | SimulationDoDisasterTick | Barely explored | Called from SimulationStartDisaster | ||
0x4013ED | 0x42BCA0 | int | __cdecl | SimulationCalculateOrdinanceCost | DWORD dwOrdinance | 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. | |
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 | |||
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. |
0x401EBA | 0x452FA0 | int | __cdecl | SimulationSpawnMaxisMan | __int16 iDisasterID | Barely explored | Creates the Thing for Maxis Man and determines based on iDisasterID what his behavior should be | |
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 |