From 20e7740d3f90c631960ee5b6b0f48a83a9e2910b Mon Sep 17 00:00:00 2001 From: Sewer 56 Date: Sun, 11 Sep 2022 14:24:02 +0100 Subject: [PATCH] Fixed: Oversight where current file pointer is not overwritten if ByteOffset specified. --- modloader/Redirectors/Cpk/CpkRedirector.cs | 2 +- modloader/Redirectors/DwPack/DwPackRedirector.cs | 2 +- modloader/Redirectors/Xact/XactRedirector.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modloader/Redirectors/Cpk/CpkRedirector.cs b/modloader/Redirectors/Cpk/CpkRedirector.cs index d03b5af..03da2ce 100644 --- a/modloader/Redirectors/Cpk/CpkRedirector.cs +++ b/modloader/Redirectors/Cpk/CpkRedirector.cs @@ -96,7 +96,7 @@ public override unsafe Native.NtStatus NtReadFileImpl( IntPtr handle, IntPtr hEv var cpk = mCpkByHandle[ handle ]; var effOffset = Utils.ResolveReadFileOffset( cpk.FilePointer, byteOffset ); Unsafe.CopyBlock( buffer, (byte*)cpk.Instance.Native.Ptr + effOffset, length ); - SetBytesRead( handle, (int)cpk.FilePointer, (int)length, ref ioStatus ); + SetBytesRead( handle, (int)effOffset, (int)length, ref ioStatus ); return NtStatus.Success; } diff --git a/modloader/Redirectors/DwPack/DwPackRedirector.cs b/modloader/Redirectors/DwPack/DwPackRedirector.cs index 0dfce6c..4175720 100644 --- a/modloader/Redirectors/DwPack/DwPackRedirector.cs +++ b/modloader/Redirectors/DwPack/DwPackRedirector.cs @@ -250,7 +250,7 @@ public override unsafe Native.NtStatus NtReadFileImpl( IntPtr handle, IntPtr hEv } Unsafe.CopyBlock( buffer, pack.Native.Ptr + effOffset, length ); - SetBytesRead( handle, ( int )offset, ( int )length, ref ioStatus ); + SetBytesRead( handle, ( int )effOffset, ( int )length, ref ioStatus ); result = NtStatus.Success; } else if ( effOffset >= dataOffset && effOffset < pack.VirtualFileSize ) diff --git a/modloader/Redirectors/Xact/XactRedirector.cs b/modloader/Redirectors/Xact/XactRedirector.cs index 4e80636..afbcbeb 100644 --- a/modloader/Redirectors/Xact/XactRedirector.cs +++ b/modloader/Redirectors/Xact/XactRedirector.cs @@ -334,7 +334,7 @@ public override unsafe Native.NtStatus NtReadFileImpl( IntPtr handle, IntPtr hEv { // Header read Unsafe.CopyBlock( buffer, waveBank.Native.Ptr + effOffset, length ); - SetBytesRead( handle, (int)waveBank.FilePointer, (int)length, ref ioStatus ); + SetBytesRead( handle, (int)effOffset, (int)length, ref ioStatus ); result = NtStatus.Success; } else if ( effOffset >= waveDataOffset && effOffset < waveBank.VirtualFileSize )