ego.nefsedit icon indicating copy to clipboard operation
ego.nefsedit copied to clipboard

Error extracting tracksplit.pssg

Open victorbush opened this issue 5 years ago • 6 comments

Open \locations\germany__germany_rally_01.nefs. Try to extract tracksplit.pssg.

Following error happens:

Error extracting item tracks\locations\germany\germany_rally_01\tracksplit.pssg.
System.IO.InvalidDataException: Block length does not match with its complement.
   at System.IO.Compression.Inflater.DecodeUncompressedBlock(Boolean& end_of_block)
   at System.IO.Compression.Inflater.Decode()
   at System.IO.Compression.Inflater.Inflate(Byte[] bytes, Int32 offset, Int32 length)
   at System.IO.Compression.DeflateStream.Read(Byte[] array, Int32 offset, Int32 count)
   at System.IO.Stream.InternalCopyTo(Stream destination, Int32 bufferSize)
   at System.IO.Stream.CopyTo(Stream destination)
   at VictorBush.Ego.NefsLib.NefsItem.Extract(String outputDir, String outputFileName, NefsProgressInfo p) in E:\Git\victorbush.ego.nefsedit\VictorBush.Ego.NefsLib\NefsItem.cs:line 515
   at VictorBush.Ego.NefsEdit.UI.EditorForm.<>c__DisplayClass9_0.<ExtractItems>b__0()

victorbush avatar Mar 06 '20 03:03 victorbush

This is the only file with which the bug happens in all locations nefs. Also the weird part is that it always crashes on the same block even in different files 6540 off of the top of my head. But I might be wrong.

Tried to look into it but am stumped.

opcod3 avatar Mar 06 '20 20:03 opcod3

I also get this when extracting s_amb_germany_rally_01.bnk.

victorbush avatar Mar 29 '20 19:03 victorbush

Also strange note: when extracting the tracksplit.pssg, it seems to choke on blocks of 0x10000 bytes. If i skip those blocks and treat them as unencrypted/uncompressed (just copy them direct), then I can open the resulting pssg file in the pssg editor.

That hack didn't work for s_amb_germany_rally_01.bnk though.

victorbush avatar Mar 29 '20 19:03 victorbush

Incredibly weird... Maybe there's some metadata in parts 5/6/7/8 of the header we're missing for these blocks.

Also have you checked the that the files extracted from pssg and the size are correct? If I recall correctly PSSG files will open even if semi corrupt.

opcod3 avatar Mar 29 '20 22:03 opcod3

File size is correct. There are 797 chunks that it chokes on. The PSSG viewer allows browsing of most textures, but there are some that it can't view, so possibly some corruption in there.

victorbush avatar Mar 30 '20 16:03 victorbush

It seems treestextures.pssg is suffering from the same problem. (usa rally 0 from DR2.0) https://github.com/ptasev/Ego-Engine-Modding/issues/24

[09:01:06 ERR] Failed to extract item treestextures.pssg.
System.IO.InvalidDataException: Found invalid data while decoding.
   at System.IO.Compression.DeflateStream.EndRead(IAsyncResult asyncResult)
   at System.IO.Stream.<>c.<BeginEndReadAsync>b__43_1(Stream stream, IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncTrimPromise`1.Complete(TInstance thisRef, Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.IO.Stream.<CopyToAsyncInternal>d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at VictorBush.Ego.NefsLib.Utility.StreamExtensions.<CopyToAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at VictorBush.Ego.NefsLib.IO.NefsTransformer.<DetransformChunkAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at VictorBush.Ego.NefsLib.IO.NefsTransformer.<DetransformAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at VictorBush.Ego.NefsLib.IO.NefsTransformer.<DetransformFileAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at VictorBush.Ego.NefsEdit.Workspace.NefsEditWorkspace.<ExtractFileAsync>d__75.MoveNext()

ptasev avatar Jan 18 '21 17:01 ptasev