M64
m64 is the movie capture format of
Mupen64,
a Nintendo 64 emulator.
M64 file format description
M64 files consist of a 1024-byte header with various blocks that depend on settings, followed by some input data.
Header format:
000 4-byte signature: 4D 36 34 1A "M64\x1A"
004 4-byte little-endian unsigned int: version number, should be 3
008 4-byte little-endian integer: movie "uid" - identifies the movie-savestate relationship,
also used as the recording time in Unix epoch format
00C 4-byte little-endian unsigned int: number of frames (vertical interrupts)
010 4-byte little-endian unsigned int: rerecord count
014 1-byte unsigned int: frames (vertical interrupts) per second
015 1-byte unsigned int: number of controllers
016 2-byte unsigned int: reserved, should be 0
018 4-byte little-endian unsigned int: number of input samples for any controllers
01C 2-byte unsigned int: movie start type
value 1: movie begins from snapshot (the snapshot will be loaded from an external file
with the movie's filename and a .st extension)
value 2: movie begins from poweron
other values: invalid movie
01E 2-byte unsigned int: reserved, should be 0
020 4-byte unsigned int: controller flags
bit 0: controller 1 present
bit 4: controller 1 has mempak
bit 8: controller 1 has rumblepak
+1..3 for controllers 2..4.
024 160 bytes: reserved, should be 0
0C4 32-byte ASCII string: internal name of ROM used when recording, directly from ROM
0E4 4-byte unsigned int: CRC32 of ROM used when recording, directly from ROM
0E8 2-byte unsigned int: country code of ROM used when recording, directly from ROM
0EA 56 bytes: reserved, should be 0
122 64-byte ASCII string: name of video plugin used when recording, directly from plugin
162 64-byte ASCII string: name of sound plugin used when recording, directly from plugin
1A2 64-byte ASCII string: name of input plugin used when recording, directly from plugin
1E2 64-byte ASCII string: name of rsp plugin used when recording, directly from plugin
222 222-byte UTF-8 string: author's name info
300 256-byte UTF-8 string: author's movie description info
After the header, starting at byte 0x400 in the file, comes the input data. (NOTE: If the version number at 0x004 is 1 or 2, then the input data starts at byte 0x200 instead.) The input data is a stream of 4-byte bitvectors which indicate which buttons and/or analog directions are pressed at each point in time.
They will come in groups of however many controllers the game happens to check (note that it will never check disabled/disconnected controllers), in whatever order the game happens to check them. There is absolutely no way to correlate the amount of input data with the length of the movie, because the N64 may check input many times in 1 frame or it may not check any input at all for a large number of frames, or anything in-between.
Mupen64 will trigger a power off/on reset when the value for the controller info is specifically set to Reserved1 = 0x01, and Reserved2 = 0x01. The controller info is then cleared from being sent to the PIF RAM to avoid errors. This feature is only available in Mupen64 ReRecordingV2 and later versions.
The meaning of each 4-byte value is determined by OR-ing together values for whichever of the following are pressed:
0x000000FF Analog Y (signed, up is positive)
0x0000FF00 Analog X (signed, right is positive)
0x00010000 C-Right
0x00020000 C-Left
0x00040000 C-Down
0x00080000 C-Up
0x00100000 R
0x00200000 L
0x00400000 (reserved)
0x00800000 (reserved)
0x01000000 Digital Pad Right
0x02000000 Digital Pad Left
0x04000000 Digital Pad Down
0x08000000 Digital Pad Up
0x10000000 Start
0x20000000 Z
0x40000000 B
0x80000000 A
See also:
emulator homepages,
frequently asked questions


M64 last edited by
FractalFusion on 2007-11-20 02:03:13
Page info and history | Latest diff | List referrers