1. Architectural Role & Engine Purpose
The AFP-AVI (Audio File Packet / Audio-Video Interleaved) format streams pre-rendered cinematic cutscenes, the dramatic opening mission insertion videos, and mission debriefings in Project I.G.I. 1.
Innerloop developed a lightweight software video decompressor tuned for Intel MMX instructions. Audio and video frames are interleaved sequentially, allowing smooth 30 FPS playback from CD-ROM drives directly into DirectDraw hardware surfaces with zero frame-dropping.
2. Binary File Layout & Memory Map Diagram
An AFP-AVI file contains a master stream header followed by interleaved video and audio chunks:
3. Video Decompression & DirectDraw Presentation Pipeline Diagram
The streaming engine reads interleaved packets asynchronously into a circular ring buffer:
4. Architectural Mechanics & Engine Implementation Details
Innerloop designed the video player to avoid external codec dependencies:
- Zero Codec Hell: Unlike games relying on Windows Media Player or third-party VFW codecs, IGI 1 embedded its custom decompressor directly into
IGI.EXE, guaranteeing 100% reliable cutscene playback across all Windows installations. - Audio Master Clock: Playback is synchronized against the hardware sound card sample clock. If the CPU experiences temporary frame drops, video frames are dropped gracefully while audio remains unbroken.
5. C++ Struct Definitions
#pragma pack(push, 1)
struct AfpHeader {
char magic[4]; // "AFP " or "RIFF"
uint32_t file_size; // Size
uint32_t frame_count; // Total video frames
uint16_t fps; // Frames per second (e.g., 30)
uint16_t width; // Video width (640)
uint16_t height; // Video height (480)
uint16_t audio_channels; // 2 = Stereo
uint32_t audio_rate; // 44100 Hz
uint32_t flags; // Codec flags
};
static_assert(sizeof(AfpHeader) == 28, "AfpHeader must be 28 bytes");
#pragma pack(pop)