aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Horizon/Sdk/Settings/System/DeviceNickName.cs
blob: 99c9f98178009a3645abc6fb3c049584ad77cda9 (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 Ryujinx.Common.Memory;
using System.Runtime.InteropServices;
using System.Text;

namespace Ryujinx.Horizon.Sdk.Settings.System
{
    [StructLayout(LayoutKind.Sequential, Size = 0x80)]
    struct DeviceNickName
    {
        public Array128<byte> Value;

        public DeviceNickName(string value)
        {
            int bytesWritten = Encoding.ASCII.GetBytes(value, Value.AsSpan());
            if (bytesWritten < 128)
            {
                Value[bytesWritten] = 0;
            }
            else
            {
                Value[127] = 0;
            }
        }
    }
}