Located at address 8005BDC0
Summary
Calls routines that initialize various Playstation systems. Dynamically loads state managers from the cd when necessary, loads preliminary assets, then executes the selected state manager.
Behavior
Call SetVideoMode and system_init to initialize various Playstation systems. Start the game by calling the first state manager. Enter the game loop which checks if the state manager is located in the cd or main executable. If the state manager is on the cd, call a function to enqueue its load to address 80136000. Proceed by calling cdlib_process_until_idle which will execute the load.
Execution then enters a new non nested branch that checks if the state manager index is 13. If the branch is taken, check a value that seems related to game state (800f447c). If the value is 21 set the game asset table index to 91 otherwise if that game state value is 30 set the asset table index to 88. Regardless if the asset table index was updated call setup asset load with a first param of 1 to select the asset group pointer table as the source for the index passed in. Then call the asset loader and cdlib_manager in a loop to load the remaining assets in the group with the asset loader return value acting as the exit condition.
Finally call the state manager. When the state manager returns, based on the return value, we either exit the program pump the cd manager once before we loop back to the first if condition.
Notes
- If the state manager is on the main executable, the the second member the state manager entry has a value of -1.
- Vsync(2) used to throttle cdlib_manager calls
- The state manager at index 13 points to the address of the main gameplay state manager located on the executable, this state manager does seem to have multiple entries on the stateManagers table.
- The asset table index seems to double as a zone id. Stage 1 and 2 which have one zone had an index of 1 and 2 respectively while stage 3 which has 3 zones used index 3, 4, 5 depending on the zone the player was in.
Unknowns
- I dont think the state manager at index 13 is used when entering a stage, I checked this a while back so I dont exactly remember but I think its the one used on return to the time station.
Function Signature
Parameters: None
Returns
Always 0