Sly 1:Executable

Revision as of 23:54, 23 July 2022 by TheOnlyZac (talk | contribs) (Added Navbox)

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

Shared 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  2400Unknown
  • 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.

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 buffers
    • CTransition::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 the g_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 input
  • UpdateCodes() – Watch for cheat code inputs
  • unk_save_related(&g_save_related_as4) – This function is not well understood, but saving the game is impossible without it
  • UpdateUi(&g_ui) – Update the state of GUI blots
  • UpdateGameState(g_clock.dt) – Update the running timers on the game state structs
  • if (g_psw != (SW *)0x0) – If g_psw is not NULL...
    • SetupCm(g_pcm) – Setup 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 function pointer from the g_psw struct and execute it if it is not NULL (the function takes g_clock.dt as an argument)
    • RenderSw(g_psw,g_pcm) – Render gameobjects on the current frame
    • RenderUi() – Render the gui elements on the current frame
    • DrawSw(g_psw,g_pcm) – Draw the gameobjects on the frame
    • DrawUi() – Draw the gui elements on the frame
    • CloseFrame() – 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. 1.0 1.1 1.2 1.3 1.4 IRX Files for Playstation 2 - Retro Reversing, 29 March 2021
  2. 2.0 2.1 Static Libraries (.A) for Playstation 2 Emotion Engine - Retro Reversing, 9 July 2022