Update ISystemSettingsServer.cs
Implement `GetSettingsItemValue`.
This commit is contained in:
parent
e4f59c8a52
commit
dadd5e8102
1 changed files with 55 additions and 4 deletions
|
@ -19,7 +19,8 @@ namespace Ryujinx.Core.OsHle.Services.Set
|
||||||
{
|
{
|
||||||
{ 4, GetFirmwareVersion2 },
|
{ 4, GetFirmwareVersion2 },
|
||||||
{ 23, GetColorSetId },
|
{ 23, GetColorSetId },
|
||||||
{ 24, SetColorSetId }
|
{ 24, SetColorSetId },
|
||||||
|
{ 38, GetSettingsItemValue }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,5 +84,55 @@ namespace Ryujinx.Core.OsHle.Services.Set
|
||||||
Context.Ns.Settings.ThemeColor = (ColorSet)ColorSetId;
|
Context.Ns.Settings.ThemeColor = (ColorSet)ColorSetId;
|
||||||
return 0;
|
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)
|
||||||
|
{
|
||||||
|
//Ain't be able to test, so we need to know what the size of ReplySize is...
|
||||||
|
//Array.Resize(ref SettingBuffer, StringValue.Length);
|
||||||
|
SettingBuffer = Encoding.ASCII.GetBytes(StringValue);
|
||||||
|
}
|
||||||
|
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.PrintInfo(Logging.LogClass.ServiceSet, $"{AskedSetting} set value: {NxSetting} as {NxSetting.GetType()}");
|
||||||
|
}
|
||||||
|
else Context.Ns.Log.PrintError(Logging.LogClass.ServiceSet, $"{AskedSetting} not found!");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue