Memory Changes part 2 (ryubing/ryujinx!123)

See merge request ryubing/ryujinx!123
This commit is contained in:
LotP
2025-08-25 17:44:15 -05:00
parent d499449f57
commit 50ab108ee1
90 changed files with 2133 additions and 1159 deletions

View File

@@ -30,21 +30,21 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Types
{
Port = IPAddress.HostToNetworkOrder(Port);
RawIpv4AddressNetworkEndianSwap(ref Address);
RawIpv4AddressNetworkEndianSwap(Address.AsSpan());
}
public void ToHostOrder()
{
Port = IPAddress.NetworkToHostOrder(Port);
RawIpv4AddressNetworkEndianSwap(ref Address);
RawIpv4AddressNetworkEndianSwap(Address.AsSpan());
}
public static void RawIpv4AddressNetworkEndianSwap(ref Array4<byte> address)
public static void RawIpv4AddressNetworkEndianSwap(Span<byte> address)
{
if (BitConverter.IsLittleEndian)
{
address.AsSpan().Reverse();
address.Reverse();
}
}
}

View File

@@ -73,7 +73,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Types
{
// Nintendo hardcode 4 bytes in that case here.
Array4<byte> address = MemoryMarshal.Read<Array4<byte>>(buffer);
AddrInfo4.RawIpv4AddressNetworkEndianSwap(ref address);
AddrInfo4.RawIpv4AddressNetworkEndianSwap(address.AsSpan());
rawIPv4Address = address;
@@ -115,7 +115,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Types
else
{
Array4<byte> rawIPv4Address = RawIPv4Address.Value;
AddrInfo4.RawIpv4AddressNetworkEndianSwap(ref rawIPv4Address);
AddrInfo4.RawIpv4AddressNetworkEndianSwap(rawIPv4Address.AsSpan());
MemoryMarshal.Write(buffer, in rawIPv4Address);