public void SaveStateBinary(BinaryWriter writer) { IntPtr p = IntPtr.Zero; int size = 0; if (!LibmGBA.BizStartGetState(Core, ref p, ref size)) { throw new InvalidOperationException("Core failed to save!"); } if (size != _savebuff.Length) { _savebuff = new byte[size]; } LibmGBA.BizFinishGetState(p, _savebuff, size); writer.Write(_savebuff.Length); writer.Write(_savebuff, 0, _savebuff.Length); // other variables writer.Write(IsLagFrame); writer.Write(LagCount); writer.Write(Frame); }
private void StartSaveStateBinaryInternal() { IntPtr p = IntPtr.Zero; int size = 0; if (!LibmGBA.BizStartGetState(_core, ref p, ref size)) { throw new InvalidOperationException("Core failed to save!"); } if (size != _savebuff.Length) { _savebuff = new byte[size]; _savebuff2 = new byte[size + 13]; } LibmGBA.BizFinishGetState(p, _savebuff, size); }