Skip to content

Instantly share code, notes, and snippets.

@PoroCYon
Last active February 27, 2016 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PoroCYon/4045acfcad7728b87a0d to your computer and use it in GitHub Desktop.
Save PoroCYon/4045acfcad7728b87a0d to your computer and use it in GitHub Desktop.

THIS IS OUTDATED, USE THE DOCUMENT HERE INSTEAD!

This might already be out-of-date with my findings, the newest code is on the repo. (But I'll try to keep it updated.)

Types (used here)

name size (bytes), other details
bool 4
byte 1
ushort 2
uint 4
int 4
ulong 8
Enum (default size) 4, signed

Anything not defined here can be found on Mirrawrs' site.

ReferenceDef structure

uint NameOffset; // offset to string in STRG
uint OccurrenceCount;
uint FirstAddress;

SoundEntryFlags enum : uint

name value
IsEmbedded 0x01
IsCompressed 0x02
Normal `0x04

RoomEntryFlags enum : uint

name value
EnableViews 0x01
ShowColour 0x02

All empty chunks' lenght is 4, those 4 bytes are all 0.

Form : Chunk (RIFF-like)

Gen8 : Chunk

byte Debug; // 1-byte boolean
Int24 Unknown; // unknown function (0x00000E)
uint FilenameOffset; // offset to string
uint ConfigOffset; // idem
uint LastObj; // possibly offset, not used by my code atm
uint LastTile; // idem
uint GameId;
uint Unknown[4]; // 0, 0, 0, 0
uint NameOffset; // to string
uint Major, Minor, Release, Build; // version stuff
uint DefaultWindowWidth, DefaultWindowHeight;
byte LicenseMD5[0x10]; // the file itself has no checksum or anything
uint LicenseCRC32;
ulong Timestamp; // 64-bit UNIX time
uint DisplayNameOffset; // to string
uint ActiveTargets; // not sure what this is, got it from the original libaltar
uint Unknown[5]; // unknown function (0, 0x00000016, 0, 0xFFFA068C 0x00001966)
uint NumberCount; // amount of weird numbers
uint Numbers[NumberCount]; // weird numbers; starting from 0 up to NumberCount - 1...

Optn : Chunk

uint Unknown[2]; // unknown function (0x80000000 (flags?), 2)
uint Unknown; // unknown, an offset? (to TXTR??)
uint Unknown[0xB]; // 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0
uint Unknown; // unknown function
List<Constant>
{
  uint NameOffset; // to string
  uint ValueOffset; // to string (usually uint (can be ARGB), but possibly a string/..., too)
}

Extn (empty)

Sond : ListChunk<Sound>

uint NameOffset; // offset to string (usually file name without ext.)
SoundEntryFlags Flags;
uint TypeOffset; // offset to string (file extension)
uint FileOffset; // offset to string (file name, including ext.)
uint Unknown; // 0
float Volume; // default volume
float Pitch; // default pitch
float Pan; // probably
int AudioId; // -1 if unused? Only makes sense when embedded?

Agrp (empty)

Sprt : ListChunk<Sprite>

uint NameOffset; // offset to name string
uint Width, Height;
uint Left, Right, Bottom, Top;
uint Unknown[3]; type? coltolerance? htile? vtile? for3D?
uint BBoxMode;
uint SepMasks;
uint OriginX, OriginY;
uint TextureCount;
uint TextureOffset; // to TPAG

Bgnd : ListChunk<Background>

uint NameOffset;
uint Unknown[3]; // 0, 0, 0
uint TextureOffset; // TPAG iirc

Path : ListChunk<Path>

uint NameOffset;
bool IsSmooth;
bool IsClosed;
uint Precision;
uint PointCount;
PathPoint Points[];
{
    float X;
    float Y;
    float Speed;
}

Scpt : ListChunk<Script>

uint NameOffset;
uint CodeId;

Shdr (empty)

Font

uint CodeNameOffset; // name used in GML code
uint SystemNameOffset; // actual font name
uint EmSize;
bool Bold; // | renderhq | italic | includettf?
bool Italic; // renderhq? italic? includettf? ttfname?
ushort RangeStart; // ignore it, use the Characters list
byte Charset;
byte AntiAliasing; // 0 -> off
uint RangeEnd; ; // ignore it, use the Characters list
uint TPagOffset;
float ScaleX, ScaleY;
List<FontChar> Characters
{
  ushort Character; // wchar_t/System.Char
  ushort RelativeX, RelativeY; // relative position to TPAG
  ushort Unknown; // unknown function
  uint Unknown; // unknown function
}

Tmln (empty)

Objt : ListChunk<Object>

uint NameOffset;
uint SpriteIndex; // to SPRT
bool Visible;
bool Solid;
int Depth;
bool Persistent;
int ParentId; // non-existent -> -1
int TextureMaskId; // non-existent -> -1
uint Unknown[3]; // usually 0, 0, 0
ObjectPhysics Physics
{
  float
    Density       ,
    Restitution   ,
    Group         ,
    LinearDamping ,
    AngularDamping,
    Unknown0      ,
    Friction      ,
    Unknown1      ,
    Kinematic;
}
// more floats? sometimes?!?
uint ShapePointCount;
uint ShapePointOffsets; // not sure how formatted

Room : ListChunk<Room>

uint NameOffset;
uint CaptionOffset; // can point to an empty string (usually does), but is not 0
uint Width, Height;
uint Speed;
bool IsPersistent;
uint ARGB;
uint Unknown[2]; // unknown function
RoomEntryFlags Flags;
uint BgOffset, ViewOffset, ObjOffset, TileOffset; // offsets to a List<Room[obj type]> (see below)
uint World;
uint Top;
uint Left;
uint Right;
uint Bottom;
float GravityX, GravityY;
float MetresPerPixel;

Room.Backgrounds : List<RoomBackground>

bool IsEnabled, IsForeground;
uint BgDefIndex;
uint X, Y;
bool TileX, TileY;
uint SpeedX, SpeedY;
bool Stretch;

Room.Views : List<RoomView>

bool IsEnabled;
uint ViewX, ViewY, ViewWidth, ViewHeight;
uint PortX, PortY, PortWidth, PortHeight;
uint BorderX, BorderY;
uint SpeedX, SpeedY;
int ObjectId; // none -> -1

Room.Objects : List<RoomObject>

uint X, Y;
uint BgDefIndex;
uint Unknown; // seems to be a unique ID of some sort
uint Unknown; // -1
float ScaleX, ScaleY;
uint ARGBTint;
float Rotation;

Room.Tiles : List<RoomTile>

uint X, Y;
uint BgDefIndex;
uint SourceX, SourceY;
uint Width, Height;
uint Unknown[2]; // more weird (especially Unknown[0]) unique ID stuff
float ScaleX, ScaleY;
uint ARGBTint;

Dafl (empty)

Tpag : ListChunk<TexturePage>

ushort X, Y;
ushort Width, Height;
ushort RenderOffsetX, RenderOffsetY;
ushot BoundingX, BoundingY, BoundingWidth, BoundingHeight; // bounding box
ushort SpritesheetId;

Code : ListChunk<Code>

uint NameOffset;
int DataLength;
byte Bytecode[DataLength];

Vari : Chunk

ReferenceDef Entries[Chunk.Size / sizeof(ReferenceDef)]; // sizeof(ReferenceDef) == 12

Func : Chunk

ReferenceDef Entries[Chunk.Size / sizeof(ReferenceDef)]; // sizeof(ReferenceDef) == 12

Strg : ListChunk<String>

uint Length;
byte Characters[Length]; // ASCII encoding

Txtr : ListChunk<Spritesheet>

uint Unknown;
uint Offset; // offset to PNG blob

Audo : ListChunk<Audio>

uint Length; // actual data length is 4 + this value
byte Data[Length]; // WAV blob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment