Difference between revisions of "PS2 Code Overlay"

From GTAMods Wiki
Jump to navigation Jump to search
(Created page with "The PS2 version of San Andreas uses code overlays to save memory and swap code in only when it is actually needed. The files have the extension 'nm' for NTSC and 'pm' for PAL...")
 
Line 10: Line 10:
 
   4b - fourcc (MWo3)
 
   4b - fourcc (MWo3)
 
   4b - unknown (number of segments?)
 
   4b - unknown (number of segments?)
   4b - load address
+
   4b - load address/entry point?
 
   4b - size of text segment
 
   4b - size of text segment
 
   4b - size of data segment
 
   4b - size of data segment
 
   4b - size of bss segment
 
   4b - size of bss segment
   4b - end of data/start of bss segment
+
   4b - end of data/start of bss segment?
   4b - end of data/start of bss segment
+
   4b - end of data/start of bss segment?
 
   32b - file name
 
   32b - file name
  
 
After that follow the text and data segment
 
After that follow the text and data segment

Revision as of 10:10, 3 February 2016

The PS2 version of San Andreas uses code overlays to save memory and swap code in only when it is actually needed. The files have the extension 'nm' for NTSC and 'pm' for PAL respectively.

The following code overlays are used: clothes, credits, cutscene, fileload, init, jpeg, mc, mpeg

In the SLES version the files are loaded by the function at 0x3C6A80 which takes as its first argument the name of the file containing the code and as second argument the address where it is to be loaded (0x88D980 typically).

The files have a 64 byte long header:

 4b - fourcc (MWo3)
 4b - unknown (number of segments?)
 4b - load address/entry point?
 4b - size of text segment
 4b - size of data segment
 4b - size of bss segment
 4b - end of data/start of bss segment?
 4b - end of data/start of bss segment?
 32b - file name

After that follow the text and data segment