I dragged a donkey <drakensang> to use the resource.
This game uses N2 + N3, file format or N2.
I found the code in N2 and found the code for reading the NPK file.
It is too troublesome to decompress all the files. It is better to create a viewer.
However, it is not very cost-effective to do it from the ground up. In addition, I am a loyal friend of TC.
So, just make a plug-in like mpq.
NPK file package format. After reading the N2 comments, you will understand that it is nothing more than a combination of files.
The data segment is the chunk structure of fourcc + size + data, and there is no version number concept.
In this way, there is no compression and encryption, and it belongs to the original file package format.
NPK file format: </P> <p> @ verbatim <br/> # header <br/> block header {<br/> uint32 'npk0'/magic number <br/> uint32 blocklen // Number of following bytes in block <br/> uint32 dataoffset // byte offset of data block from beginning of file <br/>}</P> <p> # TABLE contents, sequence of blocks of 3 types: <br/> block dir {<br/> uint32 'dir _ '// magic number of directory block <br/> uint32 blocklen // Number of following bytes in block <br/> uint16 dirnamelength // length of the following name <br/> char [] dirname/Name of directory <br/>}</P> <p> block file {<br /> uint32 'file' // magic number of file block <br/> uint32 blocklen // Number of following bytes in block <br/> uint32 fileoffset // start of file data inside data Block <br/> uint32 filelength // length of file data in bytes <br/> uint16 filenamelength // length of the following name <br/> char [] filename/Name of File <br/>}</P> <p> block endofdir {<br/> uint32 'dend' // magic number of end of Dir block <br/> uint32 blocklen // Number of following bytes in block (0) <br/>}</P> <p> # The data block <br/> block data {<br/> uint32 'data' // magic number of data block <br /> uint32 blocklen // Number of following bytes in block <br/> char [] data // The data <br/>}< br/> @ endverbatim <br/>
The structure of the entire file is organized as follows:
- Npk0
- Dir _
- Dir _
- Dend
- Dir _
- Dend
- ...
- Dend
- Data
It's so simple that it's no longer easy. If you want to write a file for reading, you don't need to rely on the N2 library.
I checked the ISO source code of TC again. It turned out to be a DLL. I implemented the corresponding function and threw it to TC.
========================================================== ========================
Update a TC Plugin: