diff --git a/src/Audio/StaticSound.cs b/src/Audio/StaticSound.cs index 664b5be..b27a952 100644 --- a/src/Audio/StaticSound.cs +++ b/src/Audio/StaticSound.cs @@ -16,9 +16,9 @@ namespace MoonWorks.Audio private bool IsDisposed; - public static StaticSound LoadOgg(AudioDevice device, FileInfo fileInfo) + public static StaticSound LoadOgg(AudioDevice device, string filePath) { - var filePointer = FAudio.stb_vorbis_open_filename(fileInfo.FullName, out var error, IntPtr.Zero); + var filePointer = FAudio.stb_vorbis_open_filename(filePath, out var error, IntPtr.Zero); if (error != 0) { diff --git a/src/Audio/StreamingSoundOgg.cs b/src/Audio/StreamingSoundOgg.cs index 9bec539..49c9ad9 100644 --- a/src/Audio/StreamingSoundOgg.cs +++ b/src/Audio/StreamingSoundOgg.cs @@ -18,12 +18,12 @@ namespace MoonWorks.Audio private bool IsDisposed; public static StreamingSoundOgg Load( - AudioDevice device, - FileInfo fileInfo, + AudioDevice device, + string filePath, bool is3D = false, bool loop = false ) { - var fileHandle = FAudio.stb_vorbis_open_filename(fileInfo.FullName, out var error, IntPtr.Zero); + var fileHandle = FAudio.stb_vorbis_open_filename(filePath, out var error, IntPtr.Zero); if (error != 0) { Logger.LogError("Error opening OGG file!"); diff --git a/src/Graphics/Resources/ShaderModule.cs b/src/Graphics/Resources/ShaderModule.cs index 65824c3..255b147 100644 --- a/src/Graphics/Resources/ShaderModule.cs +++ b/src/Graphics/Resources/ShaderModule.cs @@ -8,12 +8,14 @@ namespace MoonWorks.Graphics { protected override Action QueueDestroyFunction => Refresh.Refresh_QueueDestroyShaderModule; - public unsafe ShaderModule(GraphicsDevice device, FileInfo fileInfo) : base(device) + public unsafe ShaderModule(GraphicsDevice device, string filePath) : base(device) { - fixed (uint* ptr = Bytecode.ReadBytecodeAsUInt32(fileInfo)) + var bytecode = Bytecode.ReadBytecodeAsUInt32(filePath); + + fixed (uint* ptr = bytecode) { Refresh.ShaderModuleCreateInfo shaderModuleCreateInfo; - shaderModuleCreateInfo.codeSize = (UIntPtr) fileInfo.Length; + shaderModuleCreateInfo.codeSize = (UIntPtr) (bytecode.Length * sizeof(uint)); shaderModuleCreateInfo.byteCode = (IntPtr) ptr; Handle = Refresh.Refresh_CreateShaderModule(device.Handle, shaderModuleCreateInfo); diff --git a/src/Graphics/Resources/Texture.cs b/src/Graphics/Resources/Texture.cs index 3211e64..9e3d399 100644 --- a/src/Graphics/Resources/Texture.cs +++ b/src/Graphics/Resources/Texture.cs @@ -13,10 +13,10 @@ namespace MoonWorks.Graphics protected override Action QueueDestroyFunction => Refresh.Refresh_QueueDestroyTexture; - public static Texture LoadPNG(GraphicsDevice device, FileInfo fileInfo) + public static Texture LoadPNG(GraphicsDevice device, string filePath) { var pixels = Refresh.Refresh_Image_Load( - fileInfo.FullName, + filePath, out var width, out var height, out var channels diff --git a/src/Graphics/Utility/Bytecode.cs b/src/Graphics/Utility/Bytecode.cs index 30d2a3b..e64091e 100644 --- a/src/Graphics/Utility/Bytecode.cs +++ b/src/Graphics/Utility/Bytecode.cs @@ -4,11 +4,11 @@ namespace MoonWorks.Graphics { public static class Bytecode { - public static uint[] ReadBytecodeAsUInt32(FileInfo fileInfo) + public static uint[] ReadBytecodeAsUInt32(string filePath) { byte[] data; int size; - using (FileStream stream = new FileStream(fileInfo.FullName, FileMode.Open, FileAccess.Read)) + using (FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { size = (int)stream.Length; data = new byte[size];