Return a nullable enum from ConvetScalingMode
This commit is contained in:
parent
4ae59b9a10
commit
b9f5342d87
1 changed files with 5 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue