mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-06-28 07:09:05 +00:00
Memory Changes part 2 (ryubing/ryujinx!123)
See merge request ryubing/ryujinx!123
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Ryujinx.Common.Memory;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
@@ -19,20 +20,24 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.Types
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
Span<NodeLatestUpdate> arraySpan = array.AsSpan();
|
||||
Span<NodeInfo> beforeNodesSpan = beforeNodes.AsSpan();
|
||||
Span<NodeInfo> afterNodesSpan = afterNodes.AsSpan();
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (beforeNodes[i].IsConnected == 0)
|
||||
if (beforeNodesSpan[i].IsConnected == 0)
|
||||
{
|
||||
if (afterNodes[i].IsConnected != 0)
|
||||
if (afterNodesSpan[i].IsConnected != 0)
|
||||
{
|
||||
array[i].State |= NodeLatestUpdateFlags.Connect;
|
||||
arraySpan[i].State |= NodeLatestUpdateFlags.Connect;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (afterNodes[i].IsConnected == 0)
|
||||
if (afterNodesSpan[i].IsConnected == 0)
|
||||
{
|
||||
array[i].State |= NodeLatestUpdateFlags.Disconnect;
|
||||
arraySpan[i].State |= NodeLatestUpdateFlags.Disconnect;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,14 +50,16 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.Types
|
||||
|
||||
lock (_lock)
|
||||
{
|
||||
Span<NodeLatestUpdate> arraySpan = array.AsSpan();
|
||||
|
||||
for (int i = 0; i < number; i++)
|
||||
{
|
||||
result[i].Reserved = new Array7<byte>();
|
||||
|
||||
if (i < LdnConst.NodeCountMax)
|
||||
{
|
||||
result[i].State = array[i].State;
|
||||
array[i].State = NodeLatestUpdateFlags.None;
|
||||
result[i].State = arraySpan[i].State;
|
||||
arraySpan[i].State = NodeLatestUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,9 +77,11 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
|
||||
},
|
||||
};
|
||||
|
||||
Span<NodeInfo> nodesSpan = networkInfo.Ldn.Nodes.AsSpan();
|
||||
|
||||
for (int i = 0; i < LdnConst.NodeCountMax; i++)
|
||||
{
|
||||
networkInfo.Ldn.Nodes[i] = new NodeInfo
|
||||
nodesSpan[i] = new NodeInfo
|
||||
{
|
||||
MacAddress = new Array6<byte>(),
|
||||
UserName = new Array33<byte>(),
|
||||
@@ -229,11 +231,13 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
|
||||
NetworkInfo.Common.Ssid = _fakeSsid;
|
||||
|
||||
NetworkInfo.Ldn.Nodes = new Array8<NodeInfo>();
|
||||
|
||||
Span<NodeInfo> nodesSpan = NetworkInfo.Ldn.Nodes.AsSpan();
|
||||
|
||||
for (int i = 0; i < LdnConst.NodeCountMax; i++)
|
||||
{
|
||||
NetworkInfo.Ldn.Nodes[i].NodeId = (byte)i;
|
||||
NetworkInfo.Ldn.Nodes[i].IsConnected = 0;
|
||||
nodesSpan[i].NodeId = (byte)i;
|
||||
nodesSpan[i].IsConnected = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -408,11 +412,11 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
|
||||
|
||||
private int LocateEmptyNode()
|
||||
{
|
||||
Array8<NodeInfo> nodes = NetworkInfo.Ldn.Nodes;
|
||||
Span<NodeInfo> nodesSpan = NetworkInfo.Ldn.Nodes.AsSpan();
|
||||
|
||||
for (int i = 1; i < nodes.Length; i++)
|
||||
for (int i = 1; i < nodesSpan.Length; i++)
|
||||
{
|
||||
if (nodes[i].IsConnected == 0)
|
||||
if (nodesSpan[i].IsConnected == 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user