Pupix/lol-wad-parser

Failing to extract with latest files

honux opened this issue · 4 comments

honux commented

Heya,
The WAD extract is failing with the following error:

> wad.extract("files/plugins/rcp-be-lol-game-data/default-assets.wad", "files/plugins/rcp-be-lol-game-data/default-assets", function(error){console.trace(error)});
{ state: 'pending' }
> { > Trace: { Error: incorrect header check
    at Zlib._handle.onerror (zlib.js:370:17) errno: -3, code: 'Z_DATA_ERROR' }
    at repl:1:147
    at C:\Users\atoah\Desktop\Teemo\FTP\node_modules\expandjs\lib\constructors\Promise.js:59:68
    at _rejected (C:\Users\atoah\Desktop\Teemo\FTP\node_modules\q\q.js:864:24)
    at C:\Users\atoah\Desktop\Teemo\FTP\node_modules\q\q.js:890:30
    at Promise.when (C:\Users\atoah\Desktop\Teemo\FTP\node_modules\q\q.js:1142:31)
    at Promise.promise.promiseDispatch (C:\Users\atoah\Desktop\Teemo\FTP\node_modules\q\q.js:808:41)
    at C:\Users\atoah\Desktop\Teemo\FTP\node_modules\q\q.js:624:44
    at runSingle (C:\Users\atoah\Desktop\Teemo\FTP\node_modules\q\q.js:137:13)
    at flush (C:\Users\atoah\Desktop\Teemo\FTP\node_modules\q\q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)

several times with several files on the latest client. The reader / parser is working as expected.

Example failing file:
http://l3cdn.riotgames.com/releases/live/projects/league_client/releases/0.0.0.61/files/Plugins/rcp-be-lol-game-data/default-assets.wad.compressed

PS: I'm inflating it first, and even copying an original one just extract it partially before failing.

honux commented

After some investigation, I've found out it has something with the "header.compressed" component.
It seems that might exist a new version?
A temporary fix that will solve the issue (and keep extracting, although it fails later) will be included here.
Still need to find out the real reason and provide a better fix - this was purely a temporary and most likely not ready to production fix.

Pupix commented

So header.compressed is true but the file is not actually compressed? Also the file you linked 404s

honux commented

Sorry about the link, this is the correct one:
http://l3cdn.riotgames.com/releases/live/projects/league_client/releases/0.0.0.61/files/Plugins/rcp-be-lol-game-data/default-assets.wad.compressed
Note that it is "compressed", you still need to inflate before trying to extract.

Yes, the header compressed is always > 1, but the content isn't compressed for some reason.
A few examples:

{ pathHash: '4defcfd3e29cf33',
  offset: 677883556,
  compressedFileSize: 1112685,
  fileSize: 1112685,
  compressed: 256,
  sha256: '9277fd2e8921a69e',
  fileName: null,
  output: 'files/plugins/rcp-be-lol-game-data/default-assets' }
{ pathHash: '51b1b9f9b26ba28',
  offset: 677696800,
  compressedFileSize: 186756,
  fileSize: 186756,
  compressed: 256,
  sha256: 'b44031c4dac0bd14',
  fileName: null,
  output: 'files/plugins/rcp-be-lol-game-data/default-assets' }
{ pathHash: '107776a2f6730113',
  offset: 331138,
  compressedFileSize: 198078,
  fileSize: 198556,
  compressed: 257,
  sha256: '1a1a5c61d887d43a',
  fileName: null,
  output: 'files/plugins/rcp-be-lol-game-data/default-assets' }
{ pathHash: '18fc53a34bfaf3ac',
  offset: 122249097,
  compressedFileSize: 48,
  fileSize: 48,
  compressed: 256,
  sha256: '5eec52c622954826',
  fileName: null,
  output: 'files/plugins/rcp-be-lol-game-data/default-assets' }
{ pathHash: '1faef1496b7b469e',
  offset: 122249097,
  compressedFileSize: 48,
  fileSize: 48,
  compressed: 256,
  sha256: '5eec52c622954826',
  fileName: null,
  output: 'files/plugins/rcp-be-lol-game-data/default-assets' }
{ pathHash: 'f9ae01e1a22864b2',
  offset: 6627815,
  compressedFileSize: 36120,
  fileSize: 43255,
  compressed: 257,
  sha256: 'f744fbb8283bf0a9',
  fileName: null,
  output: 'files/plugins/rcp-be-lol-game-data/default-assets' }

It seems that, for some reason, there is an extra byte sometimes after the fileSize.
I don't know exactly why or what for, the only info that seems to be true is:
256 = not compressed,
257 = compressed

Pupix commented

Ok, fixed this. The compressed field was wrongly parsed. v2 seems to be holding multiple flags instead of just compressed at that offset.

Researching to solve this another flag popped up, which is used to show that multiple files point to the same contents. Basically they have the same file in multiple locations for some reason.