GMID LFD Resource Type Author: Jagged Fel (jaggedfel621@gmail.com) Site: http://idmr.empirereborn.net Updated: 2009.10.05 ===== The GMID Resource type is special format for MIDI sound files. After a 32-byte header the remaining portion continues in the standard MIDI format. *NOTE* GMID and MIDI data blocks are BIG-ENDIAN in contrast with all other resource types, ie; 0x1234 is stored as 12 34. MIDI also uses a annoying variable-length value storage. Only the bottom 7 bits are used for data, and the last bit is used to signify if another byte is used. 0xC4 (11000100) becomes (10000001 01000100) 0x8148. This method does allow for three-byte data terms, but maxes out at 4 bytes. ===== GMID Structure The following values are used through this and all of my file definitions unless otherwise specified: NAME LENGTH DESC ---- ------ ---- BYTE 1 unsigned 8-bit CHAR 1 ASCII character SHORT 2 signed Int16 INT 4 signed Int32 -- 0x00 Header 0x10 CHAR[4] "MIDI" 0x14 INT MidiLength [Big-endian] 0x18 Unknown MidiHeader MidiData -- struct Header (size 0x10) { 0x0 CHAR[4] "GMID" 0x4 CHAR[8] Name 0xC INT Length } struct Unknown { 0x0 CHAR[4] "MDpg" 0x4 INT Length 0x8 BYTE[Length] } struct MidiHeader (size 0xE) [Big-endian] { 0x0 CHAR[4] "MThd" 0x4 INT HeaderLength (6) 0x8 SHORT FormatType 0xA SHORT NumberOfTracks 0xC SHORT TimeDivison } struct MidiData { 0x0 CHAR[4] "MTrk" 0x4 INT Length 0x8 BYTE[Length] Data } ===== GMID Detail First off, I'm only going to talk about what is called out above, I'm not going to go into the MidiData portion because that's a mess. There are tons of different events in there, all behaving differently, with the stupid variable sizing, and if you really need to know about that stuff you can find it online easy enough. Okay, so once we're beyond the standard Header, we start the data block with what appears to be just another container file. I found no real references on GMID files other than it's something LucasArts cooked up. From what I can tell, you should be able to skip up to the MidiHeader and just start reading from there, exporting into a MIDI file (.smf) and just leaving it at that. Of course, without knowing exactly what it is, I'm hesitant to say you can import at will. =====