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 ee-gcc v2.9-ee-991111b.
Libraries[edit | edit source]
IOP modules[edit | edit source]
These modules are included on the disc alongside the game executable, and are loaded on the IOP core.
- sio2man.irx – Manager Interface for joypads, multitaps and memory cards
- padman.irx – Gamepad manager
- mcman.irx – Memory card manager
- mcserv.irx – Memory card server
- libsd.irx – Sound library
- 989snd.irx – Sound driver
Static libraries[edit | edit source]
These libraries are bundled with the executable and some are only referenced by name in some strings.
Standard libraries[edit | edit source]
These libraries are shipped either by the Cygnus ee-gcc toolchain or provided as a part of gcc directly.
- libgcc – GCC internal runtime library
- libgcc2 - GCC internal runtime library (provides C++ ABI routines and other misc. runtime functions)
- newlib – Embedded C standard library implementation
- libio – GNU implementation of C++ IO streams
- libstdc++ – GNU C++ standard library
PS2 SDK libraries[edit | edit source]
These libraries are part of the PS2 SDK and written by SCEI.
- libkernel – Interface to the EE Kernel (syscall wrappers/etc.)
- libmc 2430 – Memory card library
- libgraph 2400 – Graphics Synthesizer library
- libdma 2400 – Direct Memory Access (DMA) library
- libcdvd 2420 – CD/DVD library
- libpad 2410 – DualShock gamepad library
- libipu 2400 – Image data Processor (IPU) library
Initialization and main loop[edit | edit source]
_start[edit | edit source]
The entry point for the executable is
_start, which is provided by the PS2 SDK's
crt0.s. It sets up the main thread, initializes the main thread's heap, and calls
main[edit | edit source]
main function takes two parameters,
int cphzArgs (the number of arguments) and
char** apchzArgs (an array of arguments), which it stores as the the global variables
g_apchzArgs respectively. It calls
Startup to initialize the game engine, then begins the main loop.
__main[edit | edit source]
main is a libgcc function that iterates through a generated table of initialization functions which initialize global variables and construct global objects, calling them all.
Startup[edit | edit source]
Startup begins by calling
PHASE::Startup. It then iterates over an array of function pointers, called
StartupSampler, and calls each one. The startup sampler includes the startup functions for many game subsystems, such as DMA, Thread, Codes, Screen, and Clock, and more.
Game loop[edit | edit source]
The logic of the main game loop can be broken down as follows.
- First, check if
g_mpeghas an MPEG queued to be played. If so:
FlushFrames(1)– Call some graphics functions and swap the graphics synthesizer buffers
g_transition::Execute()– Execute the MPEG on the global CTransition instance
- Check if
g_transitionhas a pending transition (i.e.
m_fPending != 0). If so:
- Call a function that calls
- Check again if
g_mpeghas an MPEG queued to be played (this happens if two MPEGs were queued to play back-to-back). If so:
UpdateJoy(&g_joy)– Handles controller input
UpdateCodes()– Watche for cheat code inputs
- Call an unknown function that handles saving the game.
UpdateUi(&g_ui)– Update the state of the GUI
UpdateGameState(g_clock.dt)– Update the running timers on the game state structs
if (g_psw != NULLPTR)– If g_psw is has been initialized..
SetupCm(g_pcm)– Set up some camera values to render the next frame
OpenFrame()– Prepare to render the next frame
MarkClockTick(&g_clock)– Update the global clock values
- Grab a particular function pointer from the
g_pswstruct and execute it if it is not NULL. The function's purpose is unknown but it takes
g_clock.dtas an argument, so it's probably an Update function.
RenderSw(g_psw, g_pcm)– Render game objects from the given camera perspective
RenderUi()– Render the UI blots on the current frame
DrawSw(g_psw, g_pcm)– Draw the game objects from the given camera perspective
DrawUi()– Draw the UI elements on the frame
CloseFrame()– Finish rendering the frame
- Increment the global frame counter,
This routine continues in an infinite loop 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[edit | edit source]
The executable contains the following strings generated during the build process.
References[edit | edit source]
- ↑ 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