Sly 1:Executable: Difference between revisions
TheOnlyZac (talk | contribs) m (TheOnlyZac moved page SCUS 971.98 to Sly 1:Executable: Moved to Sly 1 space) |
TheOnlyZac (talk | contribs) (Added infobox) |
||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Infobox file |
|||
{{DISPLAYTITLE:SCUS_971.98}} |
|||
|name=SCUS_971.98 |
|||
⚫ | |||
|type=MIPS r5900 ELF |
|||
}} |
|||
⚫ | |||
== Libraries == |
== Libraries == |
||
{{Hatnote|This section contains educated guesses based on available information and context clues.}} |
{{Hatnote|This section contains educated guesses based on available information and context clues, and may be inaccurate or incomplete.}} |
||
=== |
=== IOP modules === |
||
These |
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<ref name=":0">[https://www.retroreversing.com/irx-ps2 IRX Files for Playstation 2] - Retro Reversing, 29 March 2021</ref> |
* '''sio2man.irx''' – Manager Interface for joypads, multitaps and memory cards<ref name=":0">[https://www.retroreversing.com/irx-ps2 IRX Files for Playstation 2] - Retro Reversing, 29 March 2021</ref> |
||
Line 16: | Line 20: | ||
=== Static libraries === |
=== Static libraries === |
||
These libraries are bundled with the executable and only referenced by name in some strings. |
These libraries are bundled with the executable and some are only referenced by name in some strings. |
||
==== Standard libraries ==== |
|||
* '''libkernl''' – PlayStation kernel library |
|||
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 ==== |
|||
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 |
* '''libmc 2430''' – Memory card library |
||
* '''libgraph 2400''' – Graphics |
* '''libgraph 2400''' – [[Wikipedia:PlayStation 2 technical specifications#Graphics%20processing%20unit|Graphics Synthesizer]] library<ref name=":1">[https://www.retroreversing.com/static-libraries-ps2 Static Libraries (.A) for Playstation 2 Emotion Engine] - Retro Reversing, 9 July 2022</ref> |
||
* '''libdma 2400''' – |
* '''libdma 2400''' – Direct Memory Access (DMA) library |
||
* '''libcdvd 2420''' – CD/DVD library |
* '''libcdvd 2420''' – CD/DVD library |
||
* '''libpad 2410''' – DualShock gamepad library |
* '''libpad 2410''' – DualShock gamepad library |
||
* '''libipu 2400''' – Image data Processor (IPU) library<ref name=":1" /> |
* '''libipu 2400''' – Image data Processor (IPU) library<ref name=":1" /> |
||
==Initialization and main loop== |
== Initialization and main loop == |
||
=== _start === |
|||
The entry point for the executable is <code>_start</code>. It sets up the main thread, initializes the main thread's heap, and calls <code>main</code>. The <code>main</code> function takes two arguments, <code>int cphzArgs</code> (the number of arguments) and <code>char** apchzArgs</code> (the array of arguments). It performs some initialization and begins the main game loop. |
|||
The entry point for the executable is <code>_start</code>, which is provided by the PS2 SDK's <code>crt0.s</code>. It sets up the main thread, initializes the main thread's heap, and calls <code>main</code>. |
|||
=== |
=== main === |
||
<code>main</code> |
The <code>main</code> function takes two parameters, <code>int cphzArgs</code> (the number of arguments) and <code>char** apchzArgs</code> (an array of arguments), which it stores as the the global variables <code>g_cphzArgs</code> and <code>g_apchzArgs</code> respectively. It calls <code>__main</code> and <code>Startup</code> to initialize the game engine, then begins the main loop. |
||
{{Todo|Investigate and expand on what <code>__main</code> and <code>Startup</code> do}} |
|||
==== __main ==== |
|||
<code>main</code> 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 ==== |
|||
<code>Startup</code> begins by calling <code>SetPhase</code>, setting <code>g_phase</code> to <code>PHASE::Startup</code>. It then iterates over an array of function pointers, called <code>StartupSampler</code>, 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 === |
=== Game loop === |
||
Line 38: | Line 60: | ||
* First, check if <code>g_mpeg</code> has an [[MPEG]] queued to be played. If so: |
* First, check if <code>g_mpeg</code> has an [[MPEG]] queued to be played. If so: |
||
** <code>FlushFrames(1)</code> – Call some graphics functions and swap the graphics synthesizer buffers |
** <code>FlushFrames(1)</code> – Call some graphics functions and swap the graphics synthesizer buffers |
||
** <code> |
** <code>g_transition::Execute()</code> – Execute the MPEG on the global [[Sly 1:Transition|CTransition]] instance |
||
* Check if <code>g_transition</code> has a pending transition (<code>m_fPending != 0</code>). If so: |
* Check if <code>g_transition</code> has a pending transition (i.e. <code>m_fPending != 0</code>). If so: |
||
** <code>FlushFrames(1)</code> |
** <code>FlushFrames(1)</code> |
||
** Call a function that calls <code>CMpeg::Execute</code> on the <code>g_transition</code> instance |
** Call a function that calls <code>CMpeg::Execute</code> on the <code>g_transition</code> instance. |
||
* Check '''again''' if <code>g_mpeg</code> has an MPEG queued to be played (this happens if two MPEGs were queued to play back-to-back) If so: |
* Check '''again''' if <code>g_mpeg</code> has an MPEG queued to be played (this happens if two MPEGs were queued to play back-to-back). If so: |
||
** <code>FlushFrames(1)</code> |
** <code>FlushFrames(1)</code> |
||
** <code> |
** <code>g_transition::Execute()</code> |
||
* <code>UpdateJoy(&g_joy)</code> – |
* <code>UpdateJoy(&g_joy)</code> – Handles [[Sly 1:Input|controller input]] |
||
* <code>UpdateCodes()</code> – |
* <code>UpdateCodes()</code> – Watche for [[Sly 1:Cheat codes|cheat code]] inputs |
||
* Call an unknown function that handles saving the game. |
|||
* <code>unk_save_related(&g_save_related_as4)</code> – This function is not well understood, but [[Saving#Sly 1|saving]] the game is impossible without it |
|||
* <code>UpdateUi(&g_ui)</code> – Update the state of |
* <code>UpdateUi(&g_ui)</code> – Update the state of the [[Sly 1:Screen|GUI]] |
||
* <code>UpdateGameState(g_clock.dt)</code> – Update the running timers on the [[GS|game state]] structs |
* <code>UpdateGameState(g_clock.dt)</code> – Update the running timers on the [[Sly 1:GS|game state]] structs |
||
* <code>if (g_psw != |
* <code>if (g_psw != NULLPTR)</code> – If g_psw is has been initialized.. |
||
** <code>SetupCm(g_pcm)</code> – |
** <code>SetupCm(g_pcm)</code> – Set up some [[Sly 1:Camera|camera]] values to render the next frame |
||
** <code>OpenFrame()</code> – Prepare to render the next frame |
** <code>OpenFrame()</code> – Prepare to render the next frame |
||
** <code>MarkClockTick(&g_clock)</code> – Update the global [[clock]] values |
** <code>MarkClockTick(&g_clock)</code> – Update the global [[Sly 1:Clock|clock]] values |
||
** Grab a function pointer from the <code>g_psw</code> struct and execute it if it is not NULL |
** Grab a particular function pointer from the <code>g_psw</code> struct and execute it if it is not NULL. The function's purpose is unknown but it takes <code>g_clock.dt</code> as an argument, so it's probably an Update function. |
||
** <code>RenderSw(g_psw,g_pcm)</code> – Render |
** <code>RenderSw(g_psw, g_pcm)</code> – Render [[Sly 1:SW|game objects]] from the given camera perspective |
||
** <code>RenderUi()</code> – Render the |
** <code>RenderUi()</code> – Render the UI [[Sly 1:BLOT|blots]] on the current frame |
||
** <code>DrawSw(g_psw,g_pcm)</code> – Draw the |
** <code>DrawSw(g_psw, g_pcm)</code> – Draw the game objects from the given camera perspective |
||
** <code>DrawUi()</code> – Draw the |
** <code>DrawUi()</code> – Draw the UI elements on the frame |
||
** <code>CloseFrame()</code> – Finish rendering the frame |
** <code>CloseFrame()</code> – Finish rendering the frame |
||
* |
* Increment the global frame counter, <code>g_cframe</code>. |
||
This |
This routine continues in an infinite loop unless <code>Exit</code> is called or a handled exception causes execution to halt, in which case you are immediately booted back to the PS2 BIOS. |
||
==Build strings== |
==Build strings== |
||
Line 69: | Line 91: | ||
<code>g_achzBuildUser</code> |
<code>g_achzBuildUser</code> |
||
<pre>jojo</pre> |
<pre>jojo</pre> |
||
<code>g_achzBuildDateLong</code> |
<code>g_achzBuildDateLong</code> |
||
<pre>08/24/02 22:06</pre> |
<pre>08/24/02 22:06</pre> |
||
<code>g_achzBuildDateShort</code> |
<code>g_achzBuildDateShort</code> |
Latest revision as of 20:30, 25 September 2023
File | |
---|---|
Game | Sly Cooper and the Thievius Raccoonus |
Type | MIPS r5900 ELF |
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.[1]
Libraries
IOP modules
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[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 some are only referenced by name in some strings.
Standard libraries
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
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[3]
- libdma 2400 – Direct Memory Access (DMA) library
- libcdvd 2420 – CD/DVD library
- libpad 2410 – DualShock gamepad library
- libipu 2400 – Image data Processor (IPU) library[3]
Initialization and main loop
_start
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
.
main
The 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_cphzArgs
and g_apchzArgs
respectively. It calls __main
and Startup
to initialize the game engine, then begins the main loop.
__main
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
Startup
begins by calling SetPhase
, setting g_phase
to 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
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 buffersg_transition::Execute()
– Execute the MPEG on the global CTransition instance
- Check if
g_transition
has a pending transition (i.e.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)
g_transition::Execute()
UpdateJoy(&g_joy)
– Handles controller inputUpdateCodes()
– Watche for cheat code inputs- Call an unknown function that handles saving the game.
UpdateUi(&g_ui)
– Update the state of the GUIUpdateGameState(g_clock.dt)
– Update the running timers on the game state structsif (g_psw != NULLPTR)
– If g_psw is has been initialized..SetupCm(g_pcm)
– Set up some camera values to render the next frameOpenFrame()
– Prepare to render the next frameMarkClockTick(&g_clock)
– Update the global clock values- Grab a particular function pointer from the
g_psw
struct and execute it if it is not NULL. The function's purpose is unknown but it takesg_clock.dt
as an argument, so it's probably an Update function. RenderSw(g_psw, g_pcm)
– Render game objects from the given camera perspectiveRenderUi()
– Render the UI blots on the current frameDrawSw(g_psw, g_pcm)
– Draw the game objects from the given camera perspectiveDrawUi()
– Draw the UI elements on the frameCloseFrame()
– Finish rendering the frame
- Increment the global frame counter,
g_cframe
.
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
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