mirror of
https://git.ryujinx.app/kenji-nx/ryujinx.git
synced 2025-12-18 10:37:04 +00:00
misc: chore: Merge duplicated 'if' branches
This commit is contained in:
parent
dfb6164ba5
commit
d773bd60f4
22 changed files with 76 additions and 306 deletions
|
|
@ -244,56 +244,14 @@ namespace ARMeilleure.Translation.PTC
|
|||
{
|
||||
OuterHeader outerHeader = DeserializeStructure<OuterHeader>(compressedStream);
|
||||
|
||||
if (!outerHeader.IsHeaderValid())
|
||||
{
|
||||
InvalidateCompressedStream(compressedStream);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (outerHeader.Magic != _outerHeaderMagic)
|
||||
{
|
||||
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)
|
||||
if (!outerHeader.IsHeaderValid() ||
|
||||
outerHeader.Magic != _outerHeaderMagic ||
|
||||
outerHeader.CacheFileVersion != InternalVersion ||
|
||||
outerHeader.Endianness != GetEndianness() ||
|
||||
outerHeader.FeatureInfo != GetFeatureInfo() ||
|
||||
outerHeader.MemoryManagerMode != GetMemoryManagerMode() ||
|
||||
outerHeader.OSPlatform != GetOSPlatform() ||
|
||||
outerHeader.Architecture != (uint)RuntimeInformation.ProcessArchitecture)
|
||||
{
|
||||
InvalidateCompressedStream(compressedStream);
|
||||
|
||||
|
|
@ -324,14 +282,7 @@ namespace ARMeilleure.Translation.PTC
|
|||
|
||||
InnerHeader innerHeader = DeserializeStructure<InnerHeader>(stream);
|
||||
|
||||
if (!innerHeader.IsHeaderValid())
|
||||
{
|
||||
InvalidateCompressedStream(compressedStream);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (innerHeader.Magic != _innerHeaderMagic)
|
||||
if (!innerHeader.IsHeaderValid() || innerHeader.Magic != _innerHeaderMagic)
|
||||
{
|
||||
InvalidateCompressedStream(compressedStream);
|
||||
|
||||
|
|
|
|||
|
|
@ -189,28 +189,10 @@ namespace ARMeilleure.Translation.PTC
|
|||
{
|
||||
OuterHeader outerHeader = DeserializeStructure<OuterHeader>(compressedStream);
|
||||
|
||||
if (!outerHeader.IsHeaderValid())
|
||||
{
|
||||
InvalidateCompressedStream(compressedStream);
|
||||
|
||||
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())
|
||||
if (!outerHeader.IsHeaderValid() ||
|
||||
outerHeader.Magic != _outerHeaderMagic ||
|
||||
outerHeader.InfoFileVersion != InternalVersion && !_migrateInternalVersions.Contains(outerHeader.InfoFileVersion) ||
|
||||
outerHeader.Endianness != Ptc.GetEndianness())
|
||||
{
|
||||
InvalidateCompressedStream(compressedStream);
|
||||
|
||||
|
|
|
|||
|
|
@ -262,12 +262,8 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||
return UpdateResult.Success;
|
||||
}
|
||||
|
||||
if (inParameter.CpuAddress == 0 || (inParameter.CpuAddress % PageSize) != 0)
|
||||
{
|
||||
return UpdateResult.InvalidParameter;
|
||||
}
|
||||
|
||||
if (inParameter.Size == 0 || (inParameter.Size % PageSize) != 0)
|
||||
if (inParameter.CpuAddress == 0 || (inParameter.CpuAddress % PageSize) != 0 ||
|
||||
inParameter.Size == 0 || (inParameter.Size % PageSize) != 0)
|
||||
{
|
||||
return UpdateResult.InvalidParameter;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -409,12 +409,8 @@ namespace Ryujinx.Cpu.Jit
|
|||
|
||||
for (int page = 0; page < pages - 1; page++)
|
||||
{
|
||||
if (!ValidateAddress(va + PageSize))
|
||||
{
|
||||
return contiguousSize;
|
||||
}
|
||||
|
||||
if (GetPhysicalAddressInternal(va) + PageSize != GetPhysicalAddressInternal(va + PageSize))
|
||||
if (!ValidateAddress(va + PageSize) ||
|
||||
GetPhysicalAddressInternal(va) + PageSize != GetPhysicalAddressInternal(va + PageSize))
|
||||
{
|
||||
return contiguousSize;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -852,11 +852,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||
bool hasDepth = dsFormat.Format.HasDepth();
|
||||
bool hasStencil = dsFormat.Format.HasStencil();
|
||||
|
||||
if (hasStencil && (!clearStencil || (clearAffectedByStencilMask && _state.State.StencilTestState.FrontMask != 0xff)))
|
||||
{
|
||||
fullClear = false;
|
||||
}
|
||||
else if (hasDepth && !clearDepth)
|
||||
if (hasStencil && (!clearStencil || (clearAffectedByStencilMask && _state.State.StencilTestState.FrontMask != 0xff)) ||
|
||||
hasDepth && !clearDepth)
|
||||
{
|
||||
fullClear = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1187,12 +1187,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
return matchQuality;
|
||||
}
|
||||
|
||||
if (!TextureCompatibility.LayoutMatches(Info, info))
|
||||
{
|
||||
return TextureMatchQuality.NoMatch;
|
||||
}
|
||||
|
||||
if (!TextureCompatibility.SizeMatches(Info, info, forSampler))
|
||||
if (!TextureCompatibility.LayoutMatches(Info, info)
|
||||
|| !TextureCompatibility.SizeMatches(Info, info, forSampler))
|
||||
{
|
||||
return TextureMatchQuality.NoMatch;
|
||||
}
|
||||
|
|
@ -1277,17 +1273,9 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
|
||||
int offset = Range.FindOffset(range);
|
||||
|
||||
if (offset < 0 || !_sizeInfo.FindView(offset, out firstLayer, out firstLevel))
|
||||
{
|
||||
return TextureViewCompatibility.LayoutIncompatible;
|
||||
}
|
||||
|
||||
if (!TextureCompatibility.ViewLayoutCompatible(Info, info, firstLevel))
|
||||
{
|
||||
return TextureViewCompatibility.LayoutIncompatible;
|
||||
}
|
||||
|
||||
if (info.GetSlices() > 1 && LayerSize != layerSize)
|
||||
if (offset < 0 || !_sizeInfo.FindView(offset, out firstLayer, out firstLevel) ||
|
||||
!TextureCompatibility.ViewLayoutCompatible(Info, info, firstLevel) ||
|
||||
info.GetSlices() > 1 && LayerSize != layerSize)
|
||||
{
|
||||
return TextureViewCompatibility.LayoutIncompatible;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,11 +243,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
}
|
||||
else if ((lhs.FormatInfo.Format == Format.D24UnormS8Uint ||
|
||||
lhs.FormatInfo.Format == Format.S8UintD24Unorm ||
|
||||
lhs.FormatInfo.Format == Format.X8UintD24Unorm) && rhs.FormatInfo.Format == Format.B8G8R8A8Unorm)
|
||||
{
|
||||
return TextureMatchQuality.FormatAlias;
|
||||
}
|
||||
else if (lhs.FormatInfo.Format == Format.D32FloatS8Uint && rhs.FormatInfo.Format == Format.R32G32Float)
|
||||
lhs.FormatInfo.Format == Format.X8UintD24Unorm) && rhs.FormatInfo.Format == Format.B8G8R8A8Unorm ||
|
||||
lhs.FormatInfo.Format == Format.D32FloatS8Uint && rhs.FormatInfo.Format == Format.R32G32Float)
|
||||
{
|
||||
return TextureMatchQuality.FormatAlias;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,11 +62,8 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native
|
|||
NativeLibrary.SetDllImportResolver(typeof(FFmpegApi).Assembly, (name, assembly, path) =>
|
||||
{
|
||||
|
||||
if (name == AvUtilLibraryName && TryLoadWhitelistedLibrary(AvUtilLibraryName, assembly, path, out nint handle))
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
else if (name == AvCodecLibraryName && TryLoadWhitelistedLibrary(AvCodecLibraryName, assembly, path, out handle))
|
||||
if (name == AvUtilLibraryName && TryLoadWhitelistedLibrary(AvUtilLibraryName, assembly, path, out nint handle) ||
|
||||
name == AvCodecLibraryName && TryLoadWhitelistedLibrary(AvCodecLibraryName, assembly, path, out handle))
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -275,12 +275,8 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
{
|
||||
location = 0;
|
||||
|
||||
if (!_attributes.TryGetValue(offset, out AttributeEntry entry))
|
||||
{
|
||||
return IoVariable.Invalid;
|
||||
}
|
||||
|
||||
if (((StagesMask)(1 << (int)definitions.Stage) & entry.OutputMask) == StagesMask.None)
|
||||
if (!_attributes.TryGetValue(offset, out AttributeEntry entry) ||
|
||||
((StagesMask)(1 << (int)definitions.Stage) & entry.OutputMask) == StagesMask.None)
|
||||
{
|
||||
return IoVariable.Invalid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,11 +368,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
copyCount += coordsCount * 2;
|
||||
}
|
||||
|
||||
if (isMultisample)
|
||||
{
|
||||
copyCount++;
|
||||
}
|
||||
else if (hasLodLevel)
|
||||
if (isMultisample || hasLodLevel)
|
||||
{
|
||||
copyCount++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,29 +276,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
|
|||
WakeClientThread(request, clientResult);
|
||||
}
|
||||
|
||||
if (clientHeader.ReceiveListType < 2 &&
|
||||
clientHeader.ReceiveListOffset > clientMsg.Size)
|
||||
{
|
||||
CleanUpForError();
|
||||
|
||||
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)
|
||||
if (clientHeader.ReceiveListType < 2 && clientHeader.ReceiveListOffset > clientMsg.Size ||
|
||||
clientHeader.ReceiveListType == 2 && clientHeader.ReceiveListOffset + 8 > clientMsg.Size ||
|
||||
clientHeader.ReceiveListType > 2 && clientHeader.ReceiveListType * 8 - 0x10 + clientHeader.ReceiveListOffset > clientMsg.Size ||
|
||||
clientHeader.ReceiveListOffsetInWords < clientHeader.MessageSizeInWords)
|
||||
{
|
||||
CleanUpForError();
|
||||
|
||||
|
|
@ -629,29 +610,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
|
|||
FinishRequest(request, clientResult);
|
||||
}
|
||||
|
||||
if (clientHeader.ReceiveListType < 2 &&
|
||||
clientHeader.ReceiveListOffset > clientMsg.Size)
|
||||
{
|
||||
CleanUpForError();
|
||||
|
||||
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)
|
||||
if (clientHeader.ReceiveListType < 2 && clientHeader.ReceiveListOffset > clientMsg.Size ||
|
||||
clientHeader.ReceiveListType == 2 && clientHeader.ReceiveListOffset + 8 > clientMsg.Size ||
|
||||
clientHeader.ReceiveListType > 2 && clientHeader.ReceiveListType * 8 - 0x10 + clientHeader.ReceiveListOffset > clientMsg.Size ||
|
||||
clientHeader.ReceiveListOffsetInWords < clientHeader.MessageSizeInWords)
|
||||
{
|
||||
CleanUpForError();
|
||||
|
||||
|
|
|
|||
|
|
@ -442,17 +442,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
|||
|
||||
ulong addrSpacePagesCount = (AddressSpaceEnd - AddressSpaceStart) / PageSize;
|
||||
|
||||
if (AddressSpaceStart > address)
|
||||
{
|
||||
return KernelResult.InvalidMemState;
|
||||
}
|
||||
|
||||
if (addrSpacePagesCount < pagesCount)
|
||||
{
|
||||
return KernelResult.InvalidMemState;
|
||||
}
|
||||
|
||||
if (endAddr - 1 > AddressSpaceEnd - 1)
|
||||
if (AddressSpaceStart > address || addrSpacePagesCount < pagesCount || endAddr - 1 > AddressSpaceEnd - 1)
|
||||
{
|
||||
return KernelResult.InvalidMemState;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -309,17 +309,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
|
||||
if (KernelContext.EnableVersionChecks)
|
||||
{
|
||||
if (requiredKernelVersionMajor > KernelVersionMajor)
|
||||
{
|
||||
return KernelResult.InvalidCombination;
|
||||
}
|
||||
|
||||
if (requiredKernelVersionMajor != KernelVersionMajor && requiredKernelVersionMajor < 3)
|
||||
{
|
||||
return KernelResult.InvalidCombination;
|
||||
}
|
||||
|
||||
if (requiredKernelVersionMinor > KernelVersionMinor)
|
||||
if (requiredKernelVersionMajor > KernelVersionMajor ||
|
||||
requiredKernelVersionMajor != KernelVersionMajor && requiredKernelVersionMajor < 3 ||
|
||||
requiredKernelVersionMinor > KernelVersionMinor)
|
||||
{
|
||||
return KernelResult.InvalidCombination;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -535,12 +535,8 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||
|
||||
ulong copySize = (ulong)((long)handlesCount * 4);
|
||||
|
||||
if (!currentProcess.MemoryManager.InsideAddrSpace(handlesPtr, copySize))
|
||||
{
|
||||
return KernelResult.UserCopyFailed;
|
||||
}
|
||||
|
||||
if (handlesPtr + copySize < handlesPtr)
|
||||
if (!currentProcess.MemoryManager.InsideAddrSpace(handlesPtr, copySize) ||
|
||||
handlesPtr + copySize < handlesPtr)
|
||||
{
|
||||
return KernelResult.UserCopyFailed;
|
||||
}
|
||||
|
|
@ -647,12 +643,8 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||
|
||||
ulong copySize = (ulong)((long)handlesCount * 4);
|
||||
|
||||
if (!currentProcess.MemoryManager.InsideAddrSpace(handlesPtr, copySize))
|
||||
{
|
||||
return KernelResult.UserCopyFailed;
|
||||
}
|
||||
|
||||
if (handlesPtr + copySize < handlesPtr)
|
||||
if (!currentProcess.MemoryManager.InsideAddrSpace(handlesPtr, copySize) ||
|
||||
handlesPtr + copySize < handlesPtr)
|
||||
{
|
||||
return KernelResult.UserCopyFailed;
|
||||
}
|
||||
|
|
@ -2268,12 +2260,8 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||
|
||||
ulong copySize = (ulong)maxCount * 8;
|
||||
|
||||
if (address + copySize <= address)
|
||||
{
|
||||
return KernelResult.InvalidMemState;
|
||||
}
|
||||
|
||||
if (currentProcess.MemoryManager.OutsideAddrSpace(address, copySize))
|
||||
if (address + copySize <= address ||
|
||||
currentProcess.MemoryManager.OutsideAddrSpace(address, copySize))
|
||||
{
|
||||
return KernelResult.InvalidMemState;
|
||||
}
|
||||
|
|
@ -2742,12 +2730,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||
|
||||
KThread thread = process.HandleTable.GetObject<KThread>(handle);
|
||||
|
||||
if (thread == null)
|
||||
{
|
||||
return KernelResult.InvalidHandle;
|
||||
}
|
||||
|
||||
if (thread.Owner != process)
|
||||
if (thread == null || thread.Owner != process)
|
||||
{
|
||||
return KernelResult.InvalidHandle;
|
||||
}
|
||||
|
|
@ -2768,12 +2751,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||
|
||||
KThread thread = currentProcess.HandleTable.GetObject<KThread>(handle);
|
||||
|
||||
if (thread == null)
|
||||
{
|
||||
return KernelResult.InvalidHandle;
|
||||
}
|
||||
|
||||
if (thread.Owner != currentProcess)
|
||||
if (thread == null || thread.Owner != currentProcess)
|
||||
{
|
||||
return KernelResult.InvalidHandle;
|
||||
}
|
||||
|
|
@ -2820,12 +2798,8 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||
|
||||
long handlesSize = handlesCount * 4;
|
||||
|
||||
if (handlesPtr + (ulong)handlesSize <= handlesPtr)
|
||||
{
|
||||
return KernelResult.UserCopyFailed;
|
||||
}
|
||||
|
||||
if (handlesPtr + (ulong)handlesSize - 1 > currentProcess.MemoryManager.AddressSpaceEnd - 1)
|
||||
if (handlesPtr + (ulong)handlesSize <= handlesPtr ||
|
||||
handlesPtr + (ulong)handlesSize - 1 > currentProcess.MemoryManager.AddressSpaceEnd - 1)
|
||||
{
|
||||
return KernelResult.UserCopyFailed;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,12 +214,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
|||
DeviceType deviceType = (DeviceType)context.RequestData.ReadUInt32();
|
||||
MountTarget mountTarget = (MountTarget)context.RequestData.ReadUInt32();
|
||||
|
||||
if (deviceType != 0)
|
||||
{
|
||||
return ResultCode.WrongArgument;
|
||||
}
|
||||
|
||||
if (((uint)mountTarget & 3) == 0)
|
||||
if (deviceType != 0 || ((uint)mountTarget & 3) == 0)
|
||||
{
|
||||
return ResultCode.WrongArgument;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
|||
{
|
||||
VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId);
|
||||
|
||||
return new CommonInfo()
|
||||
return new CommonInfo
|
||||
{
|
||||
LastWriteYear = (ushort)amiiboFile.LastWriteDate.Year,
|
||||
LastWriteMonth = (byte)amiiboFile.LastWriteDate.Month,
|
||||
|
|
@ -115,19 +115,13 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
|||
public static bool OpenApplicationArea(string amiiboId, uint applicationAreaId)
|
||||
{
|
||||
VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId);
|
||||
if (ApplicationBytes.Length > 0)
|
||||
if (ApplicationBytes.Length > 0 ||
|
||||
virtualAmiiboFile.ApplicationAreas.Any(item => item.ApplicationAreaId == applicationAreaId))
|
||||
{
|
||||
OpenedApplicationAreaId = applicationAreaId;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (virtualAmiiboFile.ApplicationAreas.Any(item => item.ApplicationAreaId == applicationAreaId))
|
||||
{
|
||||
OpenedApplicationAreaId = applicationAreaId;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -161,7 +155,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
|||
return false;
|
||||
}
|
||||
|
||||
virtualAmiiboFile.ApplicationAreas.Add(new VirtualAmiiboApplicationArea()
|
||||
virtualAmiiboFile.ApplicationAreas.Add(new VirtualAmiiboApplicationArea
|
||||
{
|
||||
ApplicationAreaId = applicationAreaId,
|
||||
ApplicationArea = applicationAreaData,
|
||||
|
|
@ -187,7 +181,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
|||
{
|
||||
if (virtualAmiiboFile.ApplicationAreas[i].ApplicationAreaId == OpenedApplicationAreaId)
|
||||
{
|
||||
virtualAmiiboFile.ApplicationAreas[i] = new VirtualAmiiboApplicationArea()
|
||||
virtualAmiiboFile.ApplicationAreas[i] = new VirtualAmiiboApplicationArea
|
||||
{
|
||||
ApplicationAreaId = OpenedApplicationAreaId,
|
||||
ApplicationArea = applicationAreaData,
|
||||
|
|
@ -215,7 +209,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
|||
}
|
||||
else
|
||||
{
|
||||
virtualAmiiboFile = new VirtualAmiiboFile()
|
||||
virtualAmiiboFile = new VirtualAmiiboFile
|
||||
{
|
||||
FileVersion = 0,
|
||||
TagUuid = [],
|
||||
|
|
|
|||
|
|
@ -117,11 +117,8 @@ namespace Ryujinx.HLE.HOS.Services.Ro
|
|||
{
|
||||
return ResultCode.TooManyNro;
|
||||
}
|
||||
else if (nroSize == 0 || nroAddress + nroSize <= nroAddress || (nroSize & 0xFFF) != 0)
|
||||
{
|
||||
return ResultCode.InvalidSize;
|
||||
}
|
||||
else if (bssSize != 0 && bssAddress + bssSize <= bssAddress)
|
||||
else if (nroSize == 0 || nroAddress + nroSize <= nroAddress || (nroSize & 0xFFF) != 0 ||
|
||||
bssSize != 0 && bssAddress + bssSize <= bssAddress)
|
||||
{
|
||||
return ResultCode.InvalidSize;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -366,12 +366,8 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
|||
|
||||
int maxBufferCount = Core.GetMaxBufferCountLocked(input.Async != 0);
|
||||
|
||||
if (input.Async != 0 && Core.OverrideMaxBufferCount != 0 && Core.OverrideMaxBufferCount < maxBufferCount)
|
||||
{
|
||||
return Status.BadValue;
|
||||
}
|
||||
|
||||
if (slot < 0 || slot >= Core.Slots.Length || !Core.IsOwnedByProducerLocked(slot))
|
||||
if (input.Async != 0 && Core.OverrideMaxBufferCount != 0 && Core.OverrideMaxBufferCount < maxBufferCount ||
|
||||
slot < 0 || slot >= Core.Slots.Length || !Core.IsOwnedByProducerLocked(slot))
|
||||
{
|
||||
return Status.BadValue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,14 +236,8 @@ namespace Ryujinx.HLE.Loaders.Mods
|
|||
|
||||
var tokens = line.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (tokens.Length < 2)
|
||||
{
|
||||
ParseWarn();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!int.TryParse(tokens[0], System.Globalization.NumberStyles.HexNumber, null, out int offset))
|
||||
if (tokens.Length < 2 ||
|
||||
!int.TryParse(tokens[0], System.Globalization.NumberStyles.HexNumber, null, out int offset))
|
||||
{
|
||||
ParseWarn();
|
||||
|
||||
|
|
|
|||
|
|
@ -112,12 +112,8 @@ namespace Ryujinx.Horizon.Sdk.Codec.Detail
|
|||
return CodecResult.InvalidChannelCount;
|
||||
}
|
||||
|
||||
if (!IsValidSampleRate(parameter.SampleRate))
|
||||
{
|
||||
return CodecResult.InvalidSampleRate;
|
||||
}
|
||||
|
||||
if (!IsValidNumberOfStreams(parameter.NumberOfStreams, parameter.NumberOfStereoStreams, parameter.ChannelsCount))
|
||||
if (!IsValidSampleRate(parameter.SampleRate)
|
||||
|| !IsValidNumberOfStreams(parameter.NumberOfStreams, parameter.NumberOfStereoStreams, parameter.ChannelsCount))
|
||||
{
|
||||
return CodecResult.InvalidSampleRate;
|
||||
}
|
||||
|
|
@ -262,12 +258,8 @@ namespace Ryujinx.Horizon.Sdk.Codec.Detail
|
|||
return CodecResult.InvalidChannelCount;
|
||||
}
|
||||
|
||||
if (!IsValidSampleRate(parameter.SampleRate))
|
||||
{
|
||||
return CodecResult.InvalidSampleRate;
|
||||
}
|
||||
|
||||
if (!IsValidNumberOfStreams(parameter.NumberOfStreams, parameter.NumberOfStereoStreams, parameter.ChannelsCount))
|
||||
if (!IsValidSampleRate(parameter.SampleRate)
|
||||
|| !IsValidNumberOfStreams(parameter.NumberOfStreams, parameter.NumberOfStereoStreams, parameter.ChannelsCount))
|
||||
{
|
||||
return CodecResult.InvalidSampleRate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -352,14 +352,11 @@ namespace Ryujinx.Input.SDL2
|
|||
|
||||
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);
|
||||
|
||||
if (inputId == StickInputId.Left && _joyConType == JoyConType.Right || inputId == StickInputId.Right && _joyConType == JoyConType.Left)
|
||||
{
|
||||
return (0.0f, 0.0f);
|
||||
}
|
||||
|
||||
(short stickX, short stickY) = GetStickXY();
|
||||
|
||||
float resultX = ConvertRawStickValue(stickX);
|
||||
|
|
|
|||
|
|
@ -94,12 +94,8 @@ namespace Ryujinx.Memory
|
|||
throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
|
||||
}
|
||||
|
||||
if (madvise(address, size, MADV_REMOVE) != 0)
|
||||
{
|
||||
throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
|
||||
}
|
||||
|
||||
if (mprotect(address, size, MmapProts.PROT_NONE) != 0)
|
||||
if (madvise(address, size, MADV_REMOVE) != 0
|
||||
|| mprotect(address, size, MmapProts.PROT_NONE) != 0)
|
||||
{
|
||||
throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
|
||||
}
|
||||
|
|
@ -186,12 +182,7 @@ namespace Ryujinx.Memory
|
|||
fixed (byte* pFileName = fileName)
|
||||
{
|
||||
fd = mkstemp((IntPtr)pFileName);
|
||||
if (fd == -1)
|
||||
{
|
||||
throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
|
||||
}
|
||||
|
||||
if (unlink((IntPtr)pFileName) != 0)
|
||||
if (fd == -1 || unlink((IntPtr)pFileName) != 0)
|
||||
{
|
||||
throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue