-
Notifications
You must be signed in to change notification settings - Fork 128
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
Adapt to UE4.17+ patch pak reading order #40
base: master
Are you sure you want to change the base?
Conversation
It seems the reading order only matters on pak files, so I just reverted the changes to |
This seems to break the content changes to be reflected on the Is it necessary? 👀 |
Would these changes allow FModel to still show both copies, and read both separately? |
@ryantheleach No yet. If I've read it right, FModel only passes the path to CUE4Parse, there's no way for CUE4Parse to know which copy FModel wants to load. This PR only aims to make CUE4Parse provider to provide the file with the highest priority (as of now almost a random one is provided). But I managed to made things work locally by combining with these changes:
The problem is the speed. Whenever Another way I can think of, instead of applying the steps above, would be to use multiple providers in FModel. That is, when a game has N paks,
And then in FModel we can read The problem now may be the memory. I'm not so familiar with CUE4Parse and FModel, I have no idea how this method can be applied and how the memory usage can be optimize. Whichever way we choose, the prioritizing steps inside the provider (like this PR) is necessary. |
Oh, the third method, integrating the second method into the |
@ryantheleach Here in PaperStrike/FModel@extract-with-pak-name (with PaperStrike/CUE4Parse@pub-pak-order) has the first method implemented. 👀 |
This partially resolves iAmAsval/FModel#204, where we only have the "oldest" (closer to "biggest" in my investigation) asset available, even when a newer one is there.
I dug into this and found the problem lies inside CUE4Parse. Currently CUE4Parse mounts paks parallelly and files in the last ready pak override the previous ones. That's the problem.
Two pieces of UE4 source code for reference:
FPakPlatformFile::GetPakOrderFromPakFilePath
, basic order of paks in different folders.This isn't implemented in this PR.
FPakPlatformFile::Mount
#L7239-L7265, order of numbered_P
patches.This was not so detailed (UE<4.17) and I found some old articles complaining about it can't handle multiple patch paks well. Earlier games should have adapted their own ways (like, split into different parts) and I suppose that's the reason why iAmAsval/FModel#204 is raised only in recent months.
This PR
ReadOrder
property toIVfsReader
to order readers. Implemented a simple_P
pak ordering inPakFileReader
.ReadOrder
property toGameFile
and adjusted it inVfsEntry
to reflect the reader orderings.This is mainly to minimize changes to
FileProviderDictionary
, which receives path-GameFile
pairs and I don't know if changing it would be too breaking._byPath
dictionary property toFileProviderDictionary
, which only collects theGameFile
of highest priority in each path.I'm quite noob in C#, and want to have some practice here. If there's anything doesn't seem right, or u have some thoughts on the "basic order" above, let me know then I'll try my best. Or if you're planning a better approach, close this I'm willing to learn ;-)
This tool is amazing! Thank you!