Sly 1:Executable: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
TheOnlyZac (talk | contribs) (→Libraries: Tweaked wording) Tags: Mobile edit Mobile web edit |
TheOnlyZac (talk | contribs) (→Initialization and main loop: Fixed typos, tweaked wording) Tags: Mobile edit Mobile web edit |
||
Line 27: | Line 27: | ||
==Initialization and main loop== |
==Initialization and main loop== |
||
The entry point for the executable is |
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. |
||
=== Initialization === |
=== Initialization === |
||
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> – Call some graphics functions and swap the |
** <code>FlushFrames(1);</code> – Call some graphics functions and swap the graphics synthesizer buffers |
||
** <code>CTransition::Execute(&g_transition);</code> – Execute the MPEG on the global transition instance |
** <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> |
||
** 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 ( |
* 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>CTransition::Execute(&g_transition);</code> |
** <code>CTransition::Execute(&g_transition);</code> |
||
* <code>UpdateJoy(&g_joy);</code> – Handle controller input |
* <code>UpdateJoy(&g_joy);</code> – Handle controller input |
||
* <code>UpdateCodes();</code> – Watch for [[Cheat codes|cheat code]] inputs |
* <code>UpdateCodes();</code> – Watch for [[Cheat codes|cheat code]] inputs |
||
* <code>unk_save_related(&g_save_related_as4);</code> – This function is not well understood, but [[Saving#Sly 1|saving]] the game is |
* <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 GUI [[BLOT|blots]] |
* <code>UpdateUi(&g_ui);</code> – Update the state of GUI [[BLOT|blots]] |
||
* <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 [[GS|game state]] structs |
||
Line 54: | Line 54: | ||
** <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 [[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> – Render gameobjects on the current frame |
** <code>RenderSw(g_psw,g_pcm);</code> – Render gameobjects on the current frame |
||
** <code>RenderUi();</code> – Render the gui elements on the current frame |
** <code>RenderUi();</code> – Render the gui elements on the current frame |