EgoEngineModding / ego.nefsedit

NeFS archive editor for Ego Engine
MIT License
25 stars 9 forks source link

Error extracting tracksplit.pssg #5

Open victorbush opened 4 years ago

victorbush commented 4 years ago

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()
opcod3 commented 4 years ago

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.

victorbush commented 4 years ago

I also get this when extracting s_amb_germany_rally_01.bnk.

victorbush commented 4 years ago

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.

opcod3 commented 4 years ago

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.

victorbush commented 4 years ago

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.

ptasev commented 3 years ago

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()