-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix original file being read when it is bigger than the emulated version #23
Conversation
} | ||
else | ||
{ | ||
_logger.Debug("[FileAccessServer] Read Fail, Length: {0}, Offset: {1}", numReadBytes, requestedOffset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with the change; this should say likely EOF
though in brackets though.
The documentation for ReadData
in the interface also needs updating.
Since this is (technically) a breaking change [in behaviour], we'd need to check with @LTSophia and @morgana-x before merging (whether anything breaks). I believe @LTSophia implemented support for some of the less commonly used games (e.g. JSR), and @morgana-x did danganrompa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the ReadData
documentation does this sound fine as the return value?
True if at least one byte was read, false otherwise (this indicates the EOF has been reached).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds good to me.
In the Rust version, we gotta make sure that EOF will be explicitly defined. Unfortunately we can't change it here without breaking API.
If there's a real error (read fail), we would panic there in that case.
I don't think it would break anything, more than happy to update Wad File Emulator to work around the new update if it does |
That works for me, I'll merge later today. |
This fixes the base file emulation framework mod reading into the original file if it was bigger than the emulated one and the entire file was read through something like
File.ReadAllText
.This happened because in the
NtReadFileImpl
when the emulated file returned 0 bytes, the original read file function was called as a fallback. I've changed it so when the emulated file returns no bytes, an end of file status is returned. I don't think there is any scenario where we should be reading the original file if there is an emulated version available.This pr also contains all of the commits from #17 since they somehow got lost on the main repo.