From b9f5342d8710fbbaa3c1e92c04393236e8a0dee3 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 18 Feb 2019 21:03:21 -0300 Subject: [PATCH] Return a nullable enum from ConvetScalingMode --- Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs index ae1e2718fd..773c25d251 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs @@ -182,7 +182,9 @@ namespace Ryujinx.HLE.HOS.Services.Vi { SrcScalingMode scalingMode = (SrcScalingMode)context.RequestData.ReadInt32(); - if (scalingMode > SrcScalingMode.PreserveAspectRatio) + DstScalingMode? convertedScalingMode = ConvetScalingMode(scalingMode); + + if (!convertedScalingMode.HasValue) { //Scaling mode out of the range of valid values. return MakeError(ErrorModule.Vi, 1); @@ -200,7 +202,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi return 0; } - private DstScalingMode ConvetScalingMode(SrcScalingMode source) + private DstScalingMode? ConvetScalingMode(SrcScalingMode source) { switch (source) { @@ -211,7 +213,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi case SrcScalingMode.PreserveAspectRatio: return DstScalingMode.PreserveAspectRatio; } - throw new ArgumentException($"Invalid scaling mode \"{source}\" specified."); + return null; } public long GetDisplayVSyncEvent(ServiceCtx context)