switched to GPLv3 ONLY, because i don't trust FSF anymore
[gaemu.git] / dox / gmformat8.txt
blob9a8d39ae4d611e6148cf259f610f9c416e3bbad3
1 ----------------------------
2 --------Introduction--------
3 ----------------------------
5 Binary Format of GameMaker 8 Files (gmk)
6 Copyright (c) 2008, 2009 IsmAvatar <IsmAvatar@gmail.com>
8 License:
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.
13 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
20 THIS DOCUMENT.
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
27 Note About Legality:
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.
41 Mark"
43 Note About Version:
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)
61 * 430 for GM4.3
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
66 below.
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 ...
106 or just 00 ...
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
119   Object exists
120   {
121   Object ID
122   }
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
127 format is.
129   Example of repetition
130   Number of Objects
131   {
132   View ID
133   }
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)
174 10 or -1
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,
180 and -1 instead of 0?
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;
190 (<Default>) e.g. (0)
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
205 effects.
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
255 in this same order)
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)
273  Index
274  Name Length { Name }
275  Contents
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>
283 <End Of File>
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)
326  <if LPB = 2> {
327   <530-702> 10 or -1
328   <530-702 and if not -1> Size of Back Image data { Back Image data (Zlib bitmap) }
329   <530-702> 10 or -1
330   <530-702 and if not -1> Size of Front Image data { Front Image data (Zlib bitmap) }
331   <800+> Back Image data exists
332   {
333    Size of Back Image Data { Back Image data (Zlib bitmap) }
334   }
335   <800+> Front Image data exists
336   {
337    Size of Front Image Data { Front Image data (Zlib bitmap) }
338   }
340  Show your own image while loading (0)
342   <530-702> 10 or -1
343   <530-702 and if not -1> Size of Image data { Image Data (Zlib bitmap) }
344   <800+> Image data exists
345   {
346    Size of Image data { Image data (Zlib bitmap) }
347   }
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)
374  <702+> Major (1)
375  <702+> Minor (0)
376  <702+> Release (0)
377  <702+> Build (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
385 <Triggers> {
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 }
396 <Sounds> {
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) }
406   <600+> Music exists
407   {
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) }
410   }
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)
420   <600+> Preload (1)
424 <Sprites> {
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)
430   <400-542> Width
431   <400-542> Height
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)
443   X Origin (0)
444   Y Origin (0)
445   <400-542> How many subimages there are
446   {
447    10 or -1
448    <if not -1> Size of Image Data { Image Data (Zlib Bitmap) }
449   }
450   <800+> How many subimages there are
451   {
452    GM version needed for the following info (800)
453    Width
454    Height
455    <if Width and Height are not 0> Size of Image data { Image data (raw BGRA) }
456   }
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)
461   <800+> Left (0)
462   <800+> Right
463   <800+> Bottom
464   <800+> Top (0)
468 <Backgrounds> {
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)
474   <400-543> Width
475   <400-543> Height
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
489   {
490    10 or -1
491    <if not -1> Size of Image data { Image Data (Zlib Bitmap) }
492   }
493   <710+> GM version needed for the following info (800)
494   <800+> Width (0)
495   <800+> Height (0)
496   <800+ and Width and Height are not 0> Size of Image data { Image data (raw BGRA) }
500 <Paths> {
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)
507   Closed (1)
508   Precision (1-8, 4)
509   Room Index to show as Background (-1* = none)
510   Snap X (16)
511   Snap Y (16)
512   How many Points there are (0)
513   {
514    (double) X
515    (double) Y
516    (double) Speed
517   }
521 <Scripts> {
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 }
531 <Fonts> {
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 }
538   Size (12)
539   Bold (0)
540   Italic (0)
541   Character Range Begin (32)
542   Character Range End (127)
546 <Time Lines> {
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)
553   {
554    Moment position
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**
559   }
563 <Objects> {
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)
570   Solid (0)
571   Visible (1)
572   Depth (0)
573   Persistent (0)
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.
589   {
590    Event Numb (see GM Manual)
591    **GM version needed for the following info (400)
592    How many actions this event has
593    {
594     GM version needed for the following info (440)
595     Library ID
596     Action ID
597     Action Kind (Normal, Begin Group, Else, etc. See Lib Builder)
598     Action may be Relative
599     Action is a Question
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)
606     {
607      Argument Kind (See Lib Builder)
608     }
609     Applies to Object Index (-1 for Self, -2 for Other)
610     Relative
611     How many arguments there are (always 8)
612     {
613      Argument Length { Argument Value }
614     }
615     NOT
616    }**
617   }
618   (Don't forget the -1 after each Primary event)
622 <Rooms> {
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 }
629   Width (640)
630   Height (480)
631   Snap Y (16)
632   Snap X (16)
633   Turn the grid into an isometric grid (0)
634   Speed (30)
635   Persistent (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)
640   {
641    Visible when room starts (0)
642    Foreground Image (0)
643    Background Image index (-1* = none)
644    X (0)
645    Y (0)
646    Tile Hor. (1)
647    Tile Vert. (1)
648    Hor. Speed (0)
649    Vert. Speed (0)
650    Stretch (0)
651   }
652   Enable the use of Views (0)
653   How many Vies there are (always 8)
654   {
655    Visible when room starts (0)
656    <520 only> Left
657    <520 only> Top
658    <520 only> Width
659    <520 only> Height
660    <520 only> X
661    <520 only> Y
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)
670    Hbor (min 0, 32)
671    Vbor (min 0, 32)
672    Hsp (min -1*)
673    Vsp (min -1*)
674    Object following (-1* = none)
675   }
676   How many Instances are in the room (0)
677   {
678    X
679    Y
680    Object Index
681    ID (starts with 100001)
682    Length of Creation Code { Creation Code }
683    Locked
684   }
685   How many Tiles are in the room (0)
686   {
687    X
688    Y
689    Background Index
690    TileX
691    TileY
692    Width
693    Height
694    Layer/Depth (1000000)
695    ID (starts with 10000001dec)
696    Locked
697   }
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)
722 <Included Files> {
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)
740 <Game Information> {
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
765 Format:
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.
771 Status:
772 1) Primary Resource
773 2) Group
774 3) Secondary Resource
776 Grouping (in the order they appear in the file):
777 2) Sprites
778 3) Sounds
779 6) Backgrounds
780 8) Paths
781 7) Scripts
782 9) <500> Data Files / <540+> Fonts
783 C) Time Lines
784 1) Objects
785 4) Rooms
786 A) Game Information*
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.
791 Index:
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.
809 Contents:
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
814 anything.
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:
830 +Sprites
831  -pacmans
832   []pac_left
833   []pac_right
834   []pac_up
835   []pac_down
836   []pac_stand
837  -monsters (etc...)
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.
844 --End--