Sly 1:Executable: Difference between revisions

→‎Game loop: Changed wording, layout, links
m (TheOnlyZac moved page SCUS 971.98 to Sly 1:Executable: Moved to Sly 1 space)
(→‎Game loop: Changed wording, layout, links)
Line 3:
 
== Libraries ==
{{Hatnote|This section contains educated guesses based on available information and context clues, and may be inaccurate or incomplete.}}
 
=== Shared libraries ===
Line 20:
* '''libkernl''' – PlayStation kernel library
* '''libmc 2430''' – Memory card library
* '''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''' – ''Unknown''
* '''libcdvd 2420''' – CD/DVD library
Line 30:
 
=== Initialization ===
<code>main</code> starts by calling <code>__main</code>, a function that iterates over a function table and calls each function to initialize several game variables. ExeuctionExecution then returns to <code>main</code> which stores the passed parameters in <code>g_cphzArgs</code> and <code>g_apchzArgs</code> respectively. It then calls <code>Startup</code>, a function which intializesinitializes even more game variables.
{{Todo|Investigate and expand on what <code>__main</code> and <code>Startup</code> do}}
 
Line 37:
 
* First, check if <code>g_mpeg</code> has an [[MPEG]] queued to be played. If so:
** <code>FlushFrames(1)</code> – CallCalls some graphics functions and swap the graphics synthesizer buffers
** <code>CTransition::Execute(&g_transition)</code> – ExecuteExecutes the MPEG on the global [[Sly 1:Transition|transition]] instance
* Check if <code>g_transition</code> has a pending transition (<code>m_fPending != 0</code>). If so:
** <code>FlushFrames(1)</code>
** 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:
** <code>FlushFrames(1)</code>
** <code>CTransition::Execute(&g_transition)</code>
* <code>UpdateJoy(&g_joy)</code> – HandleHandles [[Sly 1:Input|controller input]]
* <code>UpdateCodes()</code> – WatchWatches 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> – UpdateUpdates the state of GUIthe [[BLOTSly 1:Screen|blotsGUI]]
* <code>UpdateGameState(g_clock.dt)</code> – UpdateUpdates the running timers on the [[Sly 1:GS|game state]] structs
* <code>if (g_psw != (SW *)0x0NULLPTR)</code> – If g_psw is not NULL.null..
** <code>SetupCm(g_pcm)</code> – SetupSets up some [[Sly 1:Camera|camera]] values to render the next frame
** <code>OpenFrame()</code> – PreparePrepares to render the next frame
** <code>MarkClockTick(&g_clock)</code> – UpdateUpdates the global [[Sly 1:Clock|clock]] values
** Grab a particular function pointer from the <code>g_psw</code> struct and execute it if it is not NULL. (theThe 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> – RenderRenders gameobjects[[Sly on1:SW|game objects]] from the currentgiven camera frameperspective
** <code>RenderUi()</code> – RenderRenders the guiGUI elements[[Sly 1:BLOT|blots]] on the current frame
** <code>DrawSw(g_psw, g_pcm)</code> – DrawDraws the gameobjectsgame onobjects from the framegiven camera perspective
** <code>DrawUi()</code> – DrawDraws the guiGUI elements on the frame
** <code>CloseFrame()</code> – FinishFinishes rendering the frame
* <code>g_cframe++</code> – Increment the global frame counter, <code>g_cframe</code>.
 
This looproutine continues infinitelyin 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==
Line 69:
<code>g_achzBuildUser</code>
<pre>jojo</pre>
 
 
<code>g_achzBuildDateLong</code>
<pre>08/24/02 22:06</pre>
 
 
<code>g_achzBuildDateShort</code>