mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-20 17:51:13 +02:00
misc: chore: Fix possible NullReferenceExceptions, suppress warnings
This commit is contained in:
@@ -316,7 +316,7 @@ namespace ARMeilleure.Translation
|
|||||||
{
|
{
|
||||||
_root = newNode;
|
_root = newNode;
|
||||||
}
|
}
|
||||||
else if (start.CompareTo(parent.Start) < 0)
|
else if (start.CompareTo(parent!.Start) < 0)
|
||||||
{
|
{
|
||||||
parent.Left = newNode;
|
parent.Left = newNode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ namespace Ryujinx.Audio.Backends.SoundIo
|
|||||||
{
|
{
|
||||||
for (int frame = 0; frame < frameCount; frame++)
|
for (int frame = 0; frame < frameCount; frame++)
|
||||||
{
|
{
|
||||||
((byte*)area.Pointer)[0] = srcptr[frame * bytesPerFrame];
|
(((byte*)area.Pointer)!)[0] = srcptr[frame * bytesPerFrame];
|
||||||
|
|
||||||
area.Pointer += area.Step;
|
area.Pointer += area.Step;
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ namespace Ryujinx.Audio.Backends.SoundIo
|
|||||||
{
|
{
|
||||||
for (int frame = 0; frame < frameCount; frame++)
|
for (int frame = 0; frame < frameCount; frame++)
|
||||||
{
|
{
|
||||||
((short*)area.Pointer)[0] = ((short*)srcptr)[frame * bytesPerFrame >> 1];
|
(((short*)area.Pointer)!)[0] = ((short*)srcptr)[frame * bytesPerFrame >> 1];
|
||||||
|
|
||||||
area.Pointer += area.Step;
|
area.Pointer += area.Step;
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ namespace Ryujinx.Audio.Backends.SoundIo
|
|||||||
{
|
{
|
||||||
for (int frame = 0; frame < frameCount; frame++)
|
for (int frame = 0; frame < frameCount; frame++)
|
||||||
{
|
{
|
||||||
((int*)area.Pointer)[0] = ((int*)srcptr)[frame * bytesPerFrame >> 2];
|
(((int*)area.Pointer)!)[0] = ((int*)srcptr)[frame * bytesPerFrame >> 2];
|
||||||
|
|
||||||
area.Pointer += area.Step;
|
area.Pointer += area.Step;
|
||||||
}
|
}
|
||||||
@@ -190,10 +190,10 @@ namespace Ryujinx.Audio.Backends.SoundIo
|
|||||||
for (int frame = 0; frame < frameCount; frame++)
|
for (int frame = 0; frame < frameCount; frame++)
|
||||||
{
|
{
|
||||||
// Channel 1
|
// Channel 1
|
||||||
((byte*)area1.Pointer)[0] = srcptr[(frame * bytesPerFrame) + 0];
|
(((byte*)area1.Pointer)!)[0] = srcptr[(frame * bytesPerFrame) + 0];
|
||||||
|
|
||||||
// Channel 2
|
// Channel 2
|
||||||
((byte*)area2.Pointer)[0] = srcptr[(frame * bytesPerFrame) + 1];
|
(((byte*)area2.Pointer)!)[0] = srcptr[(frame * bytesPerFrame) + 1];
|
||||||
|
|
||||||
area1.Pointer += area1.Step;
|
area1.Pointer += area1.Step;
|
||||||
area2.Pointer += area2.Step;
|
area2.Pointer += area2.Step;
|
||||||
@@ -204,10 +204,10 @@ namespace Ryujinx.Audio.Backends.SoundIo
|
|||||||
for (int frame = 0; frame < frameCount; frame++)
|
for (int frame = 0; frame < frameCount; frame++)
|
||||||
{
|
{
|
||||||
// Channel 1
|
// Channel 1
|
||||||
((short*)area1.Pointer)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 0];
|
(((short*)area1.Pointer)!)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 0];
|
||||||
|
|
||||||
// Channel 2
|
// Channel 2
|
||||||
((short*)area2.Pointer)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 1];
|
(((short*)area2.Pointer)!)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 1];
|
||||||
|
|
||||||
area1.Pointer += area1.Step;
|
area1.Pointer += area1.Step;
|
||||||
area2.Pointer += area2.Step;
|
area2.Pointer += area2.Step;
|
||||||
@@ -218,10 +218,10 @@ namespace Ryujinx.Audio.Backends.SoundIo
|
|||||||
for (int frame = 0; frame < frameCount; frame++)
|
for (int frame = 0; frame < frameCount; frame++)
|
||||||
{
|
{
|
||||||
// Channel 1
|
// Channel 1
|
||||||
((int*)area1.Pointer)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 0];
|
(((int*)area1.Pointer)!)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 0];
|
||||||
|
|
||||||
// Channel 2
|
// Channel 2
|
||||||
((int*)area2.Pointer)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 1];
|
(((int*)area2.Pointer)!)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 1];
|
||||||
|
|
||||||
area1.Pointer += area1.Step;
|
area1.Pointer += area1.Step;
|
||||||
area2.Pointer += area2.Step;
|
area2.Pointer += area2.Step;
|
||||||
@@ -260,22 +260,22 @@ namespace Ryujinx.Audio.Backends.SoundIo
|
|||||||
for (int frame = 0; frame < frameCount; frame++)
|
for (int frame = 0; frame < frameCount; frame++)
|
||||||
{
|
{
|
||||||
// Channel 1
|
// Channel 1
|
||||||
((byte*)area1.Pointer)[0] = srcptr[(frame * bytesPerFrame) + 0];
|
(((byte*)area1.Pointer)!)[0] = srcptr[(frame * bytesPerFrame) + 0];
|
||||||
|
|
||||||
// Channel 2
|
// Channel 2
|
||||||
((byte*)area2.Pointer)[0] = srcptr[(frame * bytesPerFrame) + 1];
|
(((byte*)area2.Pointer)!)[0] = srcptr[(frame * bytesPerFrame) + 1];
|
||||||
|
|
||||||
// Channel 3
|
// Channel 3
|
||||||
((byte*)area3.Pointer)[0] = srcptr[(frame * bytesPerFrame) + 2];
|
(((byte*)area3.Pointer)!)[0] = srcptr[(frame * bytesPerFrame) + 2];
|
||||||
|
|
||||||
// Channel 4
|
// Channel 4
|
||||||
((byte*)area4.Pointer)[0] = srcptr[(frame * bytesPerFrame) + 3];
|
(((byte*)area4.Pointer)!)[0] = srcptr[(frame * bytesPerFrame) + 3];
|
||||||
|
|
||||||
// Channel 5
|
// Channel 5
|
||||||
((byte*)area5.Pointer)[0] = srcptr[(frame * bytesPerFrame) + 4];
|
(((byte*)area5.Pointer)!)[0] = srcptr[(frame * bytesPerFrame) + 4];
|
||||||
|
|
||||||
// Channel 6
|
// Channel 6
|
||||||
((byte*)area6.Pointer)[0] = srcptr[(frame * bytesPerFrame) + 5];
|
(((byte*)area6.Pointer)!)[0] = srcptr[(frame * bytesPerFrame) + 5];
|
||||||
|
|
||||||
area1.Pointer += area1.Step;
|
area1.Pointer += area1.Step;
|
||||||
area2.Pointer += area2.Step;
|
area2.Pointer += area2.Step;
|
||||||
@@ -290,22 +290,22 @@ namespace Ryujinx.Audio.Backends.SoundIo
|
|||||||
for (int frame = 0; frame < frameCount; frame++)
|
for (int frame = 0; frame < frameCount; frame++)
|
||||||
{
|
{
|
||||||
// Channel 1
|
// Channel 1
|
||||||
((short*)area1.Pointer)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 0];
|
(((short*)area1.Pointer)!)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 0];
|
||||||
|
|
||||||
// Channel 2
|
// Channel 2
|
||||||
((short*)area2.Pointer)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 1];
|
(((short*)area2.Pointer)!)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 1];
|
||||||
|
|
||||||
// Channel 3
|
// Channel 3
|
||||||
((short*)area3.Pointer)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 2];
|
(((short*)area3.Pointer)!)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 2];
|
||||||
|
|
||||||
// Channel 4
|
// Channel 4
|
||||||
((short*)area4.Pointer)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 3];
|
(((short*)area4.Pointer)!)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 3];
|
||||||
|
|
||||||
// Channel 5
|
// Channel 5
|
||||||
((short*)area5.Pointer)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 4];
|
(((short*)area5.Pointer)!)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 4];
|
||||||
|
|
||||||
// Channel 6
|
// Channel 6
|
||||||
((short*)area6.Pointer)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 5];
|
(((short*)area6.Pointer)!)[0] = ((short*)srcptr)[(frame * bytesPerFrame >> 1) + 5];
|
||||||
|
|
||||||
area1.Pointer += area1.Step;
|
area1.Pointer += area1.Step;
|
||||||
area2.Pointer += area2.Step;
|
area2.Pointer += area2.Step;
|
||||||
@@ -320,22 +320,22 @@ namespace Ryujinx.Audio.Backends.SoundIo
|
|||||||
for (int frame = 0; frame < frameCount; frame++)
|
for (int frame = 0; frame < frameCount; frame++)
|
||||||
{
|
{
|
||||||
// Channel 1
|
// Channel 1
|
||||||
((int*)area1.Pointer)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 0];
|
(((int*)area1.Pointer)!)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 0];
|
||||||
|
|
||||||
// Channel 2
|
// Channel 2
|
||||||
((int*)area2.Pointer)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 1];
|
(((int*)area2.Pointer)!)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 1];
|
||||||
|
|
||||||
// Channel 3
|
// Channel 3
|
||||||
((int*)area3.Pointer)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 2];
|
(((int*)area3.Pointer)!)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 2];
|
||||||
|
|
||||||
// Channel 4
|
// Channel 4
|
||||||
((int*)area4.Pointer)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 3];
|
(((int*)area4.Pointer)!)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 3];
|
||||||
|
|
||||||
// Channel 5
|
// Channel 5
|
||||||
((int*)area5.Pointer)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 4];
|
(((int*)area5.Pointer)!)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 4];
|
||||||
|
|
||||||
// Channel 6
|
// Channel 6
|
||||||
((int*)area6.Pointer)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 5];
|
(((int*)area6.Pointer)!)[0] = ((int*)srcptr)[(frame * bytesPerFrame >> 2) + 5];
|
||||||
|
|
||||||
area1.Pointer += area1.Step;
|
area1.Pointer += area1.Step;
|
||||||
area2.Pointer += area2.Step;
|
area2.Pointer += area2.Step;
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
// Entry is a block but is not aligned, we need to turn it into a table.
|
// Entry is a block but is not aligned, we need to turn it into a table.
|
||||||
ref ulong pte = ref level.AsSpan()[l];
|
ref ulong pte = ref level.AsSpan()[l];
|
||||||
nextTable = CreateTable(pte, depth + 1);
|
nextTable = CreateTable(pte, depth + 1);
|
||||||
level.Next[l] = nextTable;
|
level.Next?[l] = nextTable;
|
||||||
|
|
||||||
// Now that we have a table, we can handle it like the first case.
|
// Now that we have a table, we can handle it like the first case.
|
||||||
UnmapImpl(nextTable, depth + 1, va, chunckSize);
|
UnmapImpl(nextTable, depth + 1, va, chunckSize);
|
||||||
@@ -166,7 +166,7 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
if (nextTable != null)
|
if (nextTable != null)
|
||||||
{
|
{
|
||||||
nextTable.Allocation.Dispose();
|
nextTable.Allocation.Dispose();
|
||||||
level.Next[l] = null;
|
level.Next?[l] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
level.AsSpan()[l] = 0UL;
|
level.AsSpan()[l] = 0UL;
|
||||||
@@ -215,7 +215,7 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
{
|
{
|
||||||
// Entry is a block but is not aligned, we need to turn it into a table.
|
// Entry is a block but is not aligned, we need to turn it into a table.
|
||||||
nextTable = CreateTable(pte, depth + 1);
|
nextTable = CreateTable(pte, depth + 1);
|
||||||
level.Next[l] = nextTable;
|
level.Next?[l] = nextTable;
|
||||||
|
|
||||||
// Now that we have a table, we can handle it like the first case.
|
// Now that we have a table, we can handle it like the first case.
|
||||||
UpdateAttributes(nextTable, depth + 1, va, chunckSize, newAttr);
|
UpdateAttributes(nextTable, depth + 1, va, chunckSize, newAttr);
|
||||||
|
|||||||
@@ -225,10 +225,15 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
|||||||
{
|
{
|
||||||
Hash128 hash = XXHash128.ComputeHash(MemoryMarshal.Cast<uint, byte>(entry.Code));
|
Hash128 hash = XXHash128.ComputeHash(MemoryMarshal.Cast<uint, byte>(entry.Code));
|
||||||
|
|
||||||
string[] constants = new string[entry.Constants != null ? entry.Constants.Length : 0];
|
string[] constants = new string[entry.Constants?.Length ?? 0];
|
||||||
|
|
||||||
for (int i = 0; i < constants.Length; i++)
|
for (int i = 0; i < constants.Length; i++)
|
||||||
{
|
{
|
||||||
|
if (entry.Constants == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
RgbFloat rgb = entry.Constants[i];
|
RgbFloat rgb = entry.Constants[i];
|
||||||
|
|
||||||
constants[i] = string.Format(CultureInfo.InvariantCulture, "new " + nameof(RgbFloat) + "({0}f, {1}f, {2}f)", rgb.R, rgb.G, rgb.B);
|
constants[i] = string.Format(CultureInfo.InvariantCulture, "new " + nameof(RgbFloat) + "({0}f, {1}f, {2}f)", rgb.R, rgb.G, rgb.B);
|
||||||
|
|||||||
@@ -1061,17 +1061,17 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.CacheNode != null)
|
if (entry?.CacheNode != null)
|
||||||
{
|
{
|
||||||
_lruCache.Remove(entry.CacheNode);
|
_lruCache.Remove(entry.CacheNode);
|
||||||
_lruCache.AddLast(entry.CacheNode);
|
_lruCache.AddLast(entry.CacheNode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
entry.CacheNode = _lruCache.AddLast(entry);
|
entry?.CacheNode = _lruCache.AddLast(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.CacheTimestamp = ++_currentTimestamp;
|
entry?.CacheTimestamp = ++_currentTimestamp;
|
||||||
|
|
||||||
RemoveLeastUsedEntries();
|
RemoveLeastUsedEntries();
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,11 @@ namespace Ryujinx.Graphics.OpenGL.Effects
|
|||||||
GL.ActiveTexture(TextureUnit.Texture0);
|
GL.ActiveTexture(TextureUnit.Texture0);
|
||||||
int previousTextureBinding = GL.GetInteger(GetPName.TextureBinding2D);
|
int previousTextureBinding = GL.GetInteger(GetPName.TextureBinding2D);
|
||||||
|
|
||||||
|
if (textureView == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
GL.BindImageTexture(0, textureView.Handle, 0, false, 0, TextureAccess.ReadWrite, SizedInternalFormat.Rgba8);
|
GL.BindImageTexture(0, textureView.Handle, 0, false, 0, TextureAccess.ReadWrite, SizedInternalFormat.Rgba8);
|
||||||
GL.UseProgram(_shaderProgram);
|
GL.UseProgram(_shaderProgram);
|
||||||
|
|
||||||
@@ -76,6 +81,7 @@ namespace Ryujinx.Graphics.OpenGL.Effects
|
|||||||
GL.ActiveTexture((TextureUnit)previousUnit);
|
GL.ActiveTexture((TextureUnit)previousUnit);
|
||||||
|
|
||||||
return textureView;
|
return textureView;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ namespace Ryujinx.HLE.HOS
|
|||||||
types.Clear();
|
types.Clear();
|
||||||
Mod<DirectoryInfo> mod = new("", null, true);
|
Mod<DirectoryInfo> mod = new("", null, true);
|
||||||
|
|
||||||
if (StrEquals(RomfsDir, modDir.Name))
|
if (StrEquals(RomfsDir, modDir.Name) && modDir.Parent != null)
|
||||||
{
|
{
|
||||||
var modData = modMetadata.Mods.FirstOrDefault(x => modDir.Parent.FullName.Equals(x.Path));
|
var modData = modMetadata.Mods.FirstOrDefault(x => modDir.Parent.FullName.Equals(x.Path));
|
||||||
var enabled = modData?.Enabled ?? true;
|
var enabled = modData?.Enabled ?? true;
|
||||||
@@ -181,7 +181,7 @@ namespace Ryujinx.HLE.HOS
|
|||||||
mods.RomfsDirs.Add(mod = new Mod<DirectoryInfo>(dir.Name, modDir, enabled));
|
mods.RomfsDirs.Add(mod = new Mod<DirectoryInfo>(dir.Name, modDir, enabled));
|
||||||
types.Append('R');
|
types.Append('R');
|
||||||
}
|
}
|
||||||
else if (StrEquals(ExefsDir, modDir.Name))
|
else if (StrEquals(ExefsDir, modDir.Name) && modDir.Parent != null)
|
||||||
{
|
{
|
||||||
var modData = modMetadata.Mods.FirstOrDefault(x => modDir.Parent.FullName.Equals(x.Path));
|
var modData = modMetadata.Mods.FirstOrDefault(x => modDir.Parent.FullName.Equals(x.Path));
|
||||||
var enabled = modData?.Enabled ?? true;
|
var enabled = modData?.Enabled ?? true;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Services.Bluetooth
|
|||||||
|
|
||||||
int initializeEventHandle;
|
int initializeEventHandle;
|
||||||
|
|
||||||
if ((bool)debugMode)
|
if ((bool)debugMode!)
|
||||||
{
|
{
|
||||||
if (BluetoothEventManager.InitializeBleDebugEventHandle == 0)
|
if (BluetoothEventManager.InitializeBleDebugEventHandle == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.Bluetooth
|
|||||||
{
|
{
|
||||||
NxSettings.Settings.TryGetValue("bluetooth_debug!skip_boot", out object debugMode);
|
NxSettings.Settings.TryGetValue("bluetooth_debug!skip_boot", out object debugMode);
|
||||||
|
|
||||||
if ((bool)debugMode)
|
if ((bool)debugMode!)
|
||||||
{
|
{
|
||||||
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(BluetoothEventManager.RegisterBleDebugEventHandle);
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(BluetoothEventManager.RegisterBleDebugEventHandle);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||||||
|
|
||||||
DirectoryInfo archivePath = new DirectoryInfo(fullPath).Parent;
|
DirectoryInfo archivePath = new DirectoryInfo(fullPath).Parent;
|
||||||
|
|
||||||
while (string.IsNullOrWhiteSpace(archivePath.Extension))
|
while (string.IsNullOrWhiteSpace(archivePath?.Extension))
|
||||||
{
|
{
|
||||||
archivePath = archivePath.Parent;
|
archivePath = archivePath?.Parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (archivePath.Extension == ".nsp" && File.Exists(archivePath.FullName))
|
if (archivePath.Extension == ".nsp" && File.Exists(archivePath.FullName))
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||||||
|
|
||||||
if (!File.Exists(fullPath))
|
if (!File.Exists(fullPath))
|
||||||
{
|
{
|
||||||
if (fullPath.Contains('.'))
|
if (fullPath!.Contains('.'))
|
||||||
{
|
{
|
||||||
ResultCode result = FileSystemProxyHelper.OpenFileSystemFromInternalFile(context, fullPath, out FileSystemProxy.IFileSystem fileSystem);
|
ResultCode result = FileSystemProxyHelper.OpenFileSystemFromInternalFile(context, fullPath, out FileSystemProxy.IFileSystem fileSystem);
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ namespace Ryujinx.HLE.HOS.Services
|
|||||||
|
|
||||||
_parameters[0] = context;
|
_parameters[0] = context;
|
||||||
|
|
||||||
result = (ResultCode)processRequest.Invoke(service, _parameters);
|
result = (ResultCode)processRequest.Invoke(service, _parameters)!;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -183,7 +183,7 @@ namespace Ryujinx.HLE.HOS.Services
|
|||||||
|
|
||||||
_parameters[0] = context;
|
_parameters[0] = context;
|
||||||
|
|
||||||
result = (ResultCode)processRequest.Invoke(this, _parameters);
|
result = (ResultCode)processRequest.Invoke(this, _parameters)!;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
|
|||||||
|
|
||||||
bool openSuccess = i < P2pProxyServer.PrivatePortRange;
|
bool openSuccess = i < P2pProxyServer.PrivatePortRange;
|
||||||
|
|
||||||
if (openSuccess)
|
if (openSuccess && _hostedProxy != null)
|
||||||
{
|
{
|
||||||
Task<ushort> natPunchResult = _hostedProxy.NatPunch();
|
Task<ushort> natPunchResult = _hostedProxy.NatPunch();
|
||||||
|
|
||||||
@@ -421,7 +421,10 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
|
|||||||
request.ExternalProxyPort = natPunchResult.Result;
|
request.ExternalProxyPort = natPunchResult.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
|
||||||
if (request.ExternalProxyPort == 0)
|
if (request.ExternalProxyPort == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -83,9 +83,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
|||||||
ConstructorInfo constructor = deviceFileClass.GetConstructor([typeof(ServiceCtx), typeof(IVirtualMemoryManager), typeof(ulong)
|
ConstructorInfo constructor = deviceFileClass.GetConstructor([typeof(ServiceCtx), typeof(IVirtualMemoryManager), typeof(ulong)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
NvDeviceFile deviceFile = (NvDeviceFile)constructor.Invoke([context, _clientMemory, _owner]);
|
NvDeviceFile deviceFile = (NvDeviceFile)constructor?.Invoke([context, _clientMemory, _owner]);
|
||||||
|
|
||||||
deviceFile.Path = path;
|
deviceFile?.Path = path;
|
||||||
|
|
||||||
fd = DeviceFileIdRegistry.Add(deviceFile);
|
fd = DeviceFileIdRegistry.Add(deviceFile);
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu
|
|||||||
// TODO: Return invalid Fd error.
|
// TODO: Return invalid Fd error.
|
||||||
}
|
}
|
||||||
|
|
||||||
channelDeviceFile.Channel.BindMemory(_asContext.Gmm);
|
channelDeviceFile?.Channel.BindMemory(_asContext.Gmm);
|
||||||
|
|
||||||
return NvInternalResult.Success;
|
return NvInternalResult.Success;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
|||||||
{
|
{
|
||||||
Socket.Listen(backlog);
|
Socket.Listen(backlog);
|
||||||
|
|
||||||
Logger.Info?.PrintMsg(LogClass.ServiceBsd, $"Socket listening: {ProtocolType}/{(Socket.LocalEndPoint as IPEndPoint).Port}");
|
Logger.Info?.PrintMsg(LogClass.ServiceBsd, $"Socket listening: {ProtocolType}/{((IPEndPoint)Socket.LocalEndPoint).Port}");
|
||||||
|
|
||||||
return LinuxError.SUCCESS;
|
return LinuxError.SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -573,7 +573,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int receiveSize = (Socket as DefaultSocket).BaseSocket.Receive(ConvertMessagesToBuffer(message), ConvertBsdSocketFlags(flags), out SocketError socketError);
|
int receiveSize = ((DefaultSocket)Socket).BaseSocket.Receive(ConvertMessagesToBuffer(message), ConvertBsdSocketFlags(flags), out SocketError socketError);
|
||||||
|
|
||||||
if (receiveSize > 0)
|
if (receiveSize > 0)
|
||||||
{
|
{
|
||||||
@@ -615,7 +615,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int sendSize = (Socket as DefaultSocket).BaseSocket.Send(ConvertMessagesToBuffer(message), ConvertBsdSocketFlags(flags), out SocketError socketError);
|
int sendSize = ((DefaultSocket)Socket).BaseSocket.Send(ConvertMessagesToBuffer(message), ConvertBsdSocketFlags(flags), out SocketError socketError);
|
||||||
|
|
||||||
if (sendSize > 0)
|
if (sendSize > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types
|
|||||||
{
|
{
|
||||||
for (int index = 0; index < iovCount; index++)
|
for (int index = 0; index < iovCount; index++)
|
||||||
{
|
{
|
||||||
|
if (message.Iov == null) continue;
|
||||||
ulong iovLength = (ulong)message.Iov[index].Length;
|
ulong iovLength = (ulong)message.Iov[index].Length;
|
||||||
|
|
||||||
if (!MemoryMarshal.TryWrite(rawData, in iovLength))
|
if (!MemoryMarshal.TryWrite(rawData, in iovLength))
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd
|
|||||||
NsdSettings = new NsdSettings
|
NsdSettings = new NsdSettings
|
||||||
{
|
{
|
||||||
Initialized = true,
|
Initialized = true,
|
||||||
TestMode = (bool)testMode,
|
TestMode = (bool)testMode!,
|
||||||
Environment = (string)environmentIdentifier,
|
Environment = (string)environmentIdentifier,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,18 +254,23 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService
|
|||||||
|
|
||||||
public ResultCode GetServerCertificate(string hostname, Span<byte> certificates, out uint storageSize, out uint certificateCount)
|
public ResultCode GetServerCertificate(string hostname, Span<byte> certificates, out uint storageSize, out uint certificateCount)
|
||||||
{
|
{
|
||||||
byte[] rawCertData = _stream.RemoteCertificate.GetRawCertData();
|
if (_stream.RemoteCertificate != null)
|
||||||
|
|
||||||
storageSize = (uint)rawCertData.Length;
|
|
||||||
certificateCount = 1;
|
|
||||||
|
|
||||||
if (rawCertData.Length > certificates.Length)
|
|
||||||
{
|
{
|
||||||
return ResultCode.CertBufferTooSmall;
|
byte[] rawCertData = _stream.RemoteCertificate.GetRawCertData();
|
||||||
|
|
||||||
|
storageSize = (uint)rawCertData.Length;
|
||||||
|
certificateCount = 1;
|
||||||
|
|
||||||
|
if (rawCertData.Length > certificates.Length)
|
||||||
|
{
|
||||||
|
return ResultCode.CertBufferTooSmall;
|
||||||
|
}
|
||||||
|
|
||||||
|
rawCertData.CopyTo(certificates);
|
||||||
}
|
}
|
||||||
|
|
||||||
rawCertData.CopyTo(certificates);
|
storageSize = 0;
|
||||||
|
certificateCount = 0;
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ namespace Ryujinx.HLE.UI
|
|||||||
|
|
||||||
public bool Equals(RenderingSurfaceInfo other)
|
public bool Equals(RenderingSurfaceInfo other)
|
||||||
{
|
{
|
||||||
return ColorFormat == other.ColorFormat &&
|
return other != null &&
|
||||||
|
ColorFormat == other.ColorFormat &&
|
||||||
Width == other.Width &&
|
Width == other.Width &&
|
||||||
Height == other.Height &&
|
Height == other.Height &&
|
||||||
Pitch == other.Pitch &&
|
Pitch == other.Pitch &&
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace Ryujinx.Horizon.Sdk.Friends.Detail.Ipc
|
|||||||
{
|
{
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
if (_notifications.Count >= 1)
|
if (_notifications.Count >= 1 && _notifications.First != null)
|
||||||
{
|
{
|
||||||
sizedNotificationInfo = _notifications.First.Value;
|
sizedNotificationInfo = _notifications.First.Value;
|
||||||
_notifications.RemoveFirst();
|
_notifications.RemoveFirst();
|
||||||
@@ -97,7 +97,7 @@ namespace Ryujinx.Horizon.Sdk.Friends.Detail.Ipc
|
|||||||
{
|
{
|
||||||
SizedNotificationInfo friendListNotification = new();
|
SizedNotificationInfo friendListNotification = new();
|
||||||
|
|
||||||
if (_notifications.Count != 0)
|
if (_notifications.Count != 0 && _notifications.First != null)
|
||||||
{
|
{
|
||||||
friendListNotification = _notifications.First.Value;
|
friendListNotification = _notifications.First.Value;
|
||||||
_notifications.RemoveFirst();
|
_notifications.RemoveFirst();
|
||||||
@@ -110,7 +110,7 @@ namespace Ryujinx.Horizon.Sdk.Friends.Detail.Ipc
|
|||||||
{
|
{
|
||||||
SizedNotificationInfo newFriendRequestNotification = new();
|
SizedNotificationInfo newFriendRequestNotification = new();
|
||||||
|
|
||||||
if (_notifications.Count != 0)
|
if (_notifications.Count != 0 && _notifications.First != null)
|
||||||
{
|
{
|
||||||
newFriendRequestNotification = _notifications.First.Value;
|
newFriendRequestNotification = _notifications.First.Value;
|
||||||
_notifications.RemoveFirst();
|
_notifications.RemoveFirst();
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entry = _freeList.First.Value;
|
var entry = _freeList.First?.Value;
|
||||||
_freeList.RemoveFirst();
|
_freeList.RemoveFirst();
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
@@ -117,11 +117,9 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif
|
|||||||
public override void RegisterObject(int id, ServiceObjectHolder obj)
|
public override void RegisterObject(int id, ServiceObjectHolder obj)
|
||||||
{
|
{
|
||||||
var entry = _manager._entryManager.GetEntry(id);
|
var entry = _manager._entryManager.GetEntry(id);
|
||||||
DebugUtil.Assert(entry != null);
|
|
||||||
|
|
||||||
lock (_manager._entryOwnerLock)
|
lock (_manager._entryOwnerLock)
|
||||||
{
|
{
|
||||||
DebugUtil.Assert(entry.Owner == null);
|
|
||||||
entry.Owner = this;
|
entry.Owner = this;
|
||||||
entry.Node = _entries.AddLast(entry);
|
entry.Node = _entries.AddLast(entry);
|
||||||
}
|
}
|
||||||
@@ -188,9 +186,6 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif
|
|||||||
{
|
{
|
||||||
var entry = _manager._entryManager.GetEntry(ids[i]);
|
var entry = _manager._entryManager.GetEntry(ids[i]);
|
||||||
|
|
||||||
DebugUtil.Assert(entry != null);
|
|
||||||
DebugUtil.Assert(entry.Owner == null);
|
|
||||||
|
|
||||||
_manager._entryManager.FreeEntry(entry);
|
_manager._entryManager.FreeEntry(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,9 @@ namespace Ryujinx.Memory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ReadOnlySequence<byte>(first, 0, last, (int)(size - last.RunningIndex));
|
return first != null
|
||||||
|
? new ReadOnlySequence<byte>(first, 0, last, (int)(size - last.RunningIndex))
|
||||||
|
: default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -354,7 +354,9 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||||||
index += nextSegmentLength;
|
index += nextSegmentLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ReadOnlySequence<byte>(first, 0, last, (int)(memory.Length - last.RunningIndex));
|
return first != null
|
||||||
|
? new ReadOnlySequence<byte>(first, 0, last, (int)(memory.Length - last.RunningIndex))
|
||||||
|
: default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ namespace Ryujinx.Ava.UI.Views.User
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
((ContentDialog)_parent.Parent).Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - " +
|
((ContentDialog)_parent.Parent)?.Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - " +
|
||||||
$"{(_isNewUser ? LocaleManager.Instance[LocaleKeys.UserEditorTitleCreate] : LocaleManager.Instance[LocaleKeys.UserEditorTitle])}";
|
$"{(_isNewUser ? LocaleManager.Instance[LocaleKeys.UserEditorTitleCreate] : LocaleManager.Instance[LocaleKeys.UserEditorTitle])}";
|
||||||
|
|
||||||
DataContext = TempProfile;
|
DataContext = TempProfile;
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace Ryujinx.Ava.UI.Views.User
|
|||||||
(_parent, _profile) = ((NavigationDialogHost, TempProfile))arg.Parameter;
|
(_parent, _profile) = ((NavigationDialogHost, TempProfile))arg.Parameter;
|
||||||
_contentManager = _parent.ContentManager;
|
_contentManager = _parent.ContentManager;
|
||||||
|
|
||||||
((ContentDialog)_parent.Parent).Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {LocaleManager.Instance[LocaleKeys.ProfileImageSelectionHeader]}";
|
((ContentDialog)_parent.Parent)?.Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {LocaleManager.Instance[LocaleKeys.ProfileImageSelectionHeader]}";
|
||||||
|
|
||||||
if (Program.PreviewerDetached)
|
if (Program.PreviewerDetached)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Ryujinx.Ava.UI.Views.User
|
|||||||
|
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
|
|
||||||
((ContentDialog)_parent.Parent).Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {LocaleManager.Instance[LocaleKeys.UserProfilesRecoverHeading]}";
|
((ContentDialog)_parent.Parent)?.Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {LocaleManager.Instance[LocaleKeys.UserProfilesRecoverHeading]}";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace Ryujinx.Ava.UI.Views.User
|
|||||||
}
|
}
|
||||||
|
|
||||||
DataContext = ViewModel = new UserSaveManagerViewModel(_accountManager);
|
DataContext = ViewModel = new UserSaveManagerViewModel(_accountManager);
|
||||||
((ContentDialog)_parent.Parent).Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {ViewModel.SaveManagerHeading}";
|
((ContentDialog)_parent.Parent)?.Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {ViewModel.SaveManagerHeading}";
|
||||||
|
|
||||||
Task.Run(LoadSaves);
|
Task.Run(LoadSaves);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||||
TransparencyLevelHint = [WindowTransparencyLevel.None];
|
TransparencyLevelHint = [WindowTransparencyLevel.None];
|
||||||
|
|
||||||
using Stream stream = Assembly.GetAssembly(typeof(ConfigurationState)).GetManifestResourceStream("Ryujinx.UI.Common.Resources.Logo_Ryujinx.png");
|
using Stream stream = Assembly.GetAssembly(typeof(ConfigurationState))?.GetManifestResourceStream("Ryujinx.UI.Common.Resources.Logo_Ryujinx.png");
|
||||||
|
|
||||||
Icon = new WindowIcon(stream);
|
Icon = new WindowIcon(stream);
|
||||||
stream.Position = 0;
|
stream.Position = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user