From 305f06eb71a7832e6b0081a67015b66ced8a23cd Mon Sep 17 00:00:00 2001 From: Mary Date: Sat, 24 Apr 2021 12:16:01 +0200 Subject: HLE: Fix integer sign inconcistency accross the codebase (#2222) * Make all title id instances unsigned * Replace address and size with ulong instead of signed types Long overdue change. Also change some logics here and there to optimize with the new memory manager. * Address Ac_K's comments * Remove uneeded cast all around * Fixes some others misalignment --- .../HOS/Services/Nifm/StaticService/IGeneralService.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Ryujinx.HLE/HOS/Services/Nifm/StaticService') diff --git a/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs b/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs index 5f1f9b3a..e650879b 100644 --- a/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs +++ b/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs @@ -29,11 +29,11 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService // GetClientId() -> buffer public ResultCode GetClientId(ServiceCtx context) { - long position = context.Request.RecvListBuff[0].Position; + ulong position = context.Request.RecvListBuff[0].Position; - context.Response.PtrBuff[0] = context.Response.PtrBuff[0].WithSize(4); + context.Response.PtrBuff[0] = context.Response.PtrBuff[0].WithSize(sizeof(int)); - context.Memory.Write((ulong)position, _generalServiceDetail.ClientId); + context.Memory.Write(position, _generalServiceDetail.ClientId); return ResultCode.Success; } @@ -58,7 +58,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService // GetCurrentNetworkProfile() -> buffer public ResultCode GetCurrentNetworkProfile(ServiceCtx context) { - long networkProfileDataPosition = context.Request.RecvListBuff[0].Position; + ulong networkProfileDataPosition = context.Request.RecvListBuff[0].Position; (IPInterfaceProperties interfaceProperties, UnicastIPAddressInformation unicastAddress) = GetLocalInterface(); @@ -69,7 +69,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService Logger.Info?.Print(LogClass.ServiceNifm, $"Console's local IP is \"{unicastAddress.Address}\"."); - context.Response.PtrBuff[0] = context.Response.PtrBuff[0].WithSize(Unsafe.SizeOf()); + context.Response.PtrBuff[0] = context.Response.PtrBuff[0].WithSize((uint)Unsafe.SizeOf()); NetworkProfileData networkProfile = new NetworkProfileData { @@ -81,7 +81,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService Encoding.ASCII.GetBytes("RyujinxNetwork").CopyTo(networkProfile.Name.ToSpan()); - context.Memory.Write((ulong)networkProfileDataPosition, networkProfile); + context.Memory.Write(networkProfileDataPosition, networkProfile); return ResultCode.Success; } @@ -148,10 +148,10 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService // IsAnyInternetRequestAccepted(buffer) -> bool public ResultCode IsAnyInternetRequestAccepted(ServiceCtx context) { - long position = context.Request.PtrBuff[0].Position; - long size = context.Request.PtrBuff[0].Size; + ulong position = context.Request.PtrBuff[0].Position; + ulong size = context.Request.PtrBuff[0].Size; - int clientId = context.Memory.Read((ulong)position); + int clientId = context.Memory.Read(position); context.ResponseData.Write(GeneralServiceManager.Get(clientId).IsAnyInternetRequestAccepted); -- cgit v1.2.3