diff options
author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2023-01-07 00:57:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-07 00:57:21 +0100 |
commit | 81fae0d1a674df2414da0d438a85432d2ce0cc44 (patch) | |
tree | c8e6f2d5ef6c5ba2edb78de9bf73612f5fe96d1f | |
parent | 38519f3b9ade223983f7529f9b4f4b857c60f42b (diff) |
[hipc] Fix 'Unexpected result code Success returned' in Reply() (#4215)1.1.514
* horizon: Add AbortOnFailureUnless()
* hipc: Replace AbortUnless() with AbortOnFailureUnless() in Reply()
-rw-r--r-- | Ryujinx.Horizon.Common/Result.cs | 10 | ||||
-rw-r--r-- | Ryujinx.Horizon/Sdk/Sf/Hipc/Api.cs | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/Ryujinx.Horizon.Common/Result.cs b/Ryujinx.Horizon.Common/Result.cs index 04281199..ac843688 100644 --- a/Ryujinx.Horizon.Common/Result.cs +++ b/Ryujinx.Horizon.Common/Result.cs @@ -100,6 +100,14 @@ namespace Ryujinx.Horizon.Common } } + public void AbortOnFailureUnless(Result result, Result result2) + { + if (this != Success && this != result && this != result2) + { + ThrowInvalidResult(); + } + } + private void ThrowInvalidResult() { throw new InvalidResultException(this); @@ -115,4 +123,4 @@ namespace Ryujinx.Horizon.Common return PrintableResult; } } -} +}
\ No newline at end of file diff --git a/Ryujinx.Horizon/Sdk/Sf/Hipc/Api.cs b/Ryujinx.Horizon/Sdk/Sf/Hipc/Api.cs index deac524c..822a4b4a 100644 --- a/Ryujinx.Horizon/Sdk/Sf/Hipc/Api.cs +++ b/Ryujinx.Horizon/Sdk/Sf/Hipc/Api.cs @@ -51,7 +51,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc { Result result = ReplyImpl(sessionHandle, messageBuffer); - result.AbortUnless(KernelResult.TimedOut, KernelResult.PortRemoteClosed); + result.AbortOnFailureUnless(KernelResult.TimedOut, KernelResult.PortRemoteClosed); return Result.Success; } @@ -86,4 +86,4 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc return result; } } -} +}
\ No newline at end of file |