public void LoadStateBinary(System.IO.BinaryReader reader) { int newlen = reader.ReadInt32(); if (newlen != savebuff.Length) { throw new Exception("Unexpected state size"); } reader.Read(savebuff, 0, savebuff.Length); if (!LibGPGX.gpgx_state_load(savebuff, savebuff.Length)) { throw new Exception("gpgx_state_load() returned false"); } // other variables Frame = reader.ReadInt32(); LagCount = reader.ReadInt32(); IsLagFrame = reader.ReadBoolean(); update_video(); }