Skip to content
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

Problems reading Tower Unite pak file #28

Open
abb128 opened this issue Feb 18, 2022 · 5 comments
Open

Problems reading Tower Unite pak file #28

abb128 opened this issue Feb 18, 2022 · 5 comments

Comments

@abb128
Copy link

abb128 commented Feb 18, 2022

I'm trying to mount the pak file for Tower Unite. Although I can access folders and see filenames, I'm unable to actually read any files (it just says Input/output error).

$ ls ~/pak_mnt/Tower/Content/Maps | wc -l
708
$ cat ~/pak_mnt/Tower/Content/Maps/C_Condo.uexp
cat: /home/user/pak_mnt/Tower/Content/Maps/C_Condo.uexp: Input/output error

I've been able to use the Python script to mount the same pak no issues (I had to force version 7 because 5 wasn't supported and it seemed to work to some extent)

I looked deeper and found that the error is being triggered here. The value of error was Custom { kind: InvalidInput, error: "corrupt deflate stream" }

rust-u4pak/src/mount.rs

Lines 464 to 466 in 458eb6d

if let Err(error) = zlib.read_exact(&mut out_buffer[index..]) {
return reply.error(error.raw_os_error().unwrap_or(EIO));
}

I also tried running the check command and it seemed to throw a lot of errors

$ u4pak info ./pakchunk0-WindowsNoEditor.pak
Pak Version: 5
Mount Point: ../../../

                      Count         Size     Uncompr.
-----------------------------------------------------
Files:               105045  16096317902  32238452739
Uncompr.:              2235    631536248
ZLIB Compr.:         102810  15464781654  31606916491
Bias Speed Compr.:        0            0            0
Bias Memory Compr.:       0            0            0
Unknown Compr.:           0            0            0
Encrypted:                0            0            0

$ u4pak check pakchunk0-WindowsNoEditor.pak 2> check.txt
Found 669319 error(s)

The final output is 115 megabytes, I've compressed it to a 15MB zip: check.zip

The game seems to run fine, umodel can read it, and the Python script can read it as well, so I don't think the pak file itself is corrupted.

@Xenira
Copy link
Contributor

Xenira commented Feb 18, 2022

Can you tell me which UE version this game is using?

@abb128
Copy link
Author

abb128 commented Feb 19, 2022

My best guess is UE 4.20? Considering the pak version, and umodel lists it as UE 4.20 as well on the compatibility matrix. I tried checking the EXE metadata and dumping strings from the EXE and memory, but I haven't found anything to confirm this.

I did try the --force-version flag with a bunch of different versions when mounting, but they all either failed instantly or kept throwing the same Input/output errors when reading files. Version 7 in particular fails to mount with rust-u4pak, but seems to work with the Python script:

$ u4pak mount pakchunk0-WindowsNoEditor.pak --debug ~/pak_mnt --force-version 7
illegal index offset/size: index_offset (16174326128) + index_size (22012867) > footer_offset (16196338979)
$ python3 ~/Documents/u4pak/u4pak.py mount pakchunk0-WindowsNoEditor.pak -f ~/pak_mnt --force-version 7

I'm noticing that the Python script doesn't work completely with this configuration though, files are missing from directory listings (C_Condo isn't even listed but it can be read if I request):

$ ls ~/pak_mnt/Tower/Content/Maps | wc -l
76
$ ls ~/pak_mnt/Tower/Content/Maps | grep -i C_Condo
$ ls ~/pak_mnt/Tower/Content/Maps/C_Condo.uexp
/home/user/pak_mnt/Tower/Content/Maps/C_Condo.uexp
$ cat ~/pak_mnt/Tower/Content/Maps/C_Condo.uexp | wc
 101885  701721 93917957

@Xenira
Copy link
Contributor

Xenira commented Feb 19, 2022

Usually the "Corrupt deflate stream" error indicates that something went wrong with the alignment of compression blocks.
This might be related to #21. Can you try building from source?

@abb128
Copy link
Author

abb128 commented Feb 19, 2022

Sorry, forgot to mention that I did indeed build from source (1.4.0) and I also did try release 1.3.0, both of them produce the same problem.

@Xenira
Copy link
Contributor

Xenira commented Feb 19, 2022

Hmmm, hard to debug, as I don't own the game. Ill do some testing and see if I can find something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants