misc: chore: Merge duplicated 'if' branches

This commit is contained in:
KeatonTheBot 2025-08-29 17:39:03 -05:00
parent dfb6164ba5
commit d773bd60f4
22 changed files with 76 additions and 306 deletions

View file

@ -244,56 +244,14 @@ namespace ARMeilleure.Translation.PTC
{ {
OuterHeader outerHeader = DeserializeStructure<OuterHeader>(compressedStream); OuterHeader outerHeader = DeserializeStructure<OuterHeader>(compressedStream);
if (!outerHeader.IsHeaderValid()) if (!outerHeader.IsHeaderValid() ||
{ outerHeader.Magic != _outerHeaderMagic ||
InvalidateCompressedStream(compressedStream); outerHeader.CacheFileVersion != InternalVersion ||
outerHeader.Endianness != GetEndianness() ||
return false; outerHeader.FeatureInfo != GetFeatureInfo() ||
} outerHeader.MemoryManagerMode != GetMemoryManagerMode() ||
outerHeader.OSPlatform != GetOSPlatform() ||
if (outerHeader.Magic != _outerHeaderMagic) outerHeader.Architecture != (uint)RuntimeInformation.ProcessArchitecture)
{
InvalidateCompressedStream(compressedStream);
return false;
}
if (outerHeader.CacheFileVersion != InternalVersion)
{
InvalidateCompressedStream(compressedStream);
return false;
}
if (outerHeader.Endianness != GetEndianness())
{
InvalidateCompressedStream(compressedStream);
return false;
}
if (outerHeader.FeatureInfo != GetFeatureInfo())
{
InvalidateCompressedStream(compressedStream);
return false;
}
if (outerHeader.MemoryManagerMode != GetMemoryManagerMode())
{
InvalidateCompressedStream(compressedStream);
return false;
}
if (outerHeader.OSPlatform != GetOSPlatform())
{
InvalidateCompressedStream(compressedStream);
return false;
}
if (outerHeader.Architecture != (uint)RuntimeInformation.ProcessArchitecture)
{ {
InvalidateCompressedStream(compressedStream); InvalidateCompressedStream(compressedStream);
@ -324,14 +282,7 @@ namespace ARMeilleure.Translation.PTC
InnerHeader innerHeader = DeserializeStructure<InnerHeader>(stream); InnerHeader innerHeader = DeserializeStructure<InnerHeader>(stream);
if (!innerHeader.IsHeaderValid()) if (!innerHeader.IsHeaderValid() || innerHeader.Magic != _innerHeaderMagic)
{
InvalidateCompressedStream(compressedStream);
return false;
}
if (innerHeader.Magic != _innerHeaderMagic)
{ {
InvalidateCompressedStream(compressedStream); InvalidateCompressedStream(compressedStream);

View file

@ -189,28 +189,10 @@ namespace ARMeilleure.Translation.PTC
{ {
OuterHeader outerHeader = DeserializeStructure<OuterHeader>(compressedStream); OuterHeader outerHeader = DeserializeStructure<OuterHeader>(compressedStream);
if (!outerHeader.IsHeaderValid()) if (!outerHeader.IsHeaderValid() ||
{ outerHeader.Magic != _outerHeaderMagic ||
InvalidateCompressedStream(compressedStream); outerHeader.InfoFileVersion != InternalVersion && !_migrateInternalVersions.Contains(outerHeader.InfoFileVersion) ||
outerHeader.Endianness != Ptc.GetEndianness())
return false;
}
if (outerHeader.Magic != _outerHeaderMagic)
{
InvalidateCompressedStream(compressedStream);
return false;
}
if (outerHeader.InfoFileVersion != InternalVersion && !_migrateInternalVersions.Contains(outerHeader.InfoFileVersion))
{
InvalidateCompressedStream(compressedStream);
return false;
}
if (outerHeader.Endianness != Ptc.GetEndianness())
{ {
InvalidateCompressedStream(compressedStream); InvalidateCompressedStream(compressedStream);

View file

@ -262,12 +262,8 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
return UpdateResult.Success; return UpdateResult.Success;
} }
if (inParameter.CpuAddress == 0 || (inParameter.CpuAddress % PageSize) != 0) if (inParameter.CpuAddress == 0 || (inParameter.CpuAddress % PageSize) != 0 ||
{ inParameter.Size == 0 || (inParameter.Size % PageSize) != 0)
return UpdateResult.InvalidParameter;
}
if (inParameter.Size == 0 || (inParameter.Size % PageSize) != 0)
{ {
return UpdateResult.InvalidParameter; return UpdateResult.InvalidParameter;
} }

View file

@ -409,12 +409,8 @@ namespace Ryujinx.Cpu.Jit
for (int page = 0; page < pages - 1; page++) for (int page = 0; page < pages - 1; page++)
{ {
if (!ValidateAddress(va + PageSize)) if (!ValidateAddress(va + PageSize) ||
{ GetPhysicalAddressInternal(va) + PageSize != GetPhysicalAddressInternal(va + PageSize))
return contiguousSize;
}
if (GetPhysicalAddressInternal(va) + PageSize != GetPhysicalAddressInternal(va + PageSize))
{ {
return contiguousSize; return contiguousSize;
} }

View file

@ -852,11 +852,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
bool hasDepth = dsFormat.Format.HasDepth(); bool hasDepth = dsFormat.Format.HasDepth();
bool hasStencil = dsFormat.Format.HasStencil(); bool hasStencil = dsFormat.Format.HasStencil();
if (hasStencil && (!clearStencil || (clearAffectedByStencilMask && _state.State.StencilTestState.FrontMask != 0xff))) if (hasStencil && (!clearStencil || (clearAffectedByStencilMask && _state.State.StencilTestState.FrontMask != 0xff)) ||
{ hasDepth && !clearDepth)
fullClear = false;
}
else if (hasDepth && !clearDepth)
{ {
fullClear = false; fullClear = false;
} }

View file

@ -1187,12 +1187,8 @@ namespace Ryujinx.Graphics.Gpu.Image
return matchQuality; return matchQuality;
} }
if (!TextureCompatibility.LayoutMatches(Info, info)) if (!TextureCompatibility.LayoutMatches(Info, info)
{ || !TextureCompatibility.SizeMatches(Info, info, forSampler))
return TextureMatchQuality.NoMatch;
}
if (!TextureCompatibility.SizeMatches(Info, info, forSampler))
{ {
return TextureMatchQuality.NoMatch; return TextureMatchQuality.NoMatch;
} }
@ -1277,17 +1273,9 @@ namespace Ryujinx.Graphics.Gpu.Image
int offset = Range.FindOffset(range); int offset = Range.FindOffset(range);
if (offset < 0 || !_sizeInfo.FindView(offset, out firstLayer, out firstLevel)) if (offset < 0 || !_sizeInfo.FindView(offset, out firstLayer, out firstLevel) ||
{ !TextureCompatibility.ViewLayoutCompatible(Info, info, firstLevel) ||
return TextureViewCompatibility.LayoutIncompatible; info.GetSlices() > 1 && LayerSize != layerSize)
}
if (!TextureCompatibility.ViewLayoutCompatible(Info, info, firstLevel))
{
return TextureViewCompatibility.LayoutIncompatible;
}
if (info.GetSlices() > 1 && LayerSize != layerSize)
{ {
return TextureViewCompatibility.LayoutIncompatible; return TextureViewCompatibility.LayoutIncompatible;
} }

View file

@ -243,11 +243,8 @@ namespace Ryujinx.Graphics.Gpu.Image
} }
else if ((lhs.FormatInfo.Format == Format.D24UnormS8Uint || else if ((lhs.FormatInfo.Format == Format.D24UnormS8Uint ||
lhs.FormatInfo.Format == Format.S8UintD24Unorm || lhs.FormatInfo.Format == Format.S8UintD24Unorm ||
lhs.FormatInfo.Format == Format.X8UintD24Unorm) && rhs.FormatInfo.Format == Format.B8G8R8A8Unorm) lhs.FormatInfo.Format == Format.X8UintD24Unorm) && rhs.FormatInfo.Format == Format.B8G8R8A8Unorm ||
{ lhs.FormatInfo.Format == Format.D32FloatS8Uint && rhs.FormatInfo.Format == Format.R32G32Float)
return TextureMatchQuality.FormatAlias;
}
else if (lhs.FormatInfo.Format == Format.D32FloatS8Uint && rhs.FormatInfo.Format == Format.R32G32Float)
{ {
return TextureMatchQuality.FormatAlias; return TextureMatchQuality.FormatAlias;
} }

View file

@ -62,11 +62,8 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native
NativeLibrary.SetDllImportResolver(typeof(FFmpegApi).Assembly, (name, assembly, path) => NativeLibrary.SetDllImportResolver(typeof(FFmpegApi).Assembly, (name, assembly, path) =>
{ {
if (name == AvUtilLibraryName && TryLoadWhitelistedLibrary(AvUtilLibraryName, assembly, path, out nint handle)) if (name == AvUtilLibraryName && TryLoadWhitelistedLibrary(AvUtilLibraryName, assembly, path, out nint handle) ||
{ name == AvCodecLibraryName && TryLoadWhitelistedLibrary(AvCodecLibraryName, assembly, path, out handle))
return handle;
}
else if (name == AvCodecLibraryName && TryLoadWhitelistedLibrary(AvCodecLibraryName, assembly, path, out handle))
{ {
return handle; return handle;
} }

View file

@ -275,12 +275,8 @@ namespace Ryujinx.Graphics.Shader.Instructions
{ {
location = 0; location = 0;
if (!_attributes.TryGetValue(offset, out AttributeEntry entry)) if (!_attributes.TryGetValue(offset, out AttributeEntry entry) ||
{ ((StagesMask)(1 << (int)definitions.Stage) & entry.OutputMask) == StagesMask.None)
return IoVariable.Invalid;
}
if (((StagesMask)(1 << (int)definitions.Stage) & entry.OutputMask) == StagesMask.None)
{ {
return IoVariable.Invalid; return IoVariable.Invalid;
} }

View file

@ -368,11 +368,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
copyCount += coordsCount * 2; copyCount += coordsCount * 2;
} }
if (isMultisample) if (isMultisample || hasLodLevel)
{
copyCount++;
}
else if (hasLodLevel)
{ {
copyCount++; copyCount++;
} }

View file

@ -276,29 +276,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
WakeClientThread(request, clientResult); WakeClientThread(request, clientResult);
} }
if (clientHeader.ReceiveListType < 2 && if (clientHeader.ReceiveListType < 2 && clientHeader.ReceiveListOffset > clientMsg.Size ||
clientHeader.ReceiveListOffset > clientMsg.Size) clientHeader.ReceiveListType == 2 && clientHeader.ReceiveListOffset + 8 > clientMsg.Size ||
{ clientHeader.ReceiveListType > 2 && clientHeader.ReceiveListType * 8 - 0x10 + clientHeader.ReceiveListOffset > clientMsg.Size ||
CleanUpForError(); clientHeader.ReceiveListOffsetInWords < clientHeader.MessageSizeInWords)
return KernelResult.InvalidCombination;
}
else if (clientHeader.ReceiveListType == 2 &&
clientHeader.ReceiveListOffset + 8 > clientMsg.Size)
{
CleanUpForError();
return KernelResult.InvalidCombination;
}
else if (clientHeader.ReceiveListType > 2 &&
clientHeader.ReceiveListType * 8 - 0x10 + clientHeader.ReceiveListOffset > clientMsg.Size)
{
CleanUpForError();
return KernelResult.InvalidCombination;
}
if (clientHeader.ReceiveListOffsetInWords < clientHeader.MessageSizeInWords)
{ {
CleanUpForError(); CleanUpForError();
@ -629,29 +610,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
FinishRequest(request, clientResult); FinishRequest(request, clientResult);
} }
if (clientHeader.ReceiveListType < 2 && if (clientHeader.ReceiveListType < 2 && clientHeader.ReceiveListOffset > clientMsg.Size ||
clientHeader.ReceiveListOffset > clientMsg.Size) clientHeader.ReceiveListType == 2 && clientHeader.ReceiveListOffset + 8 > clientMsg.Size ||
{ clientHeader.ReceiveListType > 2 && clientHeader.ReceiveListType * 8 - 0x10 + clientHeader.ReceiveListOffset > clientMsg.Size ||
CleanUpForError(); clientHeader.ReceiveListOffsetInWords < clientHeader.MessageSizeInWords)
return KernelResult.InvalidCombination;
}
else if (clientHeader.ReceiveListType == 2 &&
clientHeader.ReceiveListOffset + 8 > clientMsg.Size)
{
CleanUpForError();
return KernelResult.InvalidCombination;
}
else if (clientHeader.ReceiveListType > 2 &&
clientHeader.ReceiveListType * 8 - 0x10 + clientHeader.ReceiveListOffset > clientMsg.Size)
{
CleanUpForError();
return KernelResult.InvalidCombination;
}
if (clientHeader.ReceiveListOffsetInWords < clientHeader.MessageSizeInWords)
{ {
CleanUpForError(); CleanUpForError();

View file

@ -442,17 +442,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
ulong addrSpacePagesCount = (AddressSpaceEnd - AddressSpaceStart) / PageSize; ulong addrSpacePagesCount = (AddressSpaceEnd - AddressSpaceStart) / PageSize;
if (AddressSpaceStart > address) if (AddressSpaceStart > address || addrSpacePagesCount < pagesCount || endAddr - 1 > AddressSpaceEnd - 1)
{
return KernelResult.InvalidMemState;
}
if (addrSpacePagesCount < pagesCount)
{
return KernelResult.InvalidMemState;
}
if (endAddr - 1 > AddressSpaceEnd - 1)
{ {
return KernelResult.InvalidMemState; return KernelResult.InvalidMemState;
} }

View file

@ -309,17 +309,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
if (KernelContext.EnableVersionChecks) if (KernelContext.EnableVersionChecks)
{ {
if (requiredKernelVersionMajor > KernelVersionMajor) if (requiredKernelVersionMajor > KernelVersionMajor ||
{ requiredKernelVersionMajor != KernelVersionMajor && requiredKernelVersionMajor < 3 ||
return KernelResult.InvalidCombination; requiredKernelVersionMinor > KernelVersionMinor)
}
if (requiredKernelVersionMajor != KernelVersionMajor && requiredKernelVersionMajor < 3)
{
return KernelResult.InvalidCombination;
}
if (requiredKernelVersionMinor > KernelVersionMinor)
{ {
return KernelResult.InvalidCombination; return KernelResult.InvalidCombination;
} }

View file

@ -535,12 +535,8 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
ulong copySize = (ulong)((long)handlesCount * 4); ulong copySize = (ulong)((long)handlesCount * 4);
if (!currentProcess.MemoryManager.InsideAddrSpace(handlesPtr, copySize)) if (!currentProcess.MemoryManager.InsideAddrSpace(handlesPtr, copySize) ||
{ handlesPtr + copySize < handlesPtr)
return KernelResult.UserCopyFailed;
}
if (handlesPtr + copySize < handlesPtr)
{ {
return KernelResult.UserCopyFailed; return KernelResult.UserCopyFailed;
} }
@ -647,12 +643,8 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
ulong copySize = (ulong)((long)handlesCount * 4); ulong copySize = (ulong)((long)handlesCount * 4);
if (!currentProcess.MemoryManager.InsideAddrSpace(handlesPtr, copySize)) if (!currentProcess.MemoryManager.InsideAddrSpace(handlesPtr, copySize) ||
{ handlesPtr + copySize < handlesPtr)
return KernelResult.UserCopyFailed;
}
if (handlesPtr + copySize < handlesPtr)
{ {
return KernelResult.UserCopyFailed; return KernelResult.UserCopyFailed;
} }
@ -2268,12 +2260,8 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
ulong copySize = (ulong)maxCount * 8; ulong copySize = (ulong)maxCount * 8;
if (address + copySize <= address) if (address + copySize <= address ||
{ currentProcess.MemoryManager.OutsideAddrSpace(address, copySize))
return KernelResult.InvalidMemState;
}
if (currentProcess.MemoryManager.OutsideAddrSpace(address, copySize))
{ {
return KernelResult.InvalidMemState; return KernelResult.InvalidMemState;
} }
@ -2742,12 +2730,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
KThread thread = process.HandleTable.GetObject<KThread>(handle); KThread thread = process.HandleTable.GetObject<KThread>(handle);
if (thread == null) if (thread == null || thread.Owner != process)
{
return KernelResult.InvalidHandle;
}
if (thread.Owner != process)
{ {
return KernelResult.InvalidHandle; return KernelResult.InvalidHandle;
} }
@ -2768,12 +2751,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
KThread thread = currentProcess.HandleTable.GetObject<KThread>(handle); KThread thread = currentProcess.HandleTable.GetObject<KThread>(handle);
if (thread == null) if (thread == null || thread.Owner != currentProcess)
{
return KernelResult.InvalidHandle;
}
if (thread.Owner != currentProcess)
{ {
return KernelResult.InvalidHandle; return KernelResult.InvalidHandle;
} }
@ -2820,12 +2798,8 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
long handlesSize = handlesCount * 4; long handlesSize = handlesCount * 4;
if (handlesPtr + (ulong)handlesSize <= handlesPtr) if (handlesPtr + (ulong)handlesSize <= handlesPtr ||
{ handlesPtr + (ulong)handlesSize - 1 > currentProcess.MemoryManager.AddressSpaceEnd - 1)
return KernelResult.UserCopyFailed;
}
if (handlesPtr + (ulong)handlesSize - 1 > currentProcess.MemoryManager.AddressSpaceEnd - 1)
{ {
return KernelResult.UserCopyFailed; return KernelResult.UserCopyFailed;
} }

View file

@ -214,12 +214,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
DeviceType deviceType = (DeviceType)context.RequestData.ReadUInt32(); DeviceType deviceType = (DeviceType)context.RequestData.ReadUInt32();
MountTarget mountTarget = (MountTarget)context.RequestData.ReadUInt32(); MountTarget mountTarget = (MountTarget)context.RequestData.ReadUInt32();
if (deviceType != 0) if (deviceType != 0 || ((uint)mountTarget & 3) == 0)
{
return ResultCode.WrongArgument;
}
if (((uint)mountTarget & 3) == 0)
{ {
return ResultCode.WrongArgument; return ResultCode.WrongArgument;
} }

View file

@ -54,7 +54,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
{ {
VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId); VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId);
return new CommonInfo() return new CommonInfo
{ {
LastWriteYear = (ushort)amiiboFile.LastWriteDate.Year, LastWriteYear = (ushort)amiiboFile.LastWriteDate.Year,
LastWriteMonth = (byte)amiiboFile.LastWriteDate.Month, LastWriteMonth = (byte)amiiboFile.LastWriteDate.Month,
@ -115,19 +115,13 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
public static bool OpenApplicationArea(string amiiboId, uint applicationAreaId) public static bool OpenApplicationArea(string amiiboId, uint applicationAreaId)
{ {
VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId); VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId);
if (ApplicationBytes.Length > 0) if (ApplicationBytes.Length > 0 ||
virtualAmiiboFile.ApplicationAreas.Any(item => item.ApplicationAreaId == applicationAreaId))
{ {
OpenedApplicationAreaId = applicationAreaId; OpenedApplicationAreaId = applicationAreaId;
return true; return true;
} }
if (virtualAmiiboFile.ApplicationAreas.Any(item => item.ApplicationAreaId == applicationAreaId))
{
OpenedApplicationAreaId = applicationAreaId;
return true;
}
return false; return false;
} }
@ -161,7 +155,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
return false; return false;
} }
virtualAmiiboFile.ApplicationAreas.Add(new VirtualAmiiboApplicationArea() virtualAmiiboFile.ApplicationAreas.Add(new VirtualAmiiboApplicationArea
{ {
ApplicationAreaId = applicationAreaId, ApplicationAreaId = applicationAreaId,
ApplicationArea = applicationAreaData, ApplicationArea = applicationAreaData,
@ -187,7 +181,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
{ {
if (virtualAmiiboFile.ApplicationAreas[i].ApplicationAreaId == OpenedApplicationAreaId) if (virtualAmiiboFile.ApplicationAreas[i].ApplicationAreaId == OpenedApplicationAreaId)
{ {
virtualAmiiboFile.ApplicationAreas[i] = new VirtualAmiiboApplicationArea() virtualAmiiboFile.ApplicationAreas[i] = new VirtualAmiiboApplicationArea
{ {
ApplicationAreaId = OpenedApplicationAreaId, ApplicationAreaId = OpenedApplicationAreaId,
ApplicationArea = applicationAreaData, ApplicationArea = applicationAreaData,
@ -215,7 +209,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
} }
else else
{ {
virtualAmiiboFile = new VirtualAmiiboFile() virtualAmiiboFile = new VirtualAmiiboFile
{ {
FileVersion = 0, FileVersion = 0,
TagUuid = [], TagUuid = [],

View file

@ -117,11 +117,8 @@ namespace Ryujinx.HLE.HOS.Services.Ro
{ {
return ResultCode.TooManyNro; return ResultCode.TooManyNro;
} }
else if (nroSize == 0 || nroAddress + nroSize <= nroAddress || (nroSize & 0xFFF) != 0) else if (nroSize == 0 || nroAddress + nroSize <= nroAddress || (nroSize & 0xFFF) != 0 ||
{ bssSize != 0 && bssAddress + bssSize <= bssAddress)
return ResultCode.InvalidSize;
}
else if (bssSize != 0 && bssAddress + bssSize <= bssAddress)
{ {
return ResultCode.InvalidSize; return ResultCode.InvalidSize;
} }

View file

@ -366,12 +366,8 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
int maxBufferCount = Core.GetMaxBufferCountLocked(input.Async != 0); int maxBufferCount = Core.GetMaxBufferCountLocked(input.Async != 0);
if (input.Async != 0 && Core.OverrideMaxBufferCount != 0 && Core.OverrideMaxBufferCount < maxBufferCount) if (input.Async != 0 && Core.OverrideMaxBufferCount != 0 && Core.OverrideMaxBufferCount < maxBufferCount ||
{ slot < 0 || slot >= Core.Slots.Length || !Core.IsOwnedByProducerLocked(slot))
return Status.BadValue;
}
if (slot < 0 || slot >= Core.Slots.Length || !Core.IsOwnedByProducerLocked(slot))
{ {
return Status.BadValue; return Status.BadValue;
} }

View file

@ -236,14 +236,8 @@ namespace Ryujinx.HLE.Loaders.Mods
var tokens = line.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries); var tokens = line.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries);
if (tokens.Length < 2) if (tokens.Length < 2 ||
{ !int.TryParse(tokens[0], System.Globalization.NumberStyles.HexNumber, null, out int offset))
ParseWarn();
continue;
}
if (!int.TryParse(tokens[0], System.Globalization.NumberStyles.HexNumber, null, out int offset))
{ {
ParseWarn(); ParseWarn();

View file

@ -112,12 +112,8 @@ namespace Ryujinx.Horizon.Sdk.Codec.Detail
return CodecResult.InvalidChannelCount; return CodecResult.InvalidChannelCount;
} }
if (!IsValidSampleRate(parameter.SampleRate)) if (!IsValidSampleRate(parameter.SampleRate)
{ || !IsValidNumberOfStreams(parameter.NumberOfStreams, parameter.NumberOfStereoStreams, parameter.ChannelsCount))
return CodecResult.InvalidSampleRate;
}
if (!IsValidNumberOfStreams(parameter.NumberOfStreams, parameter.NumberOfStereoStreams, parameter.ChannelsCount))
{ {
return CodecResult.InvalidSampleRate; return CodecResult.InvalidSampleRate;
} }
@ -262,12 +258,8 @@ namespace Ryujinx.Horizon.Sdk.Codec.Detail
return CodecResult.InvalidChannelCount; return CodecResult.InvalidChannelCount;
} }
if (!IsValidSampleRate(parameter.SampleRate)) if (!IsValidSampleRate(parameter.SampleRate)
{ || !IsValidNumberOfStreams(parameter.NumberOfStreams, parameter.NumberOfStereoStreams, parameter.ChannelsCount))
return CodecResult.InvalidSampleRate;
}
if (!IsValidNumberOfStreams(parameter.NumberOfStreams, parameter.NumberOfStereoStreams, parameter.ChannelsCount))
{ {
return CodecResult.InvalidSampleRate; return CodecResult.InvalidSampleRate;
} }

View file

@ -352,14 +352,11 @@ namespace Ryujinx.Input.SDL2
public (float, float) GetStick(StickInputId inputId) public (float, float) GetStick(StickInputId inputId)
{ {
if (inputId == StickInputId.Unbound) if (inputId == StickInputId.Unbound ||
inputId == StickInputId.Left && _joyConType == JoyConType.Right ||
inputId == StickInputId.Right && _joyConType == JoyConType.Left)
return (0.0f, 0.0f); return (0.0f, 0.0f);
if (inputId == StickInputId.Left && _joyConType == JoyConType.Right || inputId == StickInputId.Right && _joyConType == JoyConType.Left)
{
return (0.0f, 0.0f);
}
(short stickX, short stickY) = GetStickXY(); (short stickX, short stickY) = GetStickXY();
float resultX = ConvertRawStickValue(stickX); float resultX = ConvertRawStickValue(stickX);

View file

@ -94,12 +94,8 @@ namespace Ryujinx.Memory
throw new SystemException(Marshal.GetLastPInvokeErrorMessage()); throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
} }
if (madvise(address, size, MADV_REMOVE) != 0) if (madvise(address, size, MADV_REMOVE) != 0
{ || mprotect(address, size, MmapProts.PROT_NONE) != 0)
throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
}
if (mprotect(address, size, MmapProts.PROT_NONE) != 0)
{ {
throw new SystemException(Marshal.GetLastPInvokeErrorMessage()); throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
} }
@ -186,12 +182,7 @@ namespace Ryujinx.Memory
fixed (byte* pFileName = fileName) fixed (byte* pFileName = fileName)
{ {
fd = mkstemp((IntPtr)pFileName); fd = mkstemp((IntPtr)pFileName);
if (fd == -1) if (fd == -1 || unlink((IntPtr)pFileName) != 0)
{
throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
}
if (unlink((IntPtr)pFileName) != 0)
{ {
throw new SystemException(Marshal.GetLastPInvokeErrorMessage()); throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
} }