NicknineTheEagle / Frostbite-Scripts

Python scripts for extracting Frostbite Engine assets
Other
87 stars 14 forks source link

Support for all Battlefield 3 DLC #21

Closed cmathew closed 2 years ago

cmathew commented 3 years ago

dumper.py seems to have issues with dumping DLC Xpack 2. Stack trace:

==== RESTART: R:\Tools\Battlefield 3\Frostbite-Scripts\frostbite2\dumper.py ====
Reading cat entries...
Reading patched cat entries...
Extracting DLC Xpack1...
Win32\Xp1Chunks.toc
Win32\Levels\XP1_001\XP1_001.toc
Win32\Levels\XP1_002\XP1_002.toc
Win32\Levels\XP1_003\XP1_003.toc
Win32\Levels\XP1_004\XP1_004.toc
Extracting DLC Xpack2...
Win32\Xp2Chunks.toc
Traceback (most recent call last):
  File "R:\Tools\Battlefield 3\Frostbite-Scripts\frostbite2\dumper.py", line 364, in <module>
    dumpRoot(os.path.join(updateDir,dir,"Data"),patchDir,targetDirectory)
  File "R:\Tools\Battlefield 3\Frostbite-Scripts\frostbite2\dumper.py", line 333, in dumpRoot
    dump(fname,outPath)
  File "R:\Tools\Battlefield 3\Frostbite-Scripts\frostbite2\dumper.py", line 175, in dump
    noncasChunkPayload(sb,entry,path)
  File "R:\Tools\Battlefield 3\Frostbite-Scripts\frostbite2\dumper.py", line 239, in noncasChunkPayload
    out.write(zlibb(sb,entry.get("size"),False))
  File "R:\Tools\Battlefield 3\Frostbite-Scripts\frostbite2\dumper.py", line 263, in zlibb
    outStream.write(zlib.decompress(data))
zlib.error: Error -3 while decompressing data: incorrect header check
NicknineTheEagle commented 3 years ago

DLCs should already get extracted properly, I think I've caused a regression somewhere.

cmathew commented 3 years ago

DLCs should already get extracted properly, I think I did a regression somewhere.

Thanks for the heads up! I checked out revision 7c3cd5deabb058f9ea198f33bc2c0142271a3143 and everything worked.

NicknineTheEagle commented 3 years ago

I've added temporary workaround for this here: https://github.com/NicknineTheEagle/Frostbite-Scripts/commit/6f27b5c3a80ad3df05830f7e69423afce87b0a1c I'm seriously stumped by this, it kind of looks some blocks in BF3 are uncompressed but there's no reliable way to differentiate them from the rest. I've even tried decompiling BF3 exe and got nothing useful, the code for parsing the compressed blocked payload doesn't appear to have any special cases.