Sly 1:Executable: Difference between revisions
TheOnlyZac (talk | contribs) (→Initialization and main loop: Fixed typos, tweaked wording) Tags: Mobile edit Mobile web edit |
TheOnlyZac (talk | contribs) m (→Initialization and main loop: Minor text fixes) |
||
Line 37: | Line 37: | ||
* 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>FlushFrames(1)</code> – Call some graphics functions and swap the graphics synthesizer buffers |
||
** <code>CTransition::Execute(&g_transition) |
** <code>CTransition::Execute(&g_transition)</code> – Execute the MPEG on the global transition 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 (<code>m_fPending != 0</code>). If so: |
||
** <code>FlushFrames(1) |
** <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>FlushFrames(1)</code> |
||
** <code>CTransition::Execute(&g_transition) |
** <code>CTransition::Execute(&g_transition)</code> |
||
* <code>UpdateJoy(&g_joy) |
* <code>UpdateJoy(&g_joy)</code> – Handle controller input |
||
* <code>UpdateCodes() |
* <code>UpdateCodes()</code> – Watch for [[Cheat codes|cheat code]] inputs |
||
* <code>unk_save_related(&g_save_related_as4) |
* <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>UpdateUi(&g_ui)</code> – Update the state of GUI [[BLOT|blots]] |
||
* <code>UpdateGameState(g_clock.dt) |
* <code>UpdateGameState(g_clock.dt)</code> – Update the running timers on the [[GS|game state]] structs |
||
* <code>if (g_psw != (SW *)0x0)</code> – If g_psw is not NULL... |
* <code>if (g_psw != (SW *)0x0)</code> – If g_psw is not NULL... |
||
** <code>SetupCm(g_pcm) |
** <code>SetupCm(g_pcm)</code> – Setup some camera values to render the next frame |
||
** <code>OpenFrame() |
** <code>OpenFrame()</code> – Prepare to render the next frame |
||
** <code>MarkClockTick(&g_clock) |
** <code>MarkClockTick(&g_clock)</code> – Update the global [[clock]] values |
||
** Grab a function pointer from the <code>g_psw</code> struct and execute it if it is not NULL (the function takes <code>g_clock.dt</code> as an argument) |
** Grab a function pointer from the <code>g_psw</code> struct and execute it if it is not NULL (the function takes <code>g_clock.dt</code> as an argument) |
||
** <code>RenderSw(g_psw,g_pcm) |
** <code>RenderSw(g_psw,g_pcm)</code> – Render gameobjects on the current frame |
||
** <code>RenderUi() |
** <code>RenderUi()</code> – Render the gui elements on the current frame |
||
** <code>DrawSw(g_psw,g_pcm) |
** <code>DrawSw(g_psw,g_pcm)</code> – Draw the gameobjects on the frame |
||
** <code>DrawUi() |
** <code>DrawUi()</code> – Draw the gui elements on the frame |
||
** <code>CloseFrame() |
** <code>CloseFrame()</code> – Finish rendering the frame |
||
* <code>g_cframe |
* <code>g_cframe++</code> – Increment the global frame counter |
||
This loop continues infinitely 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. |
This loop continues infinitely 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. |
Revision as of 19:31, 17 July 2022
SCUS_971.98 is the executable for Sly Cooper and the Thievius Raccoonus. It is a PS2 ELF compiled for the Emotion Engine processor. The compiler is GCC v2.9-ee-991111b.
Libraries
These libary files are included on the disc alongside the game executable.
- sio2man.irx – Manager Interface for joypads, multitaps and memory cards[1]
- padman.irx – Gamepad manager[1]
- mcman.irx – Memory card manager[1]
- mcserv.irx – Memory card server[1]
- libsd.irx – Sound library[1]
- 989snd.irx – Sound driver
Static libraries
These libraries are bundled with the executable and only referenced by name in some strings.
- libkernl – PlayStation kernel library
- libmc 2430 – Memory card library
- libgraph 2400 – Graphics synthesizer library[2]
- libdma 2400 – Unknown
- libcdvd 2420 – CD/DVD library
- libpad 2410 – DualShock gamepad library
- libipu 2400 – Image data Processor (IPU) library[2]
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
- ↑ 1.0 1.1 1.2 1.3 1.4 IRX Files for Playstation 2 - Retro Reversing, 29 March 2021
- ↑ 2.0 2.1 Static Libraries (.A) for Playstation 2 Emotion Engine - Retro Reversing, 9 July 2022