Address some PR feedback

This commit is contained in:
gdk 2022-12-31 03:17:44 -03:00
parent dd187b0ac3
commit 99bf357b92
17 changed files with 40 additions and 20 deletions

View file

@ -722,6 +722,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
bool isLight, bool isLight,
[PointerSized] ulong namePtr) [PointerSized] ulong namePtr)
{ {
// The kernel doesn't use the name pointer, so we can just pass null as the name.
return CreatePort(out serverPortHandle, out clientPortHandle, maxSessions, isLight, null); return CreatePort(out serverPortHandle, out clientPortHandle, maxSessions, isLight, null);
} }

View file

@ -471,6 +471,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
private static string GetCanonicalTypeNameWithGenericArguments(Compilation compilation, SyntaxNode syntaxNode) private static string GetCanonicalTypeNameWithGenericArguments(Compilation compilation, SyntaxNode syntaxNode)
{ {
TypeInfo typeInfo = compilation.GetSemanticModel(syntaxNode.SyntaxTree).GetTypeInfo(syntaxNode); TypeInfo typeInfo = compilation.GetSemanticModel(syntaxNode.SyntaxTree).GetTypeInfo(syntaxNode);
return typeInfo.Type.ToDisplayString(); return typeInfo.Type.ToDisplayString();
} }
@ -491,6 +492,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
private static SpecialType GetSpecialTypeName(Compilation compilation, SyntaxNode syntaxNode) private static SpecialType GetSpecialTypeName(Compilation compilation, SyntaxNode syntaxNode)
{ {
TypeInfo typeInfo = compilation.GetSemanticModel(syntaxNode.SyntaxTree).GetTypeInfo(syntaxNode); TypeInfo typeInfo = compilation.GetSemanticModel(syntaxNode.SyntaxTree).GetTypeInfo(syntaxNode);
return typeInfo.Type.SpecialType; return typeInfo.Type.SpecialType;
} }
@ -505,6 +507,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
if (typeInfo.Type.SpecialType == SpecialType.None) if (typeInfo.Type.SpecialType == SpecialType.None)
{ {
string pack = GetTypeFirstNamedAttributeAgument(compilation, syntaxNode, TypeStructLayoutAttribute, "Pack"); string pack = GetTypeFirstNamedAttributeAgument(compilation, syntaxNode, TypeStructLayoutAttribute, "Pack");
return pack ?? "1"; return pack ?? "1";
} }
else else
@ -623,6 +626,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
private static bool IsUnmanagedType(Compilation compilation, SyntaxNode syntaxNode) private static bool IsUnmanagedType(Compilation compilation, SyntaxNode syntaxNode)
{ {
TypeInfo typeInfo = compilation.GetSemanticModel(syntaxNode.SyntaxTree).GetTypeInfo(syntaxNode); TypeInfo typeInfo = compilation.GetSemanticModel(syntaxNode.SyntaxTree).GetTypeInfo(syntaxNode);
return typeInfo.Type.IsUnmanagedType; return typeInfo.Type.IsUnmanagedType;
} }

View file

@ -19,8 +19,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
{ {
if (syntaxNode is ClassDeclarationSyntax classDeclaration) if (syntaxNode is ClassDeclarationSyntax classDeclaration)
{ {
if (!classDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword) || if (!classDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword) || classDeclaration.BaseList == null)
classDeclaration.BaseList == null)
{ {
return; return;
} }

View file

@ -1,10 +1,12 @@
namespace Ryujinx.Horizon.Sdk using System.Diagnostics;
namespace Ryujinx.Horizon.Sdk
{ {
static class DebugUtil static class DebugUtil
{ {
public static void Assert(bool condition) public static void Assert(bool condition)
{ {
Debug.Assert(condition);
} }
} }
} }

View file

@ -2,16 +2,10 @@
{ {
struct EventType struct EventType
{ {
public enum InitializatonState : byte
{
NotInitialized,
Initialized
}
public bool Signaled; public bool Signaled;
public bool InitiallySignaled; public bool InitiallySignaled;
public byte ClearMode; public byte ClearMode;
public InitializatonState State; public InitializationState State;
public ulong BroadcastCounter; public ulong BroadcastCounter;
} }
} }

View file

@ -25,7 +25,7 @@ namespace Ryujinx.Horizon.Sdk.OsTypes.Impl
public static void Destroy(ref InterProcessEventType ipEvent) public static void Destroy(ref InterProcessEventType ipEvent)
{ {
ipEvent.State = InterProcessEventType.InitializationState.NotInitialized; ipEvent.State = InitializationState.NotInitialized;
if (ipEvent.ReadableHandleManaged) if (ipEvent.ReadableHandleManaged)
{ {

View file

@ -0,0 +1,8 @@
namespace Ryujinx.Horizon.Sdk.OsTypes
{
enum InitializationState : byte
{
NotInitialized,
Initialized
}
}

View file

@ -2,12 +2,6 @@
{ {
struct InterProcessEventType struct InterProcessEventType
{ {
public enum InitializationState : byte
{
NotInitialized,
Initialized
}
public readonly bool AutoClear; public readonly bool AutoClear;
public InitializationState State; public InitializationState State;
public bool ReadableHandleManaged; public bool ReadableHandleManaged;

View file

@ -9,7 +9,7 @@
Signaled = signaled, Signaled = signaled,
InitiallySignaled = signaled, InitiallySignaled = signaled,
ClearMode = (byte)clearMode, ClearMode = (byte)clearMode,
State = EventType.InitializatonState.Initialized State = InitializationState.Initialized
}; };
} }
} }

View file

@ -2,9 +2,11 @@
{ {
struct CmifDomainOutHeader struct CmifDomainOutHeader
{ {
#pragma warning disable CS0649
public uint ObjectsCount; public uint ObjectsCount;
public uint Padding; public uint Padding;
public uint Padding2; public uint Padding2;
public uint Padding3; public uint Padding3;
#pragma warning restore CS0649
} }
} }

View file

@ -4,9 +4,11 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif
{ {
struct CmifOutHeader struct CmifOutHeader
{ {
#pragma warning disable CS0649
public uint Magic; public uint Magic;
public uint Version; public uint Version;
public Result Result; public Result Result;
public uint Token; public uint Token;
#pragma warning restore CS0649
} }
} }

View file

@ -2,6 +2,7 @@
{ {
struct CmifRequestFormat struct CmifRequestFormat
{ {
#pragma warning disable CS0649
public int ObjectId; public int ObjectId;
public uint RequestId; public uint RequestId;
public uint Context; public uint Context;
@ -18,5 +19,6 @@
public int ObjectsCount; public int ObjectsCount;
public int HandlesCount; public int HandlesCount;
public bool SendPid; public bool SendPid;
#pragma warning restore CS0649
} }
} }

View file

@ -14,15 +14,18 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
if (result == KernelResult.PortRemoteClosed) if (result == KernelResult.PortRemoteClosed)
{ {
recvResult = ReceiveResult.Closed; recvResult = ReceiveResult.Closed;
return Result.Success; return Result.Success;
} }
else if (result == KernelResult.ReceiveListBroken) else if (result == KernelResult.ReceiveListBroken)
{ {
recvResult = ReceiveResult.NeedsRetry; recvResult = ReceiveResult.NeedsRetry;
return Result.Success; return Result.Success;
} }
recvResult = ReceiveResult.Success; recvResult = ReceiveResult.Success;
return result; return result;
} }

View file

@ -2,9 +2,11 @@
{ {
struct HipcBufferDescriptor struct HipcBufferDescriptor
{ {
#pragma warning disable CS0649
private uint _sizeLow; private uint _sizeLow;
private uint _addressLow; private uint _addressLow;
private uint _word2; private uint _word2;
#pragma warning restore CS0649
public ulong Address => _addressLow | (((ulong)_word2 << 4) & 0xf00000000UL) | (((ulong)_word2 << 34) & 0x7000000000UL); public ulong Address => _addressLow | (((ulong)_word2 << 4) & 0xf00000000UL) | (((ulong)_word2 << 34) & 0x7000000000UL);
public ulong Size => _sizeLow | ((ulong)_word2 << 8) & 0xf00000000UL; public ulong Size => _sizeLow | ((ulong)_word2 << 8) & 0xf00000000UL;

View file

@ -1,5 +1,8 @@
namespace Ryujinx.Horizon.Sdk.Sf.Hipc using System;
namespace Ryujinx.Horizon.Sdk.Sf.Hipc
{ {
[Flags]
enum HipcBufferFlags : byte enum HipcBufferFlags : byte
{ {
In = 1 << 0, In = 1 << 0,

View file

@ -16,6 +16,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
protected override Result DispatchManagerRequest(ServerSession session, Span<byte> inMessage, Span<byte> outMessage) protected override Result DispatchManagerRequest(ServerSession session, Span<byte> inMessage, Span<byte> outMessage)
{ {
HipcManager hipcManager = new HipcManager(this, session); HipcManager hipcManager = new HipcManager(this, session);
return DispatchRequest(new ServiceObjectHolder(hipcManager), session, inMessage, outMessage); return DispatchRequest(new ServiceObjectHolder(hipcManager), session, inMessage, outMessage);
} }
} }

View file

@ -22,6 +22,7 @@ namespace Ryujinx.Horizon.Sm
{ {
_clientProcessId = clientProcessId; _clientProcessId = clientProcessId;
_initialized = true; _initialized = true;
return Result.Success; return Result.Success;
} }
@ -31,6 +32,7 @@ namespace Ryujinx.Horizon.Sm
if (!_initialized) if (!_initialized)
{ {
handle = 0; handle = 0;
return SmResult.InvalidClient; return SmResult.InvalidClient;
} }
@ -43,6 +45,7 @@ namespace Ryujinx.Horizon.Sm
if (!_initialized) if (!_initialized)
{ {
handle = 0; handle = 0;
return SmResult.InvalidClient; return SmResult.InvalidClient;
} }