aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/Utilities/StructWriter.cs
blob: 8b88105c6a7c2c80366da23d83e24625786c519e (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 AMemory Memory;

        public long Position { get; private set; }

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

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

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