public void LoadStateBinary(System.IO.BinaryReader reader) { int newlen = reader.ReadInt32(); if (newlen > savebuff.Length) { throw new Exception("Unexpected buffer size"); } reader.Read(savebuff, 0, newlen); fixed(byte *ptr = &savebuff[0]) { if (!retro.retro_unserialize((IntPtr)ptr, (uint)newlen)) { throw new Exception("retro_unserialize() failed"); } } // other variables Frame = reader.ReadInt32(); LagCount = reader.ReadInt32(); IsLagFrame = reader.ReadBoolean(); }