1 ----------------------------
2 --------Introduction--------
3 ----------------------------
5 Binary Format of GameMaker 8 Files (gmk)
6 Copyright (c) 2008, 2009 IsmAvatar <IsmAvatar@gmail.com>
9 Redistribution and use of this document, with or without modification,
10 is permitted provided that redistributions retain the above copyright
11 notice, this condition, and the following disclaimer.
14 THIS DOCUMENT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THIS DOCUMENT OR THE USE OR OTHER DEALINGS IN
22 You may need a hex editor to examine GM files and/or make modifications.
23 For Windows, I would recommend XVI32, found at
24 http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm and for
25 Linux I would recommend Okteta
29 I have thoroughly reviewed the Licence Agreement of GameMaker, and have a
30 general knowledge of copyrights and such. These activities are legal, as
31 long as I do not tamper with the compiler and as long as I maintain
32 credit to Mark Overmars for the original GameMaker, which I will make
33 sure to revere and worship greatly in this product. A note from Mark
34 Overmars himself regarding this activity:
36 "Sorry for not replying earlier. I was first was on holidays and then
37 trying to catch up. I don;t think this is an important issue. Actually
38 .gm6 files are not really protected. And even though I prefer people not
39 to hack them, I cannot see a reason to be worried about this.
45 From time to time, you'll see some bytes documented as "GM Version needed
46 for the following info". For resources, first GM version tells when the
47 resource type was added, while the second GM version tells when the last
48 update of the resource type was.
50 We will only focus on versions 530, 600, and 702 although these other
51 versions may be mentioned elsewhere.
53 * 800 for GM8.0 (notice, GM8's GMKs are zlib compressed. Please see Note About GM8 below)
54 * 702 for GM7.0 (notice, GM7's GMKs are obfuscated. Please see the GMKrypt Documentation)
55 * 701 for GM7.0 as well.
56 * 620 for GM7.0 in some places. This may be because Mark was planning on calling it 6.2
57 * 600 for GM6.1 and GM6.0 (cross-compatible)
58 * 530 for GM5.3 and GM5.3a (bug-fix version. cross-compatible)
59 * 520 for 510 for GM5.1
60 * 500 for GM5.2 and GM5.0 (forward compatible)
63 and so on. Other numbers may pop up as well, as in-between versions. For
64 example, 542 means that 530 cannot read it, but 600 can. Software usually
65 does this for format changes during development. Also see Angle Brackets
68 Note About Longint / Numbers:
70 GM uses primarily 32-bit (4-byte) little-endian signed integers, which I
71 choose to call "longints", for most of its data. Even basic things like
72 True/False and Radio Buttons etc. each tend to be stored in their own
73 4-byte/32-bit set, rather than merging 8 of them to make a single byte or
74 merging 32 of them to make that same 4-byte.
76 I will display any dates as Gregorian ISO standard (yyyy-mm-dd).
78 Dates are stored in 64-bit (8-byte) signed doubles representing the
79 number of days that have passed since 1899-12-30. Fractional parts are
80 used to represent fractions of days (hours, minutes, seconds, etc).
82 Colors are stored in a longint, usually only using the first 3 bytes as R
83 G B respectively, although sometimes they'll make use of the 4th byte, so
84 handle carefully. Usually the 4th byte is 0.
86 Unless otherwise denoted by a preceding (<byte size>-bytes) note, all
87 data is stored in 32-bit integers or 32-bit preceded 8-bit character
88 sequences (as denoted by insertions, explained below).
90 Note About Insertion and Curly Brackets { }
92 Insertion will take 2 normal forms, and a third special form (see Angle
93 Brackets). Both normal forms will almost always have a longint before the
94 insertion to indicate how much information is contained in the insertion.
95 If this number is 0, no additional data will be inserted. The data is
96 then surrounded by curly brackets { }.
98 The first kind of insertion is String Insertion. This is when the data is
99 a series of 8-bit (1-byte) characters. My documentation will show these
100 by having all the information (the length longint, the curly brackets,
101 and the data) on one line.
103 Example of string insertion:
104 Length of Name { Name }
105 which would turn out as something like 07 Sprites ...
108 The second kind of insertion is Structured Insertion (although you
109 needn't remember the name - it's stolen from C's struct). For this, the
110 documentation format will be the length longint, and then the first curly
111 bracket { on a new line, followed by the data on its own lines separate
112 from the curly brackets, and then concluded with an end curly bracket on
113 a new line. See the examples below.
115 Two common forms will arise. One is the true/false Structured Insertion.
116 This determines simply whether or not the insertion will appear.
118 Example of a true/false
124 The other is the Repitition Structured Insertion. This means that the
125 first longint will indicate *how many times* the data within will be
126 inserted. The data itself is not actually repeated - only the structure
129 Example of repetition
135 In this case, supposing there's 8 views, each with increments of ID
137 The result would be: 08 00 01 02 03 04 05 06 07 (replacing each of those
138 numbers with the longint equivelent)
140 Note about Conditional Insertions and Angle Brackets < >
142 Conditional Insertions are when a certain condition (e.g. the value of a
143 prior longint) must be met in order for the data to be inserted. This is
144 set apart from normal insertions because that longint may not be
145 adjacent, or because the longint value may not be an obvious indicator of
146 the repetitions (e.g. 0 may indicate that data is indeed inserted, while
147 1 may indicate that it is not). Angle Brackets are placed around this
148 conditional expression.
150 A very common example of Conditional Insertions is the Version Number, as
151 this weighs heavily on what data appears in which version. Each section
152 has its own version number - there's one for Game Information, one for
153 each resource, and a separate one for the format of each resource. Thus
154 you should keep an eye on which version number is being used for that
155 section - and also keep an eye on the scope of that version number.
157 Example of Version Numbers:
158 > GM version needed for the following info (440/600/800)
159 > <440 only> Kind (-1*=None, 0="Wave", 1="Midi", 2="Mp3", 10="Unknown")
160 > <600+> Kind (0=Normal, 1=Background, 2=3D, 3=Multimedia)
161 > <440-600> Preload (1)
163 Here we see something specific to 440, followed by something which only
164 appears in 600 and up (and does not appear in 440), followed by something
165 specific to versions 440 to 600 (and does not appear in 800)
167 When different versions get grouped together, I try to group the older
168 versions first and the newer versions later.
170 Of course, Conditional Insertions aren't solely dependant on a version
171 number. Here's an example of Special Case insertion (one which does not
172 denote how often the data is repeated)
176 <if not -1> Size of Image data { Image Data }
178 This frequently occurs in Sounds and Images. At this time we do not
179 understand why this odd conditional is there - why use 10 instead of 1,
182 Note about Default Values in Parenthesis ()
184 I've also included default values and value ranges to my format
185 documentations, for your convenience. When the default value is not
186 obvious by the format, I will put an asterisk (*) next to it.
188 Here are a few examples of the formats used;
191 (<Lower>-<Upper>,<Default>) e.g. (0-100,10)
192 (<Lower> to <Upper>,<Default>) e.g. (-1 to 100,-1)
193 ([Range,]<Val1>=Name1,<Val2>=Name2[,<Val3>=Name3[,...]]) e.g. (0-2,0*=Yes,1=No,2=Cancel)
195 ----------------------------
196 ---------Base Format--------
197 ----------------------------
199 File format identifier (1234321)
200 Format version (530/600/701/800)
201 Game ID (0-100,000,000, Random*)
203 (16 bytes) These seem to go hand-in-hand with the Game ID, for when they
204 change. Its purpose is unclear. You may just plug in 0's with no apparent
207 GM version needed for Game Settings (530/542/600/702/800)
208 <800+> Length of Zlib Game Settings { Zlib Game Settings }
210 <800+> GM version needed for Triggers (800)
211 <800+> How many Trigger ID's there are (0)
213 Length of ZLib Trigger { ZLib Trigger }
215 <800+> (double) Last time Triggers were changed
217 <800+> GM version needed for Constants (800)
218 <800+> How many Constants there are (0)
220 Length of Name { Name }
221 Length of Value { Value }
223 <800+> (double) Last time Constants were changed
225 <Sounds, Sprites, Backrounds, Paths, Scripts,
226 Fonts, Timelines, Objects, Rooms>
227 GM version needed for Resource (800)
228 How many Resource ID's of this type there are (0)
230 <800+> Length of Zlib Resource { Zlib Resource }
233 ID of last instance placed (100000)
234 ID of last tile placed (1000000)
236 <700+> GM version needed for Included Files (620/800)
237 <620+> How many Included Files there are (0)
239 <620 only> See 'Included Files' in 'Resource Formats', no ZLib compression
240 <800+> Length of ZLib Included File info { ZLib Included File info }
243 <700+> GM version needed for Packages (700)
244 <700+> How many Packages there are (0)
246 Length of Package Name { Package Name }
249 GM version needed for Game Information (430/600/620/800)
250 <800+> Length of Zlib Game Information { Zlib Game Information }
252 GM version needed for the following info (500)
253 How many library dependancies there are (these are stored in the order of
254 the lib's filenames, in alphabetical order. Likewise, they are executed
257 Length of Library Creation Code { Library Creation Code }
260 GM version needed for the following info (500/540/700)
261 How many executable rooms there are (this stores the room indexes in
262 execution order, so you know which room to summon next via
263 room_goto_next() etc.)
265 Room index (in execution order, which is usally the same as the Tree Order)
268 <700+> <12 Root Tree Resources>
269 <500 and 540> <11 Root Tree Resources>
271 Status (1=Primary, 2=Group, 3=Secondary)
272 Grouping (1-13, See "Resource Tree" Documentation below)
277 <Recurse> (See "Resource Tree" Documentation below)
281 <Additional data may be stored at the end of the file and GM will ignore/discard it>
286 ----------------------------
287 ------Resource Formats------
288 ----------------------------
290 <Game Settings (530/542/600/702/800)> {
291 Start in full-screen mode (0)
292 <600+> Interpolate colors between pixels (0)
293 Don't draw a border in windowed mode (0)
294 Display the cursor (1)
295 <530 only> Scale percentage in windowed mode (1-999, 100*)
296 <530 only> Scale percentage in fullscreen mode (0=max) (0-999, 100*)
297 <530 only> Only scale when there is hardware support (1)
298 <542+> Scaling (-1 to 999, -1* = Keep Aspect Ratio, 0 = Full Scale, 1-999 = Fixed Scale)
299 <542+> Allow the player to resize the game window (0)
300 <542+> Let the game window always stay on top (0)
301 <542+> Color outside the room region (0 or 0x00000000)
302 Set the resolution of the screen (0)
303 <530 only> Color Depth (0* = 16-bit, 1 = 32-bit)
304 <530 only> Use exclusive graphics mode (0)
305 <530 only> Resolution (0-6, 0=640x480, 1*=800x600, ..., 5=320x240, 6=No Change)
306 <530 only> Frequency (0-4, 4)
307 <530 only> Wait for a vertical blank before drawing (0)
308 <530 only> Display the caption in full-screen mode (1)
309 <542+> Color Depth (0* = No Change, 1 = 16-bit, 2 = 32-bit)
310 <542+> Resolution (0-6, 0* = No change, ...)
311 <542+> Frequency (0-5, 0* = No change, 1 = 60, ...)
312 Don't show the buttons in the window caption (0)
313 <542+> Use synchronization to avoid tearing (0)
314 <800+> Disable screensavers and power saving actions (1)
315 Let <F4> switch between screen modes (1)
316 Let <F1> show the game information (1)
317 Let <Esc> end the game (1)
318 Let <F5> save the game and <F6> load a game (1)
319 <702+> Let <F9> take a screenshot of the game (1)
320 <702+> Treat the close button as <Esc> key (1)
321 Game Process Priority (0* = Normal, 1 = High, 2 = Highest)
322 <530 only> Reserved (1)
323 <530 only> Reserved (1)
324 Freeze the game when the form looses focus (0)
325 Loading Progress Bar (LPB) (0 = No LPB, 1* = Default LPB, 2 = Own LPB)
328 <530-702 and if not -1> Size of Back Image data { Back Image data (Zlib bitmap) }
330 <530-702 and if not -1> Size of Front Image data { Front Image data (Zlib bitmap) }
331 <800+> Back Image data exists
333 Size of Back Image Data { Back Image data (Zlib bitmap) }
335 <800+> Front Image data exists
337 Size of Front Image Data { Front Image data (Zlib bitmap) }
340 Show your own image while loading (0)
343 <530-702 and if not -1> Size of Image data { Image Data (Zlib bitmap) }
344 <800+> Image data exists
346 Size of Image data { Image data (Zlib bitmap) }
349 Make image partially transparent (0)
350 Make translucent with alpha value (0-255, 255)
351 Scale progress bar image (1)
352 Size of Icon data (2238 in 530-702, 22486 in 800+) { Icon Image Data (raw ICO) }
353 Display error messages (1)
354 Write error messages to file game_errors.log (0)
355 Abort on all error messages (0)
356 Treat uninitialized variables as value 0 (evil!) (0)
357 Length of Author (0) { Author }
358 <530-600> Version (100)
359 <702+> Length of Version (3) { Version ("100") }
360 (double) Last Changed date and time (generated)
361 Length of Information (0) { Information }
362 <530-702> How many Constants there are (0)
364 Length of Name { Name }
365 Length of Value { Value }
367 <542 and 600> How many Include files there are (0)
369 Length of Filename { Filename }
371 <542 and 600> Folder to save Include files to (0* = main, 1 = temp)
372 <542 and 600> Overwrite existing Include files (0)
373 <542 and 600> Remove Include files at game end (0)
378 <702+> Length of Company (0) { Company }
379 <702+> Length of Product (0) { Product }
380 <702+> Length of Copyright (0) { Copyright }
381 <702+> Length of Description (0) { Description }
382 <800+> (double) Last time Global Game Settings were changed
386 Whether Trigger of this ID exists or not
388 GM version needed for the following info (800)
389 Length of Name { Name }
390 Length of Condition { Condition }
391 Moment of Checking (0 = Begin, 1* = Middle, 2 = End)
392 Length of Constant Name { Constant Name }
397 Whether Sound of this ID exists or not
399 Length of Name { Name }
400 <800+> (double) Last time this Sound was changed
401 GM version needed for the following info (440/600/800)
402 <440 only> Kind (-1*=None, 0="Wave", 1="Midi", 2="Mp3", 10="Unknown")
403 <600+> Kind (0=Normal, 1=Background, 2=3D, 3=Multimedia)
404 Length of Filetype { Filetype (like ".wav") }
405 <600+> Length of Filename { Filename (no directory) }
408 <600 only> Size of Music Data { Music Data (original format with Zlib compression) }
409 <800+> Size of Music Data { Music Data (original format uncompressed) }
411 <440 only and Kind is not -1> Size of Music Data { Music Data (original format with Zlib compression) }
412 <440 only> Allow for sound effects (0)
413 <440 only> Buffers (1)
414 <440 only> Load only on use (0)
415 <600+> Effects (Chorus=1, Echo=2, Flanger=4, Gargle=8, Reverb=16)
416 Notice, Effects is actually merged into 1 longint
417 To get the value, simply add active Effect numbers together
418 <600+> (double) Volume (0.0 to 1.0, 1.0*)
419 <600+> (double) Pan (-1.0 to 1.0, 0.0* = center)
425 Whether Sprite of this ID exists or not
427 Length of Name { Name }
428 <800+> (double) Last time this Sprite was changed
429 GM version needed for the following info (400/542/800)
432 <400-542> Left Bounding Box (can be negative)
433 <400-542> Right Bounding Box (can be negative)
434 <400-542> Bottom Bounding Box (can be negative)
435 <400-542> Top Bounding Box (can be negative)
436 <400-542> Transparent (1)
437 <542 only> Smooth Edges (0)
438 <542 only> Preload Texture (1)
439 <400-542> Bounding Box (0*=Automatic, 1=Full image, 2=Manual)
440 <400-542> Precise collision checking (1)
441 <400 only> Use video memory (1)
442 <400 only> Load only on use (0)
445 <400-542> How many subimages there are
448 <if not -1> Size of Image Data { Image Data (Zlib Bitmap) }
450 <800+> How many subimages there are
452 GM version needed for the following info (800)
455 <if Width and Height are not 0> Size of Image data { Image data (raw BGRA) }
457 <800+> Shape (0*=Precise, 1=Rectangle, 2=Disk, 3=Diamond)
458 <800+> Alpha Tolerance (0 to 255, 0)
459 <800+> Separate Collision Masks (0)
460 <800+> Bounding Box (0*=Automatic, 1=Full, 2=Manual)
469 Whether Background of this ID exists or not
471 Length of Name { Name }
472 <800+> (double) Last time this Background was changed
473 GM version needed for the following info (400/543/710)
476 <400-543> Transparent (0)
477 <400 only> Use video memory (1)
478 <400 only> Load only on use (1)
479 <543 only> Smooth Edges (0)
480 <543 only> Preload Texture (0)
481 <543+> Use as tile set (0)
482 <543+> tile width (16)
483 <543+> tile height (16)
484 <543+> horizontal offset (0)
485 <543+> vertical offset (0)
486 <543+> horizontal sep (0)
487 <543+> vertical sep (0)
488 <400-543> Image exists
491 <if not -1> Size of Image data { Image Data (Zlib Bitmap) }
493 <710+> GM version needed for the following info (800)
496 <800+ and Width and Height are not 0> Size of Image data { Image data (raw BGRA) }
501 Whether Path of this ID exists or not
503 Length of Name { Name }
504 <800+> (double) Last time this Path was changed
505 GM version needed for the following info (530)
506 Connection Kind (0* = Straight lines, 1 = Smooth curve)
509 Room Index to show as Background (-1* = none)
512 How many Points there are (0)
522 Whether Script of this ID exists or not
524 Length of Name { Name }
525 <800+> (double) Last time this Script was changed
526 GM version needed for the following info (400/800)
527 Length of Script { Script }
532 Whether Font of this ID exists or not
534 Length of Name { Name }
535 <800+> (double) Last time this Font was changed
536 GM version needed for the following info (540/800)
537 Length of Font Name { Font Name }
541 Character Range Begin (32)
542 Character Range End (127)
547 Whether Time Line of this ID exists or not
549 Length of Name { Name }
550 <800+> (double) Last time this Time Line was changed
551 GM version needed for the following info (500)
552 How many Moments there are (0)
555 Here is where Action information is inserted. This information is
556 exactly the same as it appears in objects. As such, to understand how
557 these bytes work, rather than documenting it twice, I shall refer you
558 to see Actions below, between the **stars**
564 Whether Object of this ID exists or not
566 Length of Name { Name }
567 <800+> (double) Last time this Object was changed
568 GM version needed for the following info (430)
569 Sprite Index (-1* = none)
574 Parent object index (-100* = none)
575 Mask sprite index (-1* = none)
576 How many Event Types there are minus 1 (10 in v400, 11 in v800, unclear why it's off by one)
577 Now we have an interesting thing. We have -1's thrown in for each of the
578 event types. They appear after each event's data (or simply appear where
579 they are if the event type has no data), but the events may have -1's in
580 them too, so you can't just count down -1's and hope to be at the end of
581 the object. No event begins with -1, so if you have a -1 where an event
582 should be, you know that the event has no data. If there is data, it is
583 documented here. If there are multiple kinds (event kind = 'numb' in the
584 GM manual) of the same event, each kind will be added in without a -1
585 appended on the end until the last. The first kind to appear will
586 actually be the highest kind number, and then it will count down. Other
587 than that, Events appear in standard order. The stars ** you will see
588 below relate to Time Lines. See Time Lines for more info.
590 Event Numb (see GM Manual)
591 **GM version needed for the following info (400)
592 How many actions this event has
594 GM version needed for the following info (440)
597 Action Kind (Normal, Begin Group, Else, etc. See Lib Builder)
598 Action may be Relative
600 Action Applies to something
601 Action Type (0=Nothing, 1=Function, 2=Code)
602 Length of Function Name { Function Name }
603 Length of Code { Code }
604 How many Arguments are actually used
605 How many arguments there are (always 8)
607 Argument Kind (See Lib Builder)
609 Applies to Object Index (-1 for Self, -2 for Other)
611 How many arguments there are (always 8)
613 Argument Length { Argument Value }
618 (Don't forget the -1 after each Primary event)
623 Whether room of this ID exists or not
625 Length of Name { Name }
626 <800+> (double) Last time this Room was changed
627 GM version needed for the following info (520/541)
628 Length of Room Caption (0) { Room Caption }
633 Turn the grid into an isometric grid (0)
636 Background Color (12632256 or 0xC0C0C000)
637 Draw background color (1)
638 Length of Creation Code { Creation Code }
639 How many Backgrounds there are (always 8)
641 Visible when room starts (0)
643 Background Image index (-1* = none)
652 Enable the use of Views (0)
653 How many Vies there are (always 8)
655 Visible when room starts (0)
662 <541+> View X (min 0, 0)
663 <541+> View Y (min 0, 0)
664 <541+> View W (min 1, 640)
665 <541+> View H (min 1, 480)
666 <541+> Port X (min 0, 0)
667 <541+> Port Y (min 0, 0)
668 <541+> Port W (min 1, 640)
669 <541+> Port H (min 1, 480)
674 Object following (-1* = none)
676 How many Instances are in the room (0)
681 ID (starts with 100001)
682 Length of Creation Code { Creation Code }
685 How many Tiles are in the room (0)
694 Layer/Depth (1000000)
695 ID (starts with 10000001dec)
698 Remember the Room Editor Info (REI if 0. May be 0 if all settings are defaults)
699 Room Editor Width (646, 0 if REI)
700 Room Editor Height (488, 0 if REI)
701 Toggle the showing of the grid (1, 0 if REI)
702 Show Objects (1, 0 if REI)
703 Show Tiles (1, 0 if REI)
704 Show Backgrounds (1, 0 if REI)
705 Show Foregrounds (1, 0 if REI)
706 Show Views (0, 0 if REI)
707 Delete underlying objects (1, 0 if REI)
708 Delete underlying tiles (1, 0 if REI)
709 <520 only> Tile Width (16)
710 <520 only> Tile Height (16)
711 <520 only> Tile Hsep (1)
712 <520 only> Tile Vsep (1)
713 <520 only> Tile Horizontal Offset (0)
714 <520 only> Tile Vertical Offset (0)
715 Tab (0-4, 0, 0 if REI)
716 0* = objects, 1 settings, 2 tiles, 3 backgrounds, 4 views
717 X Position of the horizontal scrollbar of the Room Editor (0, 0 if REI)
718 Y Position of the vertical scrollbar of the Room Editor (0, 0 if REI)
723 <800+> (double) Last time this Include File was changed
724 GM version needed for the following info (620/800)
725 Length of Filename (0) { Filename }
726 Length of Filepath (0) { Filepath }
727 Whether an Original File is chosen or not
728 Original File Size (0)
729 Store in editable gmk file (0)
731 Length of File Data (0) { File Data }
733 Export (0=Don't, 1=Temp Dir, 2*=Working Dir, 3=Following Folder)
734 Length of Folder To Export To (0) { Folder To Export To }
735 Overwrite the file if it exists (0)
736 Free memory after export (1)
737 Remove at game end (1)
741 Background Color of Game Information (-16777192 or 0x180000FF)
742 <430-620> Mimic the main game window/main form (0)
743 <800+> Show help in a separate window (1)
744 <600+> Length of Form Caption (16) { Form Caption ("Game Information") }
745 <600+> Position Left (-1)
746 <600+> Position Top (-1)
747 <600+> Position Width (600)
748 <600+> Position Height (400)
749 <600+> Show the window border and caption (1)
750 <600+> Allow the player to resize the window (1)
751 <600+> Stay always on top (0)
752 <600+> Stop the game while showing help (1)
753 <800+> (double) Last time Game Information was changed (not including RTF)
754 Length of Game Information RTF (147) { Game Information (Rich Text Format) }
758 ----------------------------
759 -------Resource Tree--------
760 ----------------------------
762 <700+> There are 12 Root Tree Resources - 9 primary, 3 secondary
763 <500 and 540> There are 11 Root Tree Resources - 9 primary, 2 secondary
766 Status, Grouping, Index, Length, { Name }, Contents
768 You repeat that for all things on the resource tree, as they appear,
769 going down, all branches expanded.
774 3) Secondary Resource
776 Grouping (in the order they appear in the file):
782 9) <500> Data Files / <540+> Fonts
787 B) <500> Game Options* / <540+> Global Game Settings*
788 D) <700+> Extension Packages*
789 *Considered Secondary Resources that don't belong in a primary resource group.
793 All Secondary Resources are given an Index, or a reference number, which
794 reflects the index of the resource far above, where you set their
795 properties and options. Primary Resources, Groups, and Game Information
796 and Game Options / Global Game Settings all use 0 for their Index.
797 Occasionally you may find that they will actually use a number other than
798 zero. It is unclear why they would do this, but just keep it in mind.
800 If the index does not reflect their resource number above, you may either
801 get invisible resources, or <undefined> resources. Also, make sure that
802 no two secondary resources under a single Grouping have the same Index.
803 This may result in Duplicate Complex, in which both are dependant on each
804 other and anything you do to one is done to the other.
806 Name Length { Name }:
807 All have a Name Length. After that, it will count out that many bytes for the name itself.
811 All Primary Resources and Groups have Contents count, which is how many
812 groups/secondary resources it has within itself, non-recursive. Secondary
813 Resources always have a content count of 0, since they may never contain
816 Non-recursive means that if a folder has several resources, only that
817 folder is counted. Once it reaches the folder, it will tell how many
818 resources it contains.
820 Let's say you have 5 sprites, but all 5 of them are inside a Group, and
821 that group falls under Sprites. The Sprites Primary Resource has 1
822 content, which is the Group. The Group has 5 contents - the 5 sprites.
825 In an empty file, it would look something like this:
826 1 2 0 7 Sprites 0 1 3 0 6 Sounds 0 etc.
827 In the pacman example that comes with most distributions of GM, it would look like this:
828 1 2 0 7 Sprites 6 2 2 0 7 pacmans 5 3 2 0 8 pac_left 0 3 2 1 9 pac_right 0 3 2 2 6 pac_up 0 3 2 3 8 pac_down 0 3 2 4 9 pac_stand 0 2 2 0 8 monsters 2 etc.
829 This will cause the tree to look like this:
839 Since Primary Resources are included in the save file, you can change
840 their names (and their lengths, as long as you update the longint before
841 their name to reflect the new length) and it will actually display in the
842 resource tree to the left.