Sly 1:Executable
SCUS_971.98 is the executable for Sly Cooper and the Thievius Raccoonus. It is an ELF binary compiled for the PS2’s Emotion Engine processor. The compiler is GCC v2.9-ee-991111b.[1]
Libraries
These libary files are included on the disc alongside the game executable.
- sio2man.irx – Manager Interface for joypads, multitaps and memory cards[2]
- padman.irx – Gamepad manager[2]
- mcman.irx – Memory card manager[2]
- mcserv.irx – Memory card server[2]
- libsd.irx – Sound library[2]
- 989snd.irx – Sound driver
Static libraries
These libraries are bundled with the executable and only referenced by name in some strings.
Initialization and main loop
The entry point for the executable is _start
. It sets up the main thread, initializes the main thread's heap, and calls main
. The main
function takes two arguments, int cphzArgs
(the number of arguments) and char** apchzArgs
(the array of arguments). It performs some initialization and begins the main game loop.
Initialization
main
starts by calling __main
, a function that iterates over a function table and calls each function to initialize several game variables. Exeuction then returns to main
which stores the passed parameters in g_cphzArgs
and g_apchzArgs
respectively. It then calls Startup
, a function which intializes even more game variables.
To Do: Investigate and expand on what __main and Startup do |
Game loop
The logic of the main game loop can be broken down as follows.
- First, check if
g_mpeg
has an MPEG queued to be played. If so:FlushFrames(1)
– Call some graphics functions and swap the graphics synthesizer buffersCTransition::Execute(&g_transition)
– Execute the MPEG on the global transition instance
- Check if
g_transition
has a pending transition (m_fPending != 0
). If so:FlushFrames(1)
- Call a function that calls
CMpeg::Execute
on theg_transition
instance
- Check again if
g_mpeg
has an MPEG queued to be played (this happens if two MPEGs were queued to play back-to-back) If so:FlushFrames(1)
CTransition::Execute(&g_transition)
UpdateJoy(&g_joy)
– Handle controller inputUpdateCodes()
– Watch for cheat code inputsunk_save_related(&g_save_related_as4)
– This function is not well understood, but saving the game is impossible without itUpdateUi(&g_ui)
– Update the state of GUI blotsUpdateGameState(g_clock.dt)
– Update the running timers on the game state structsif (g_psw != (SW *)0x0)
– If g_psw is not NULL...SetupCm(g_pcm)
– Setup some camera values to render the next frameOpenFrame()
– Prepare to render the next frameMarkClockTick(&g_clock)
– Update the global clock values- Grab a function pointer from the
g_psw
struct and execute it if it is not NULL (the function takesg_clock.dt
as an argument) RenderSw(g_psw,g_pcm)
– Render gameobjects on the current frameRenderUi()
– Render the gui elements on the current frameDrawSw(g_psw,g_pcm)
– Draw the gameobjects on the frameDrawUi()
– Draw the gui elements on the frameCloseFrame()
– Finish rendering the frame
g_cframe++
– Increment the global frame counter
This loop continues infinitely unless Exit
is called or a handled exception causes execution to halt, in which case you are immediately booted back to the PS2 BIOS.
Build strings
The executable contains the following strings generated during the build process.
g_achzBuildUser
jojo
g_achzBuildDateLong
08/24/02 22:06
g_achzBuildDateShort
0824.2206
References
- ↑ Based on strings found in the May 2002 demo build
- ↑ 2.0 2.1 2.2 2.3 2.4 IRX Files for Playstation 2 - Retro Reversing, 29 March 2021
- ↑ 3.0 3.1 Static Libraries (.A) for Playstation 2 Emotion Engine - Retro Reversing, 9 July 2022