Skip to content

Commit

Permalink
UE4 pak file with zero-length file did hide another file
Browse files Browse the repository at this point in the history
Example:
- pak1.pak: file.uasset (15 kb)
- pak2.pak: file.uasset (0 bytes)

While scanning the game directory, the file from pak2 will replace previously loaded entry from pak1, with zero file length, what will make package inaccessible. Now, avoiding registraction of null files.
  • Loading branch information
gildor2 committed Jul 20, 2021
1 parent 18f3ec7 commit 65ffb58
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Unreal/FileSystem/UnArchivePak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,16 @@ bool FPakVFS::LoadPakIndexLegacy(FArchive* reader, const FPakInfo& info, FString
CompactFilePath(CombinedPath);
// serialize other fields
E.Serialize(InfoReader);

if (E.Size == 0)
{
// Happens with Jedi Fallen Order, seems assets are deleted in patches this way. If we'll continue registration,
// the existing (previous) asset might be overriden with zero-size file, and it won't be recognized as an asset anymore.
continue;
}

if (E.bEncrypted)
{
// appPrintf("Encrypted file: %s\n", *Filename);
NumEncryptedFiles++;
}
if (info.Version >= PakFile_Version_FNameBasedCompressionMethod)
Expand Down
Binary file modified umodel
Binary file not shown.
Binary file modified umodel.exe
Binary file not shown.

0 comments on commit 65ffb58

Please sign in to comment.