예제 #1
0
        public void LoadStateBinary(BinaryReader reader)
        {
            int length = reader.ReadInt32();

            if (length != _stateBuf.Length)
            {
                throw new InvalidOperationException("Savestate buffer size mismatch!");
            }

            reader.Read(_stateBuf, 0, _stateBuf.Length);

            if (LibSameboy.sameboy_loadstate(SameboyState, _stateBuf, _stateBuf.Length))
            {
                throw new Exception($"{nameof(LibSameboy.sameboy_loadstate)}() returned true");
            }

            // other variables
            IsLagFrame = reader.ReadBoolean();
            LagCount   = reader.ReadInt32();
            Frame      = reader.ReadInt32();
            IsCgb      = reader.ReadBoolean();
            CycleCount = reader.ReadInt64();
            theta      = reader.ReadDouble();
            phi        = reader.ReadDouble();
            theta_prev = reader.ReadDouble();
            phi_prev   = reader.ReadDouble();
            phi_prev_2 = reader.ReadDouble();
        }