Difference between revisions of "SA SCM"

From GTAMods Wiki
Jump to navigation Jump to search
m (Splitted the missions counter to make room for exclusive missions.)
m
Line 3: Line 3:
 
A scm file is a binary file with certain structure. The common information about what this file is for can be found [[Mission_Scripting_(Overview)|here]]. The scm file structure looks like the following:
 
A scm file is a binary file with certain structure. The common information about what this file is for can be found [[Mission_Scripting_(Overview)|here]]. The scm file structure looks like the following:
  
  (02 00 01)h + 32 bit int    Jump to second segment
+
  (02 00 01)h + 32-bit int    Jump to second segment
 
  byte                        Target game ('s' - San Andreas for SA)
 
  byte                        Target game ('s' - San Andreas for SA)
 
   (Global vars)              Space for variable saving
 
   (Global vars)              Space for variable saving
  (02 00 01)h + 32 bit int    Jump to third segment
+
  (02 00 01)h + 32-bit int    Jump to third segment
 
  byte                        Segment id
 
  byte                        Segment id
   32 bit int                Number of models
+
   32-bit int                Number of models
   (model names)              24 byte model names * number of models (model 0 name is empty and therefore unused)
+
   (Model names)              24 byte model names * number of models (model 0 name is empty and therefore unused)
  (02 00 01)h + 32 bit int    Jump to fourth segment
+
  (02 00 01)h + 32-bit int    Jump to fourth segment
 
  byte                        Segment id
 
  byte                        Segment id
   32 bit int                MAIN size
+
   32-bit int                MAIN size
   32 bit int                Largest mission size
+
   32-bit int                Largest mission size
   16 bit int                Number of total missions
+
   16-bit int                Number of total missions
   16 bit int                Number of exclusive missions
+
   16-bit int                Number of exclusive missions
   32 bit int                Highest number of locals used in mission/exernal
+
   32-bit int                Highest number of locals used in mission/exernal
   (mission addresses)        32 bit addresses * number of missions
+
   (Mission addresses)        32 bit addresses * number of missions
  (02 00 01)h + 32 bit int    Jump to fifth segment
+
  (02 00 01)h + 32-bit int    Jump to fifth segment
 
  byte                        Segment id
 
  byte                        Segment id
   32 bit int                Largest external size
+
   32-bit int                Largest external size
   32 bit int                Number of externals
+
   32-bit int                Number of externals
   (external data):          28 byte external data * number of externals
+
   (External data):          28 byte external data * number of externals
 
     20 bytes                Name of external
 
     20 bytes                Name of external
     32 bit int              Offset of external
+
     32-bit int              Offset of external
     32 bit int              Size of external
+
     32-bit int              Size of external
  (02 00 01)h + 32 bit int    Jump to sixth segment
+
  (02 00 01)h + 32-bit int    Jump to sixth segment
 
  byte                        Segment id
 
  byte                        Segment id
   32 bit int                (Unused, always 0)
+
   32-bit int                (Unused, always 0)
  (02 00 01)h + 32 bit int    Jump to seventh segment
+
  (02 00 01)h + 32-bit int    Jump to seventh segment
 
  byte                        Segment id
 
  byte                        Segment id
   32 bit int                Size of global var space
+
   32-bit int                Size of global var space
     8 bit int                Number of allocated externals (with [[07D3]], [[0884]], [[0928]] or [[0929]])? (unused, always 3Eh)
+
     8-bit int                Number of allocated externals (with [[07D3]], [[0884]], [[0928]] or [[0929]])? (unused, always 3Eh)
     8 bit int                Number of unused externals ('''HOME_BRAINS''' and '''AAA''')? (unused, always 2)
+
     8-bit int                Number of unused externals ('''HOME_BRAINS''' and '''AAA''')? (unused, always 2)
   16 bit int                (Unused, always 0)
+
   16-bit int                (Unused, always 0)
 
  (MAIN code)                  MAIN section, equal to size defined earlier
 
  (MAIN code)                  MAIN section, equal to size defined earlier
  (mission code)              The mission data, missions stored at offsets defined earlier
+
  (Mission code)              The mission data, missions stored at offsets defined earlier
  
 
The '''AAA''' external script is very odd as the sixth segment is copied inside. The following bytes are just padding to align the file size to the nearest 2KB, like also in the working externals.
 
The '''AAA''' external script is very odd as the sixth segment is copied inside. The following bytes are just padding to align the file size to the nearest 2KB, like also in the working externals.

Revision as of 17:19, 6 June 2015

40px-Ambox rewrite orange.svg.png This article may need to be rewritten.
Please help improve this article. The discussion page may contain suggestions.

A scm file is a binary file with certain structure. The common information about what this file is for can be found here. The scm file structure looks like the following:

(02 00 01)h + 32-bit int     Jump to second segment
byte                         Target game ('s' - San Andreas for SA)
  (Global vars)              Space for variable saving
(02 00 01)h + 32-bit int     Jump to third segment
byte                         Segment id
  32-bit int                 Number of models
  (Model names)              24 byte model names * number of models (model 0 name is empty and therefore unused)
(02 00 01)h + 32-bit int     Jump to fourth segment
byte                         Segment id
  32-bit int                 MAIN size
  32-bit int                 Largest mission size
  16-bit int                 Number of total missions
  16-bit int                 Number of exclusive missions
  32-bit int                 Highest number of locals used in mission/exernal
  (Mission addresses)        32 bit addresses * number of missions
(02 00 01)h + 32-bit int     Jump to fifth segment
byte                         Segment id
  32-bit int                 Largest external size
  32-bit int                 Number of externals
  (External data):           28 byte external data * number of externals
    20 bytes                 Name of external
    32-bit int               Offset of external
    32-bit int               Size of external
(02 00 01)h + 32-bit int     Jump to sixth segment
byte                         Segment id
  32-bit int                 (Unused, always 0)
(02 00 01)h + 32-bit int     Jump to seventh segment
byte                         Segment id
  32-bit int                 Size of global var space
   8-bit int                 Number of allocated externals (with 07D3, 0884, 0928 or 0929)? (unused, always 3Eh)
   8-bit int                 Number of unused externals (HOME_BRAINS and AAA)? (unused, always 2)
  16-bit int                 (Unused, always 0)
(MAIN code)                  MAIN section, equal to size defined earlier
(Mission code)               The mission data, missions stored at offsets defined earlier

The AAA external script is very odd as the sixth segment is copied inside. The following bytes are just padding to align the file size to the nearest 2KB, like also in the working externals.

See also