diff --git a/src/LibKenjinx/Android/JniExportedMethods.cs b/src/LibKenjinx/Android/JniExportedMethods.cs index e20820ebd..5fcee35fb 100644 --- a/src/LibKenjinx/Android/JniExportedMethods.cs +++ b/src/LibKenjinx/Android/JniExportedMethods.cs @@ -560,7 +560,7 @@ namespace LibKenjinx _surfacePtr = Interop.GetSurfacePtr(); _window = Interop.GetWindowsHandle(); - Vk? api = VulkanLoader?.GetApi() ?? Vk.GetApi(); + Vk api = VulkanLoader?.GetApi() ?? Vk.GetApi(); if (api.TryGetInstanceExtension(new Instance(instance), out KhrAndroidSurface surfaceExtension)) { AndroidSurfaceCreateInfoKHR createInfo = new() @@ -569,7 +569,7 @@ namespace LibKenjinx Window = (nint*)_surfacePtr, }; - Result result = surfaceExtension.CreateAndroidSurface(new Instance(instance), in createInfo, null, out SurfaceKHR* surface); + Result result = surfaceExtension.CreateAndroidSurface(new Instance(instance), in createInfo, null, out SurfaceKHR surface); // If a rotation was applied before the surface was created → apply it now if (_window != 0 && _pendingRotationDegrees != -1) diff --git a/src/LibKenjinx/LibKenjinx.cs b/src/LibKenjinx/LibKenjinx.cs index 781772cf6..4b68e2b31 100644 --- a/src/LibKenjinx/LibKenjinx.cs +++ b/src/LibKenjinx/LibKenjinx.cs @@ -1,12 +1,12 @@ // State class for the library using Gommon; -using LibHac; using LibHac.Account; using LibHac.Common; using LibHac.Common.Keys; using LibHac.Fs; using LibHac.Fs.Fsa; using LibHac.FsSystem; +using LibHac.Ns; using LibHac.Tools.Fs; using LibHac.Tools.FsSystem; using LibHac.Tools.FsSystem.NcaUtils; @@ -42,6 +42,7 @@ using System.Text; using System.Text.Json; using ApplicationId = LibHac.Ncm.ApplicationId; using Path = System.IO.Path; +using Result = LibHac.Result; using VSyncMode = Ryujinx.Common.Configuration.VSyncMode; namespace LibKenjinx @@ -109,7 +110,7 @@ namespace LibKenjinx { return new GameStats(); } - Switch? context = SwitchDevice.EmulationContext; + Switch context = SwitchDevice.EmulationContext; return new GameStats { @@ -362,7 +363,7 @@ namespace LibKenjinx if (string.IsNullOrWhiteSpace(titleName)) { - foreach (ref readonly var controlTitle in controlData.Title) + foreach (ref readonly ApplicationControlProperty.ApplicationTitle controlTitle in controlData.Title) { if (!controlTitle.NameString.IsEmpty()) { @@ -375,7 +376,7 @@ namespace LibKenjinx if (string.IsNullOrWhiteSpace(publisher)) { - foreach (ref readonly var controlTitle in controlData.Title) + foreach (ref readonly ApplicationControlProperty.ApplicationTitle controlTitle in controlData.Title) { if (!controlTitle.PublisherString.IsEmpty()) { @@ -1203,14 +1204,14 @@ namespace LibKenjinx int idx = (int)Language.AmericanEnglish; if (control.Title.Length > idx) { - string? s = control.Title[idx].NameString.ToString(); + string s = control.Title[idx].NameString.ToString(); if (!string.IsNullOrWhiteSpace(s)) return s; } // Fallback: first non-empty localization - foreach (ref readonly var t in control.Title) + foreach (ref readonly ApplicationControlProperty.ApplicationTitle t in control.Title) { - var s = t.NameString.ToString(); + string s = t.NameString.ToString(); if (!string.IsNullOrWhiteSpace(s)) return s; } } diff --git a/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs b/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs index 2df1311ff..93bb9530c 100644 --- a/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs +++ b/src/Ryujinx.Graphics.Vulkan/BufferHolder.cs @@ -126,7 +126,7 @@ namespace Ryujinx.Graphics.Vulkan Range = (uint)size, }; - _gd.Api.CreateBufferView(_device, in bufferViewCreateInfo, null, out BufferView* bufferView).ThrowOnError(); + _gd.Api.CreateBufferView(_device, in bufferViewCreateInfo, null, out BufferView bufferView).ThrowOnError(); return new Auto(new DisposableBufferView(_gd.Api, _device, bufferView), this, _waitable, _buffer); } diff --git a/src/Ryujinx.Graphics.Vulkan/BufferManager.cs b/src/Ryujinx.Graphics.Vulkan/BufferManager.cs index bf89d63dd..5b420e620 100644 --- a/src/Ryujinx.Graphics.Vulkan/BufferManager.cs +++ b/src/Ryujinx.Graphics.Vulkan/BufferManager.cs @@ -118,13 +118,13 @@ namespace Ryujinx.Graphics.Vulkan PNext = &externalMemoryBuffer, }; - gd.Api.CreateBuffer(_device, in bufferCreateInfo, null, out VkBuffer* buffer).ThrowOnError(); + gd.Api.CreateBuffer(_device, in bufferCreateInfo, null, out VkBuffer buffer).ThrowOnError(); (Auto allocation, ulong offset) = gd.HostMemoryAllocator.GetExistingAllocation(pointer, (ulong)size); gd.Api.BindBufferMemory(_device, buffer, allocation.GetUnsafe().Memory, allocation.GetUnsafe().Offset + offset); - BufferHolder holder = new BufferHolder(gd, _device, buffer, allocation, size, BufferAllocationType.HostMapped, BufferAllocationType.HostMapped, (int)offset); + BufferHolder holder = new(gd, _device, buffer, allocation, size, BufferAllocationType.HostMapped, BufferAllocationType.HostMapped, (int)offset); BufferCount++; @@ -158,7 +158,7 @@ namespace Ryujinx.Graphics.Vulkan Flags = BufferCreateFlags.SparseBindingBit | BufferCreateFlags.SparseAliasedBit }; - gd.Api.CreateBuffer(_device, in bufferCreateInfo, null, out VkBuffer* buffer).ThrowOnError(); + gd.Api.CreateBuffer(_device, in bufferCreateInfo, null, out VkBuffer buffer).ThrowOnError(); SparseMemoryBind[] memoryBinds = new SparseMemoryBind[storageBuffers.Length]; Auto[] storageAllocations = new Auto[storageBuffers.Length]; @@ -224,7 +224,7 @@ namespace Ryujinx.Graphics.Vulkan gd.Api.QueueBindSparse(gd.Queue, 1, in bindSparseInfo, default).ThrowOnError(); } - BufferHolder holder = new BufferHolder(gd, _device, buffer, (int)size, storageAllocations); + BufferHolder holder = new(gd, _device, buffer, (int)size, storageAllocations); BufferCount++; @@ -303,7 +303,7 @@ namespace Ryujinx.Graphics.Vulkan SharingMode = SharingMode.Exclusive, }; - gd.Api.CreateBuffer(_device, in bufferCreateInfo, null, out VkBuffer* buffer).ThrowOnError(); + gd.Api.CreateBuffer(_device, in bufferCreateInfo, null, out VkBuffer buffer).ThrowOnError(); gd.Api.GetBufferMemoryRequirements(_device, buffer, out MemoryRequirements requirements); @@ -339,7 +339,7 @@ namespace Ryujinx.Graphics.Vulkan SharingMode = SharingMode.Exclusive, }; - gd.Api.CreateBuffer(_device, in bufferCreateInfo, null, out VkBuffer* buffer).ThrowOnError(); + gd.Api.CreateBuffer(_device, in bufferCreateInfo, null, out VkBuffer buffer).ThrowOnError(); gd.Api.GetBufferMemoryRequirements(_device, buffer, out MemoryRequirements requirements); if (sparseCompatible) diff --git a/src/Ryujinx.Graphics.Vulkan/FramebufferParams.cs b/src/Ryujinx.Graphics.Vulkan/FramebufferParams.cs index 0b6abb5b3..a0d1b50df 100644 --- a/src/Ryujinx.Graphics.Vulkan/FramebufferParams.cs +++ b/src/Ryujinx.Graphics.Vulkan/FramebufferParams.cs @@ -414,7 +414,7 @@ namespace Ryujinx.Graphics.Vulkan Layers = Layers, }; - api.CreateFramebuffer(_device, in framebufferCreateInfo, null, out Framebuffer* framebuffer).ThrowOnError(); + api.CreateFramebuffer(_device, in framebufferCreateInfo, null, out Framebuffer framebuffer).ThrowOnError(); return new Auto(new DisposableFramebuffer(api, _device, framebuffer), null, _attachments[..AttachmentsCount]); } diff --git a/src/Ryujinx.Graphics.Vulkan/HostMemoryAllocator.cs b/src/Ryujinx.Graphics.Vulkan/HostMemoryAllocator.cs index 2f5a343c5..657b4280b 100644 --- a/src/Ryujinx.Graphics.Vulkan/HostMemoryAllocator.cs +++ b/src/Ryujinx.Graphics.Vulkan/HostMemoryAllocator.cs @@ -123,7 +123,7 @@ namespace Ryujinx.Graphics.Vulkan PNext = &priorityInfo, }; - Result result = _api.AllocateMemory(_device, in memoryAllocateInfo, null, out DeviceMemory* deviceMemory); + Result result = _api.AllocateMemory(_device, in memoryAllocateInfo, null, out DeviceMemory deviceMemory); if (result < Result.Success) { @@ -131,7 +131,7 @@ namespace Ryujinx.Graphics.Vulkan return false; } - MemoryAllocation allocation = new MemoryAllocation(this, deviceMemory, pageAlignedPointer, 0, pageAlignedSize); + MemoryAllocation allocation = new(this, deviceMemory, pageAlignedPointer, 0, pageAlignedSize); Auto allocAuto = new(allocation); HostMemoryAllocation hostAlloc = new(allocAuto, pageAlignedPointer, pageAlignedSize); diff --git a/src/Ryujinx.Graphics.Vulkan/MemoryAllocatorBlockList.cs b/src/Ryujinx.Graphics.Vulkan/MemoryAllocatorBlockList.cs index dd9ac723d..311466877 100644 --- a/src/Ryujinx.Graphics.Vulkan/MemoryAllocatorBlockList.cs +++ b/src/Ryujinx.Graphics.Vulkan/MemoryAllocatorBlockList.cs @@ -220,7 +220,7 @@ namespace Ryujinx.Graphics.Vulkan MemoryTypeIndex = (uint)MemoryTypeIndex, }; - _api.AllocateMemory(_device, in memoryAllocateInfo, null, out DeviceMemory* deviceMemory).ThrowOnError(); + _api.AllocateMemory(_device, in memoryAllocateInfo, null, out DeviceMemory deviceMemory).ThrowOnError(); nint hostPointer = nint.Zero; @@ -231,7 +231,7 @@ namespace Ryujinx.Graphics.Vulkan hostPointer = (nint)pointer; } - Block newBlock = new Block(deviceMemory, hostPointer, blockAlignedSize); + Block newBlock = new(deviceMemory, hostPointer, blockAlignedSize); InsertBlock(newBlock); diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index da05401b6..aececee61 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -233,8 +233,8 @@ namespace Ryujinx.Graphics.Vulkan return; } - ClearValue clearValue = new ClearValue(null, new ClearDepthStencilValue(depthValue, (uint)stencilValue)); - int flags = depthMask ? ImageAspectFlags.DepthBit : 0; + ClearValue clearValue = new(null, new ClearDepthStencilValue(depthValue, (uint)stencilValue)); + ImageAspectFlags flags = depthMask ? ImageAspectFlags.DepthBit : 0; if (stencilMask) { @@ -257,7 +257,7 @@ namespace Ryujinx.Graphics.Vulkan BeginRenderPass(); - ClearAttachment attachment = new ClearAttachment(flags, 0, clearValue); + ClearAttachment attachment = new(flags, 0, clearValue); ClearRect clearRect = FramebufferParams.GetClearRect(ClearScissor, layer, layerCount); Gd.Api.CmdClearAttachments(CommandBuffer, 1, &attachment, 1, &clearRect); @@ -1722,7 +1722,7 @@ namespace Ryujinx.Graphics.Vulkan { FramebufferParams.InsertLoadOpBarriers(Gd, Cbs); - Rect2D renderArea = new Rect2D(null, new Extent2D(FramebufferParams.Width, FramebufferParams.Height)); + Rect2D renderArea = new(null, new Extent2D(FramebufferParams.Width, FramebufferParams.Height)); ClearValue clearValue = new(); RenderPassBeginInfo renderPassBeginInfo = new() diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs b/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs index abc074e0c..c259d91a9 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineConverter.cs @@ -126,7 +126,7 @@ namespace Ryujinx.Graphics.Vulkan DependencyCount = 1, }; - gd.Api.CreateRenderPass(device, in renderPassCreateInfo, null, out RenderPass* renderPass).ThrowOnError(); + gd.Api.CreateRenderPass(device, in renderPassCreateInfo, null, out RenderPass renderPass).ThrowOnError(); return new DisposableRenderPass(gd.Api, device, renderPass); } diff --git a/src/Ryujinx.Graphics.Vulkan/RenderPassHolder.cs b/src/Ryujinx.Graphics.Vulkan/RenderPassHolder.cs index b608e8d37..1c6108198 100644 --- a/src/Ryujinx.Graphics.Vulkan/RenderPassHolder.cs +++ b/src/Ryujinx.Graphics.Vulkan/RenderPassHolder.cs @@ -125,7 +125,7 @@ namespace Ryujinx.Graphics.Vulkan DependencyCount = 1, }; - gd.Api.CreateRenderPass(device, in renderPassCreateInfo, null, out RenderPass* renderPass).ThrowOnError(); + gd.Api.CreateRenderPass(device, in renderPassCreateInfo, null, out RenderPass renderPass).ThrowOnError(); _renderPass = new Auto(new DisposableRenderPass(gd.Api, device, renderPass)); } diff --git a/src/Ryujinx.Graphics.Vulkan/SamplerHolder.cs b/src/Ryujinx.Graphics.Vulkan/SamplerHolder.cs index 70c207f69..600f0fafc 100644 --- a/src/Ryujinx.Graphics.Vulkan/SamplerHolder.cs +++ b/src/Ryujinx.Graphics.Vulkan/SamplerHolder.cs @@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.Vulkan samplerCreateInfo.BorderColor = BorderColor.FloatCustomExt; } - gd.Api.CreateSampler(device, in samplerCreateInfo, null, out Sampler* sampler).ThrowOnError(); + gd.Api.CreateSampler(device, in samplerCreateInfo, null, out Sampler sampler).ThrowOnError(); _sampler = new Auto(new DisposableSampler(gd.Api, device, sampler)); } diff --git a/src/Ryujinx.Graphics.Vulkan/TextureCopy.cs b/src/Ryujinx.Graphics.Vulkan/TextureCopy.cs index 0fe5b539f..cacd1469d 100644 --- a/src/Ryujinx.Graphics.Vulkan/TextureCopy.cs +++ b/src/Ryujinx.Graphics.Vulkan/TextureCopy.cs @@ -59,8 +59,8 @@ namespace Ryujinx.Graphics.Vulkan dstAspectFlags = dstInfo.Format.ConvertAspectFlags(); } - var srcOffsets = new ImageBlit.SrcOffsetsBuffer(); - var dstOffsets = new ImageBlit.DstOffsetsBuffer(); + ImageBlit.SrcOffsetsBuffer srcOffsets = new(); + ImageBlit.DstOffsetsBuffer dstOffsets = new(); Filter filter = linearFilter && !dstInfo.Format.IsDepthOrStencil() ? Filter.Linear : Filter.Nearest; @@ -453,7 +453,7 @@ namespace Ryujinx.Graphics.Vulkan DependencyCount = 1, }; - gd.Api.CreateRenderPass2(device, in renderPassCreateInfo, null, out RenderPass* renderPass).ThrowOnError(); + gd.Api.CreateRenderPass2(device, in renderPassCreateInfo, null, out RenderPass renderPass).ThrowOnError(); using Auto rp = new(new DisposableRenderPass(gd.Api, device, renderPass)); @@ -476,10 +476,10 @@ namespace Ryujinx.Graphics.Vulkan Layers = (uint)src.Layers, }; - gd.Api.CreateFramebuffer(device, in framebufferCreateInfo, null, out Framebuffer* framebuffer).ThrowOnError(); + gd.Api.CreateFramebuffer(device, in framebufferCreateInfo, null, out Framebuffer framebuffer).ThrowOnError(); using Auto fb = new(new DisposableFramebuffer(gd.Api, device, framebuffer), null, srcView, dstView); - Rect2D renderArea = new Rect2D(null, new Extent2D((uint)src.Info.Width, (uint)src.Info.Height)); + Rect2D renderArea = new(null, new Extent2D((uint)src.Info.Width, (uint)src.Info.Height)); ClearValue clearValue = new(); RenderPassBeginInfo renderPassBeginInfo = new() diff --git a/src/Ryujinx.Graphics.Vulkan/TextureView.cs b/src/Ryujinx.Graphics.Vulkan/TextureView.cs index 9af4392cb..46e686e22 100644 --- a/src/Ryujinx.Graphics.Vulkan/TextureView.cs +++ b/src/Ryujinx.Graphics.Vulkan/TextureView.cs @@ -120,7 +120,7 @@ namespace Ryujinx.Graphics.Vulkan PNext = &imageViewUsage, }; - gd.Api.CreateImageView(device, in imageCreateInfo, null, out ImageView* imageView).ThrowOnError(); + gd.Api.CreateImageView(device, in imageCreateInfo, null, out ImageView imageView).ThrowOnError(); return new Auto(new DisposableImageView(gd.Api, device, imageView), null, storage.GetImage()); } diff --git a/src/Ryujinx.Graphics.Vulkan/VulkanInitialization.cs b/src/Ryujinx.Graphics.Vulkan/VulkanInitialization.cs index 95810a4e1..1d2cc6311 100644 --- a/src/Ryujinx.Graphics.Vulkan/VulkanInitialization.cs +++ b/src/Ryujinx.Graphics.Vulkan/VulkanInitialization.cs @@ -1,6 +1,7 @@ using Ryujinx.Common.Configuration; using Ryujinx.Common.Logging; using Ryujinx.Graphics.GAL; +using Silk.NET.Core; using Silk.NET.Vulkan; using Silk.NET.Vulkan.Extensions.EXT; using Silk.NET.Vulkan.Extensions.KHR; @@ -249,7 +250,7 @@ namespace Ryujinx.Graphics.Vulkan { const QueueFlags RequiredFlags = QueueFlags.GraphicsBit | QueueFlags.ComputeBit; - KhrSurface khrSurface = new KhrSurface(api.Context); + KhrSurface khrSurface = new(api.Context); for (uint index = 0; index < physicalDevice.QueueFamilyProperties.Length; index++) { @@ -566,7 +567,7 @@ namespace Ryujinx.Graphics.Vulkan pExtendedFeatures = &featuresVertexInputDynamicState; } - var featuresExtendedDynamicState = new PhysicalDeviceExtendedDynamicStateFeaturesEXT + PhysicalDeviceExtendedDynamicStateFeaturesEXT featuresExtendedDynamicState = new() { SType = StructureType.PhysicalDeviceExtendedDynamicStateFeaturesExt, PNext = pExtendedFeatures, @@ -704,7 +705,7 @@ namespace Ryujinx.Graphics.Vulkan PEnabledFeatures = &features, }; - api.CreateDevice(physicalDevice.PhysicalDevice, in deviceCreateInfo, null, out Device* device).ThrowOnError(); + api.CreateDevice(physicalDevice.PhysicalDevice, in deviceCreateInfo, null, out Device device).ThrowOnError(); for (int i = 0; i < enabledExtensions.Length; i++) { diff --git a/src/Ryujinx.Graphics.Vulkan/Window.cs b/src/Ryujinx.Graphics.Vulkan/Window.cs index 9aaa89417..c14a3195d 100644 --- a/src/Ryujinx.Graphics.Vulkan/Window.cs +++ b/src/Ryujinx.Graphics.Vulkan/Window.cs @@ -236,7 +236,7 @@ namespace Ryujinx.Graphics.Vulkan CurrentTransform = capabilities.CurrentTransform; - var usage = ImageUsageFlags.ColorAttachmentBit | ImageUsageFlags.TransferDstBit; + ImageUsageFlags usage = ImageUsageFlags.ColorAttachmentBit | ImageUsageFlags.TransferDstBit; if (!PlatformInfo.IsBionic) { usage |= ImageUsageFlags.StorageBit; // Only desktop allows storage for swapchain @@ -328,7 +328,7 @@ namespace Ryujinx.Graphics.Vulkan ComponentSwizzle.B, ComponentSwizzle.A); - var aspectFlags = ImageAspectFlags.ColorBit; + ImageAspectFlags aspectFlags = ImageAspectFlags.ColorBit; ImageSubresourceRange subresourceRange = new(aspectFlags, 0, 1, 0, 1); @@ -342,7 +342,7 @@ namespace Ryujinx.Graphics.Vulkan SubresourceRange = subresourceRange, }; - _gd.Api.CreateImageView(_device, in imageCreateInfo, null, out ImageView* imageView).ThrowOnError(); + _gd.Api.CreateImageView(_device, in imageCreateInfo, null, out ImageView imageView).ThrowOnError(); return new TextureView(_gd, _device, new DisposableImageView(_gd.Api, _device, imageView), info, format); } @@ -561,7 +561,7 @@ namespace Ryujinx.Graphics.Vulkan { _gd.FlushAllCommands(); Semaphore[] emptySems = Array.Empty(); - var waitStagesCO = new[] { PipelineStageFlags.ColorAttachmentOutputBit }; + PipelineStageFlags[] waitStagesCO = new[] { PipelineStageFlags.ColorAttachmentOutputBit }; _gd.CommandBufferPool.Return( cbs, emptySems, @@ -643,7 +643,7 @@ namespace Ryujinx.Graphics.Vulkan } Semaphore[] waitSems = new[] { _imageAvailableSemaphores[semaphoreIndex] }; - var waitStages = new[] { PipelineStageFlags.ColorAttachmentOutputBit }; // Important on Android + PipelineStageFlags[] waitStages = new[] { PipelineStageFlags.ColorAttachmentOutputBit }; // Important on Android Semaphore[] signalSems = new[] { _renderFinishedSemaphores[semaphoreIndex] }; _gd.CommandBufferPool.Return(cbs, waitSems, waitStages, signalSems);