mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-30 23:40:15 +00:00
Update ISystemSettingsServer.cs (#107)
* Update ISystemSettingsServer.cs Implement `GetSettingsItemValue`. * Add NxSettings.cs Generated automatically from a Switch 3.0 config file (Tid: 0100000000000818). * Update ISystemSettingsServer.cs * Update ISystemSettingsServer.cs * Update ISystemSettingsServer.cs
This commit is contained in:
parent
e4f59c8a52
commit
211f7f69db
2 changed files with 1776 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
|||
using ChocolArm64.Memory;
|
||||
using ChocolArm64.Memory;
|
||||
using Ryujinx.Core.OsHle.Ipc;
|
||||
using Ryujinx.Core.Settings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
@ -17,9 +18,10 @@ namespace Ryujinx.Core.OsHle.Services.Set
|
|||
{
|
||||
m_Commands = new Dictionary<int, ServiceProcessRequest>()
|
||||
{
|
||||
{ 4, GetFirmwareVersion2 },
|
||||
{ 23, GetColorSetId },
|
||||
{ 24, SetColorSetId }
|
||||
{ 4, GetFirmwareVersion2 },
|
||||
{ 23, GetColorSetId },
|
||||
{ 24, SetColorSetId },
|
||||
{ 38, GetSettingsItemValue }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -83,5 +85,63 @@ namespace Ryujinx.Core.OsHle.Services.Set
|
|||
Context.Ns.Settings.ThemeColor = (ColorSet)ColorSetId;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static long GetSettingsItemValue(ServiceCtx Context)
|
||||
{
|
||||
long ClassPos = Context.Request.PtrBuff[0].Position;
|
||||
long ClassSize = Context.Request.PtrBuff[0].Size;
|
||||
|
||||
long NamePos = Context.Request.PtrBuff[1].Position;
|
||||
long NameSize = Context.Request.PtrBuff[1].Size;
|
||||
|
||||
long ReplyPos = Context.Request.ReceiveBuff[0].Position;
|
||||
long ReplySize = Context.Request.ReceiveBuff[0].Size;
|
||||
|
||||
byte[] Class = AMemoryHelper.ReadBytes(Context.Memory, ClassPos, ClassSize);
|
||||
byte[] Name = AMemoryHelper.ReadBytes(Context.Memory, NamePos, NameSize);
|
||||
|
||||
string AskedSetting = Encoding.ASCII.GetString(Class).Trim('\0') + "!" + Encoding.ASCII.GetString(Name).Trim('\0');
|
||||
|
||||
NxSettings.Settings.TryGetValue(AskedSetting, out object NxSetting);
|
||||
|
||||
if (NxSetting != null)
|
||||
{
|
||||
byte[] SettingBuffer = new byte[ReplySize];
|
||||
|
||||
if (NxSetting is string StringValue)
|
||||
{
|
||||
if (StringValue.Length + 1 > ReplySize)
|
||||
{
|
||||
Context.Ns.Log.PrintError(Logging.LogClass.ServiceSet, $"{AskedSetting} String value size is too big!");
|
||||
}
|
||||
else
|
||||
{
|
||||
SettingBuffer = Encoding.ASCII.GetBytes(StringValue + "\0");
|
||||
}
|
||||
}
|
||||
if (NxSetting is int IntValue)
|
||||
{
|
||||
SettingBuffer = BitConverter.GetBytes(IntValue);
|
||||
}
|
||||
else if (NxSetting is bool BoolValue)
|
||||
{
|
||||
SettingBuffer[0] = BoolValue ? (byte)1 : (byte)0;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException(NxSetting.GetType().Name);
|
||||
}
|
||||
|
||||
AMemoryHelper.WriteBytes(Context.Memory, ReplyPos, SettingBuffer);
|
||||
|
||||
Context.Ns.Log.PrintDebug(Logging.LogClass.ServiceSet, $"{AskedSetting} set value: {NxSetting} as {NxSetting.GetType()}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.Ns.Log.PrintError(Logging.LogClass.ServiceSet, $"{AskedSetting} not found!");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
1711
Ryujinx.Core/OsHle/Services/Set/NxSettings.cs
Normal file
1711
Ryujinx.Core/OsHle/Services/Set/NxSettings.cs
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue