From MultimediaWiki
Jump to navigation Jump to search

M95 files are FMV files used in the game Cyberia 2: Resurrection. Quite predictably, M95 files are an extension of the C93 FMV files found on the predecessor game, Cyberia. M95 files can use all of the coding modes present in C93 and adds several new modes. The frame layout is also revised. Please refer to the original C93 description for more details on that original format, as this page covers only changes between C93 and M95.

File Stucture

Multi-byte numbers are little endian. The contents table remains the same as in C93, but holds 1024 records vs. 512.

The frame descriptor, however, is greatly changed (all offsets are relative to the block):

4 bytes   frame_offset[14] - offset of the particular frame
4 bytes   unk_offset_1     - points to something after palette, useless (?)
4 bytes   unknown
4 bytes   sound_offset     - offset of the sound portion
12 bytes  unknown
4 bytes   palette_offset   - offset of the palette
4 bytes   unk_offset_2     - 
4 bytes   unk_offset_3     - both fields, when non-zero, also offsets of something

Sound is stored as a complete WAV file. The palette begins with a byte indicating which (in-block) frame number it belongs to, and is followed by 256 BGR triplets.

Video Compression

Before proceeding to the decoding, read a 2-byte value from the stream. If it is non-zero, perform extra dictionary unpacking, located at offset (frame + value). Then continue frame decoding. The dictionary contains a variable number of 8x8 blocks packed using a simple LZ-like algorithm. To decompress:

  read 16-bit tag value
  for each bit of tag (low to high)
    if bit is set
      output = next byte of the stream
      offset = 10 bits of the stream
      count = next 6 bits of the stream + 3
      if offset is zero
        finish the unpacking
        output count bytes located at output - offset

New video compression modes, in addition to the methods supported in C93:

Mode 1

Read 8 color bytes from the stream. Paint pixels by reading 3 bits from the stream and selecting one of 8 colors as indexed by these bits.

Mode 3

Copy 8x8 block from the previous frame.

Mode 4

Paint next 8x8 pixels from the dictionary.

Mode 9

Motion block. For each 2x2 subblock read 4 bits of x delta, then 4 bits of y delta. The deltas are 4-bit 2s complement signed quantities; if bit 3 of delta is set, then delta = delta - 16. Copy subblock from the previous frame shifted by that delta relatively current position.

Mode C

Same as mode 9, but operating 4x4 subblocks.