Skip to content

Commit

Permalink
Fixed: Oversight where current file pointer is not overwritten if Byt…
Browse files Browse the repository at this point in the history
…eOffset specified.
  • Loading branch information
Sewer56 committed Sep 11, 2022
1 parent 5e7bfb4 commit 20e7740
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modloader/Redirectors/Cpk/CpkRedirector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion modloader/Redirectors/DwPack/DwPackRedirector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion modloader/Redirectors/Xact/XactRedirector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down

0 comments on commit 20e7740

Please sign in to comment.