xforce / neox-tools

Tools to play with NetEase's NeoX NPK files.
MIT License
78 stars 32 forks source link

Error: IoError(Custom { kind: UnexpectedEof, error: "failed to fill whole buffer" }) #4

Closed Dawnnnnnn closed 4 years ago

Dawnnnnnn commented 4 years ago

I am trying to unpack the script.npk of a game

But it doesn't seem to unpack properly and throws the issue titile error

example:

$ npktool x script.npk
2020-09-14 17:20:10,017 WARN  [npktool] Handle unknown special case! Changing field 28
Error: IoError(Custom { kind: UnexpectedEof, error: "failed to fill whole buffer" })

Any ideas?

Dawnnnnnn commented 4 years ago

I was able to unpack the NPK file by trying to reverse engineer it through other public tools, but when I fixed the Opcode, there was no defined Opcode

It looks like a new mapping with opcode added?

xforce commented 4 years ago

This is most likely because this was originally designed to handle the npk file of Eve Echoes, which seem to be a slightly different format (My best guess is that it is a newer NPK version).

I have some WIP code locally to add support the the older npk variant, somewhat of a hack. The main issue I have with finishing it at the moment is that I can't seem to find a reliable and good way to detect which version of NPK it is. I have a hack that seems to sort of work where I check if one methods leads to reading beyond the end of buffer, but that feels like a very fragile way of doing things.

I will take a look again today and see if I can come up with a better way and if I can't I will probably just push what I have locally.

Dawnnnnnn commented 4 years ago

thx

xforce commented 4 years ago

Added initial support for Version 1 NPK (it's what I am calling them anyways) in 7ca1cc78c2bf42118edd76a31e17268109a7cfd2 and tested with the game you linked, was able to extract every .npk file in the game, so seems fine to me now.

Let me know if you run into any more issues.