The Forum is up for sale: XeNTaX Forum looking for new owner

Drakensang .NPK Containerformat

The Original Forum. Game archives, full of resources. How to open them? Get help here.
Post Reply
Itze
veteran
Posts: 81
Joined: Sat Mar 15, 2008 4:43 pm
Has thanked: 2 times
Been thanked: 6 times

Drakensang .NPK Containerformat

Post by Itze »

hey guys, this game is out since a few days in germany now and i've been trying to rip and reinject textures into the bigfiles...with SOME success

the folder structure is like this:

Code: Select all

 Directory of C:\Program Files\Drakensang

02.08.2008  18:29    <DIR>          .
02.08.2008  18:29    <DIR>          ..
05.07.2008  20:02        16.674.816 drakensang.exe
02.08.2008  13:06    <DIR>          export
05.07.2008  17:24     1.020.211.374 export.npk
01.08.2008  17:10     1.020.187.932 export_1.npk
05.07.2008  17:25     1.020.947.992 export_2.npk
05.07.2008  17:26       542.653.179 export_3.npk
01.08.2008  17:05    <DIR>          in
the .npk get loaded one after another like in quakeengine games, then the export folder is checked for files as an override (atleast i think so) :ninja:

anyway on to the good stuff... when i opened one of the .npks with my hex editor i saw... READABLE FILESNAMES -> AWESOME... no compresion or encryption is used as far as i can tell :)

i copied some dds textures to a new file and edited them, then imported them back in:


ingame:
Image

inventory:
Image

ingame2:
Image

skin:
Image

ii'd like to browse the whole bigfiles... this is what i've figured out so far:

the .npk files contain a simple structure like this (i used export_3.npk for testing):

0KPN = file header
export_RID = export folder (the one that already exists in the game dir)
textures_RID = textures folder under export folder
then follows: _location_04_elementsELIF im not sure if this is another folder or just an identifier cause the folders end with _RID (=DIR backwards) normally...

ANYWAY!

shortly after that comes moorbrueck_mausoleum_putz_bump.dds the first filename :D
and after that ELIF(end of filename terminator i think)
4 bytes further @offset 00000089 the value is 1398256 in unsigned integer, when i extract the moorbrueck_mausoleum_putz_bump.dds (starts at offset FD16) the filesize is 1.398.256 Bytes woohoo! :D

and im kinda stuck there now :(

i have cut the first few mb of the export_3.npk here for someone else to check out, it contains the first too dds textures (atleast i hope so lol)

heres the package: http://www.zippyshare.com/v/11596093/file.html

i hope that i made atleast SOME sense... im not good at this stuff... but learning :ninja:
SiENcE
beginner
Posts: 29
Joined: Wed Jun 13, 2007 8:41 am
Been thanked: 1 time

Re: Drakensang .NPK Containerformat

Post by SiENcE »

i think they use a version from their nebula engine which is open source. you should take a look at.

http://nebuladevice.cubik.org/
jaycenornin
ultra-n00b
Posts: 8
Joined: Sun Oct 28, 2007 12:07 am
Has thanked: 1 time
Been thanked: 1 time

Re: Drakensang .NPK Containerformat

Post by jaycenornin »

I'm downloading Nebula right now to see if it comes with a packer/unpacker. What other news might there be in this area?
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1411 times

Re: Drakensang .NPK Containerformat

Post by chrrox »

the format seems very simple here is a quick look I took at it.
Image
User avatar
asmxtx
veteran
Posts: 127
Joined: Sun Jun 08, 2008 10:32 pm
Location: Developers Country
Has thanked: 1 time
Been thanked: 30 times

Re: Drakensang .NPK Containerformat

Post by asmxtx »

To modify something in DRAKENSANG, just extract the NPK's, edit and save your files into the correct path. Then the game will load these files first. (Tested with version from 09/2008)
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1411 times

Re: Drakensang .NPK Containerformat

Post by chrrox »

There is actually a whole modding community for this game.
The company themselves released an extractor for these archives.
http://mods.jo-ge.net/dsa4/dl/nnpktool.zip

and the website that tells how to use this.
http://forum.dtp-entertainment.com/view ... 63&t=11985

Code: Select all

# include <windows.h>
#include <stdio.h> # include <stdio.h>
#include <direct.h> # include <direct.h>



struct NPKheader struct NPKheader
{ (
char sig[8]; char sig [8];
unsigned int dataoffset; unsigned int dataoffset;
}sHeader; ) sHeader;

struct NPKsubheader struct NPKsubheader
{ (
char sig[4];//_RID //ELIF //DEND char sig [4 ];//_ RID / / ELIF / / DEND
unsigned int id; unsigned int id;
unsigned int offset; unsigned int offset;
unsigned int size; unsigned int size;
unsigned short len; unsigned short len;
char *name; char * name;
}sSubHeader; ) sSubHeader;

int main(int argc,char **argv) int main (int argc, char ** argv)
{ (
char sig[5]; char sig [5];
FILE *f; FILE * f;
printf("Drakensang NPK files unpacker by Bourn v1.0\n"); printf ( "Drakensang NPK files unpacker by Bourn v1.0 \ n");
if(argc!=2||(GetFileAttributes(argv[1])==DWORD(-1))) if (argc! = 2 | | (GetFileAttributes (argv [1]) == DWORD (-1)))
{ (
printf("Usage: UNPNPK <filename>\n"); printf ( "Usage: UNPNPK <filename> \ n");
system("pause"); system ( "pause");
return 0; return 0;
} )
f=fopen(argv[1],"rb"); f = fopen (argv [1], "rb");
if(!f) if (! f)
return 1; return 1;
fread(&sHeader,sizeof(NPKheader),1,f); fread (& sHeader, sizeof (NPKheader), 1, f);
while(ftell(f)<sHeader.dataoffset) while (ftell (f) <sHeader.dataoffset)
{ (
fread(sig,sizeof(char),4,f); fread (sig, sizeof (char), 4, f);
sig[4]=0; sig [4] = 0;
if(!strcmp(sig,"_RID")) if (! strcmp (sig, "_RID"))
{ (
fread(&sSubHeader.id,sizeof(unsigned int),1,f); fread (& sSubHeader.id, sizeof (unsigned int), 1, f);
fread(&sSubHeader.len,sizeof(unsigned short),1,f); fread (& sSubHeader.len, sizeof (unsigned short), 1, f);
//int ftell0=ftell(f); / / int ftell0 = ftell (f);
char *name=new char[sSubHeader.len+1]; char * name = new char [sSubHeader.len +1];
fread(name,sSubHeader.len,1,f); fread (name, sSubHeader.len, 1, f);
name[sSubHeader.len]=0; name [sSubHeader.len] = 0;
mkdir(name); mkdir (name);
chdir(name); chdir (name);
printf("Create directory: %s\n",name); printf ( "Create directory:% s \ n", name);
delete [] name; delete [] name;
} )
else if(!strcmp(sig,"ELIF")) else if (! strcmp (sig, "ELIF"))
{ (
fread(&sSubHeader.id,sizeof(unsigned int),1,f); fread (& sSubHeader.id, sizeof (unsigned int), 1, f);
fread(&sSubHeader.offset,sizeof(unsigned int),1,f); fread (& sSubHeader.offset, sizeof (unsigned int), 1, f);
fread(&sSubHeader.size,sizeof(unsigned int),1,f); fread (& sSubHeader.size, sizeof (unsigned int), 1, f);
fread(&sSubHeader.len,sizeof(unsigned short),1,f); fread (& sSubHeader.len, sizeof (unsigned short), 1, f);
char *name=new char[sSubHeader.len+1]; char * name = new char [sSubHeader.len +1];
fread(name,sSubHeader.len,1,f); fread (name, sSubHeader.len, 1, f);
name[sSubHeader.len]=0; name [sSubHeader.len] = 0;
FILE *fl=fopen(name,"wb"); FILE * fl = fopen (name, "wb");
if(fl) if (fl)
{ (
char *buf=new char[sSubHeader.size]; char * buf = new char [sSubHeader.size];
int curpos=ftell(f); int curpos = ftell (f);
fseek(f,sSubHeader.offset+sHeader.dataoffset+8,SEEK_SET); fseek (f, sSubHeader.offset + sHeader.dataoffset +8, SEEK_SET);
fread(buf,sSubHeader.size,1,f); fread (buf, sSubHeader.size, 1, f);
fwrite(buf,sSubHeader.size,1,fl); fwrite (buf, sSubHeader.size, 1, fl);
fclose(fl); fclose (fl);
fseek(f,curpos,SEEK_SET); fseek (f, curpos, SEEK_SET);
delete [] buf; delete [] buf;
} )
printf("Create file: %s\n",name); printf ( "Create file:% s \ n", name);
delete [] name; delete [] name;
} )
else if(!strcmp(sig,"DNED")) else if (! strcmp (sig, "DNED"))
{ (
fread(&sSubHeader.id,sizeof(unsigned int),1,f); fread (& sSubHeader.id, sizeof (unsigned int), 1, f);
chdir(".."); chdir ("..");
} )
else if(!strcmp(sig,"ATAD")) else if (! strcmp (sig, "ATAD"))
{ (
fread(&sSubHeader.size,sizeof(unsigned int),1,f); fread (& sSubHeader.size, sizeof (unsigned int), 1, f);
} )
} )
fclose(f); fclose (f);
system("pause"); system ( "pause");
return 0; return 0;
} )
Post Reply