Skip to content

Instantly share code, notes, and snippets.

@jam1garner
Created September 15, 2018 15:21
Show Gist options
  • Save jam1garner/e1a911e95cf1325f58ad84f96e8e9541 to your computer and use it in GitHub Desktop.
Save jam1garner/e1a911e95cf1325f58ad84f96e8e9541 to your computer and use it in GitHub Desktop.
Binary Template for GameMaker 2 data files
//------------------------------------------------
//--- 010 Editor v7.0.2 Binary Template
//
// File: Gamemaker 2 Data File
// Authors:
// Version:
// Purpose:
// Category:
// File Mask:
// ID Bytes:
// History:
//------------------------------------------------
LittleEndian();
struct FORM {
char magic[4]; //FORM
uint size; // Size of rest of file
} form;
struct CODE_Entry {
uint name_offset<bgcolor=cYellow>;
uint unk<bgcolor=cLtPurple>;
uint unk<bgcolor=cLtPurple>;
uint unk<bgcolor=cLtPurple>;
uint unk<bgcolor=cLtPurple>;
FSeek(name_offset);
string name<bgcolor=cGreen>;
};
struct CODE {
uint count<bgcolor=cLtBlue>;
uint offsets[count]<bgcolor=cYellow>;
local int i;
for(i = 0; i < count; i++){
FSeek(offsets[i]);
CODE_Entry entries;
}
};
struct SCPT_Entry {
uint name_offset<bgcolor=cYellow>;
uint unk<bgcolor=cLtPurple>;
FSeek(name_offset);
string name<bgcolor=cGreen>;
};
struct SCPT {
uint count<bgcolor=cLtBlue>;
uint offsets[count]<bgcolor=cYellow>;
local int i;
for(i = 0; i < count; i++){
FSeek(offsets[i]);
SCPT_Entry entries;
}
};
struct SOND_Entry {
uint string_offset<bgcolor=cYellow>;
uint unk<bgcolor=cLtPurple>;
uint unk<bgcolor=cLtPurple>;
uint string_offset_again<bgcolor=cLtPurple>;
uint unk<bgcolor=cLtPurple>;
uint unk<bgcolor=cLtPurple>;
uint unk<bgcolor=cLtPurple>;
uint unk<bgcolor=cLtPurple>;
uint unk<bgcolor=cLtPurple>;
};
struct SOND {
uint count<bgcolor=cLtBlue>;
uint offsets[count]<bgcolor=cYellow>;
local int i;
for(i = 0; i < count; i++){
FSeek(offsets[i]);
SOND_Entry entries;
}
};
struct STRING_entry {
uint length<bgcolor=cLtBlue>;
string str<bgcolor=cGreen>;
};
struct STRG {
uint count<bgcolor=cLtBlue>;
uint offsets[count]<bgcolor=cYellow>;
local int i;
for(i = 0; i < count; i++){
FSeek(offsets[i]);
STRING_entry str;
}
};
struct TXTR_entry {
uint unk<bgcolor=cLtPurple>;
uint unk<bgcolor=cLtPurple>;
uint texture_offset<bgcolor=cYellow>;
// Textures are only just seperated by starts?
// I see no length or end offset, so I assume it just
// goes from the start of one to the start of the next
};
struct TXTR {
uint count<bgcolor=cLtBlue>;
uint offsets[count]<bgcolor=cYellow>;
local int i;
for(i = 0; i < count; i++){
FSeek(offsets[i]);
TXTR_entry str;
}
};
struct AUDO_entry {
uint size<bgcolor=cLtBlue>;
byte file[size]<bgcolor=cGreen>;
};
struct AUDO {
uint count<bgcolor=cLtBlue>;
uint offsets[count]<bgcolor=cYellow>;
local int i;
for(i = 0; i < count; i++){
FSeek(offsets[i]);
AUDO_entry audioFile;
}
};
struct FUNC_entry {
uint name_offset<bgcolor=cYellow>;
uint unk<bgcolor=cLtPurple>;
uint unk_offset<bgcolor=cLtPurple>;
local int temp = FTell();
FSeek(name_offset);
string name<bgcolor=cGreen>;
FSeek(temp); // Workaround for "Invalid structure. Ending position
// was in front of starting position" error message
};
struct FUNC {
uint count<bgcolor=cLtBlue>;
FUNC_entry entries[count]<optimize=false>;
};
struct BGND_entry {
uint name_offset<bgcolor=cYellow>;
uint unk<bgcolor=cLtPurple>;
uint unk<bgcolor=cLtPurple>;
uint unk<bgcolor=cLtPurple>;
uint unk_offset<bgcolor=cYellow>;
FSeek(name_offset);
string name;
};
struct BGND {
uint count<bgcolor=cLtBlue>;
uint offsets[count];
local int i;
for(i = 0; i < count; i++){
FSeek(offsets[i]);
BGND_entry background;
}
};
local uint nextPos;
while(!FEof()){
struct SectionHeader {
char magic[4]<bgcolor=cRed>;
uint size<bgcolor=cBlue>;
nextPos = FTell() + size;
if(Strcmp(magic, "CODE") == 0)
CODE code;
if(Strcmp(magic, "SCPT") == 0)
SCPT script;
if(Strcmp(magic, "SOND") == 0)
SOND sounds;
if(Strcmp(magic, "STRG") == 0)
STRG strings;
if(Strcmp(magic, "TXTR") == 0)
TXTR textures;
if(Strcmp(magic, "AUDO") == 0)
AUDO audio;
if(Strcmp(magic, "FUNC") == 0)
FUNC functions;
if(Strcmp(magic, "BGND") == 0)
BGND backgrounds;
} section;
FSeek(nextPos);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment