aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/Utilities/StructWriter.cs
blob: a537e7a418bd9a12e30f02190b6f6bdcd32d3ebf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using ChocolArm64.Memory;
using System.Runtime.InteropServices;

namespace Ryujinx.HLE.Utilities
{
    class StructWriter
    {
        private MemoryManager Memory;

        public long Position { get; private set; }

        public StructWriter(MemoryManager Memory, long Position)
        {
            this.Memory   = Memory;
            this.Position = Position;
        }

        public void Write<T>(T Value) where T : struct
        {
            MemoryHelper.Write(Memory, Position, Value);

            Position += Marshal.SizeOf<T>();
        }
    }
}