diff options
| author | Thomas Guillemard <me@thog.eu> | 2019-10-19 00:47:50 +0200 |
|---|---|---|
| committer | Ac_K <Acoustik666@gmail.com> | 2019-10-19 00:47:50 +0200 |
| commit | 2b5ec23aa747d46e7c9142c14c636e58fa5b5910 (patch) | |
| tree | 5924f613474d5ee03f5b78bd9652b28031272580 /Ryujinx.HLE/HOS/Services/Settings | |
| parent | 8a8ea4c8c00e8ba23349d9cdb0a6b681d09e6b0d (diff) | |
Fix latest version of hbl/hb-menu (#795)
* Fix latest version of hbl/hb-menu
This implement GetSettingsItemValueSize (required by hbl) and
GetInternetConnectionStatus (required by hb-menu).
* Address comments
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Settings')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs b/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs index 490d0e8e..73f437e8 100644 --- a/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs +++ b/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs @@ -103,6 +103,50 @@ namespace Ryujinx.HLE.HOS.Services.Settings return ResultCode.Success; } + [Command(37)] + // GetSettingsItemValueSize(buffer<nn::settings::SettingsName, 0x19>, buffer<nn::settings::SettingsItemKey, 0x19>) -> u64 + public ResultCode GetSettingsItemValueSize(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; + + byte[] Class = context.Memory.ReadBytes(classPos, classSize); + byte[] name = context.Memory.ReadBytes(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) + { + ulong settingSize; + + if (nxSetting is string stringValue) + { + settingSize = (ulong)stringValue.Length + 1; + } + else if (nxSetting is int) + { + settingSize = sizeof(int); + } + else if (nxSetting is bool) + { + settingSize = 1; + } + else + { + throw new NotImplementedException(nxSetting.GetType().Name); + } + + context.ResponseData.Write(settingSize); + } + + return ResultCode.Success; + } + [Command(38)] // GetSettingsItemValue(buffer<nn::settings::SettingsName, 0x19, 0x48>, buffer<nn::settings::SettingsItemKey, 0x19, 0x48>) -> (u64, buffer<unknown, 6, 0>) public ResultCode GetSettingsItemValue(ServiceCtx context) |
