Skip to content

Instantly share code, notes, and snippets.

@maxton
Created February 7, 2018 18:43
Show Gist options
  • Save maxton/e85e56a3a1d74ef04eed398320e8286f to your computer and use it in GitHub Desktop.
Save maxton/e85e56a3a1d74ef04eed398320e8286f to your computer and use it in GitHub Desktop.
Guitar Hero Live XMK 010 Editor Template
BigEndian();
typedef struct {
int version;
int checksum;
uint numEvents;
uint stringTableSize;
uint unk1;
uint numChunks;
uint numTimeSigs;
uint unk3;
} XmkHdr;
typedef struct {
float start;
uint tempo;
uint unk;
} XmkTempo;
typedef struct {
uint unk;
ushort unk1;
byte unk2;
byte midi_note;
float start_time;
float end_time;
uint unk3;
uint string_offset;
} XmkEvent<read=EVENT>;
// Xmk File structure begins here
XmkHdr hdr;
XmkTempo tempo_map[hdr.numChunks];
int time_signatures[4 * hdr.numTimeSigs - 1];
XmkEvent midi_events[hdr.numEvents];
char stringTable[hdr.stringTableSize];
// Xmk File Structure ends here
// Function for reading the text content of a midi event
string EVENT(XmkEvent& l) {
local int offset = l.string_offset - sizeof(XmkEvent) * hdr.numEvents;
local char c[128];
c[0] = '\0';
if(offset >= 0) {
Memcpy(c, stringTable, 128, 0, offset);
}
return c;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment