之前贴过一张bms的脚本,其实DN的pak封包格式可以从脚本看出来,当然这里说的pak特定龙之谷的pak。*.pak只是一个后缀,不是所有看到的pak全是这个格式.下面贴出pak格式的分析.转自(热风工作室PAK分析)

资源结构

PAK是《龙之谷》游戏的资源存放文件格式,本格式包含虚拟文件的数据及虚拟目录/文件的索引,游戏通过对程序目录下的*.pak后缀名的文件对资源包按顺序进行加载,并支持虚拟文件的同名覆盖(文件名须注明替换的包名,如:Resource01-test.pak).需要注意的是,在PAK包内的虚拟文件是被压缩(zlib方式,压缩级别1)紧凑地存放在资源包的数据区的,因此从PAK提取后的文件需要经过解压才能使用.
以下是对PAK结构的猜想,以一个自制test.pak作范例:
文件头段: 占用256字节(00h-FFh),用于标识文件类型,只使用32字节(00h-20h).
索引信息段:
占用16字节(100h-10Fh),用于指示索引信息及位置.
0B 00 00 00: 占用4字节,固定为0B或0A两个数值
02 00 00 00: 占用4字节,表示虚拟文件数量
00 05 00 00: 占用4字节,表示虚拟文件索引起始偏移地址
资源数据段: 不定长度,必须从400h处开始,用于存放虚拟文件数据,文件顺序紧凑存放.
78 01: 虚拟文件文件头,78为zlib标识,01表示压缩级别1
索引段: 不定长度,每个虚拟文件索引占316字节(13Ch),用于说明虚拟文件的相关信息.
500h-524h: 显而易见,这是一个包含完整虚拟目录信息的虚拟文件名,占用256字节
20 00 00 00: 占用4字节,表示虚拟文件的大小
20 00 00 00: 占用4字节,表示虚拟文件解压后的大小
(由于这是个例子文件,假设压缩前后大小不变)
00 04 00 00: 占用4字节,表示虚拟文件的偏移地址
空白段: 无重大作用,对齐字节用意.

00000000h: 45 79 65 64 65 6E 74 69 74 79 47 61 6D 65 73 20 ; EyedentityGames 
00000010h: 50 61 63 6B 69 6E 67 20 46 69 6C 65 20 30 2E 31 ; Packing File 0.1
00000020h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000030h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000040h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000050h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000060h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000070h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000080h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000090h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000000a0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000000b0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000000c0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000000d0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000000e0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000000f0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000100h: 0B 00 00 00 01 00 00 00 00 05 00 00 00 00 00 00 ; ………?……
00000110h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000120h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000130h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000140h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000150h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000160h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000170h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000180h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000190h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000001a0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000001b0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000001c0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000001d0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000001e0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000001f0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000200h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000210h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000220h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000230h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000240h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000250h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000260h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000270h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000280h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000290h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000002a0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000002b0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000002c0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000002d0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000002e0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000002f0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000300h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000310h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000320h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000330h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000340h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000350h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000360h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000370h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000380h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000390h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000003a0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000003b0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000003c0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000003d0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000003e0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000003f0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000400h:  78 01  00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; x……………
00000410h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000420h:  78 01  00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; x……………
00000430h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000440h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000450h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000460h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000470h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000480h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000490h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000004a0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000004b0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000004c0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000004d0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000004e0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000004f0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000500h: 5C 6D 61 70 64 61 74 61 5C 72 65 73 6F 75 72 63 ; \mapdata\resourc
00000510h: 65 5C 73 6F 75 6E 64 5C 62 67 6D 5C 66 69 6C 65 ; e\sound\bgm\file
00000520h: 31 2E 6F 67 67 00 00 00 00 00 00 00 00 00 00 00 ; 1.ogg………..
00000530h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000540h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000550h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000560h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000570h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000580h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000590h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000005a0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000005b0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000005c0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000005d0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000005e0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000005f0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000600h: 20 00 00 00 20 00 00 00 20 00 00 00  00 04 00 00  ;  … … …….
00000610h: 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000620h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000630h: 00 00 00 00 00 00 00 00 00 00 00 00 5C 6D 61 70 ; …………\map
00000640h:  64 61 74 61 5C 72 65 73 6F 75 72 63 65 5C 73 6F  ; data\resource\so
00000650h:  75 6E 64 5C 62 67 6D 5C 66 69 6C 65 32 2E 6F 67  ; und\bgm\file2.og
00000660h: 67 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; g……………
00000670h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000680h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000690h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000006a0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000006b0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000006c0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000006d0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000006e0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
000006f0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000700h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000710h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000720h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000730h: 00 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 ; ………… …
00000740h: 20 00 00 00 20 00 00 00  20 04 00 00  0A 00 00 00 ;  … … …….
00000750h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….
00000760h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; …………….