Wakfu .pk 音频文件提取
Posted iblackly
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Wakfu .pk 音频文件提取相关的知识,希望对你有一定的参考价值。
原作者是:B0redom
帖子地址:Wakfu OST (1.31)
原作者 用D语言写的源码如下 - extractor.d
1 import std.stdio; 2 import std.file; 3 import std.conv; 4 import std.stream; 5 import std.bitmanip; 6 7 void main(string args[]){ 8 Stream pkfile = new BufferedFile(args[1],FileMode.In); 9 10 int headersize; 11 int counter = 0; 12 int filecount; 13 int throwaway; 14 int offset; 15 16 pkfile.read(headersize); 17 pkfile.read(filecount); 18 writefln("Count is : " ~ to!string(filecount)); 19 int[] files = new int[filecount]; 20 for(int x = 0; x < filecount; x++){ 21 pkfile.read(throwaway); 22 pkfile.read(offset); 23 files[x] = offset + (headersize + 4); 24 } 25 26 files = files.sort; 27 for(int x =0; x < filecount; x++){ 28 pkfile.seekSet(cast(long)files[x]); 29 long len; 30 pkfile.read(len); 31 int newlen = cast(int)len; 32 ubyte[] ogg = new ubyte[newlen]; 33 pkfile.read(ogg); 34 string outname = getcwd() ~"/"~ to!string(counter) ~ ".ogg"; 35 Stream oggout = new BufferedFile(outname,FileMode.OutNew); 36 oggout.write(shiftL(ogg,newlen)); 37 oggout.close(); 38 writefln("Creating file " ~ to!string(counter) ~".ogg"); 39 counter++; 40 } 41 } 42 43 ubyte[] shiftL(ubyte[] ogg,int ogglength){ 44 ubyte[] temp = new ubyte[ogglength]; 45 for(int x = 0;x < ogglength;x++){ 46 temp[x] = cast(byte)(ogg[x]-1); 47 } 48 return temp; 49 }
修改如下 - wakfupk.d
1 import std.stdio; 2 import std.file; 3 import std.conv; 4 import std.stream; 5 import std.bitmanip; 6 import std.regex; 7 8 void main(string args[]){ 9 Stream pkfile = new BufferedFile(args[1],FileMode.In); 10 11 int headersize; 12 int counter = 0; 13 int filecount; 14 int throwaway; 15 int offset; 16 auto prenamea = matchAll(args[1], regex(`(w+)(?=.pk)`)); 17 writefln("File Name: "~prenamea.front.hit); 18 19 pkfile.read(headersize); 20 pkfile.read(filecount); 21 writefln("Count is : " ~ to!string(filecount)); 22 int[] files = new int[filecount]; 23 24 for(int x = 0; x < filecount; x++){ 25 pkfile.read(throwaway); 26 pkfile.read(offset); 27 files[x] = offset + (headersize + 4); 28 } 29 30 files = files.sort; 31 for(int x =0; x < filecount; x++){ 32 33 pkfile.seekSet(cast(long)files[x]); 34 long len; 35 pkfile.read(len); 36 int newlen = cast(int)len; 37 ubyte[] ogg = new ubyte[newlen]; 38 pkfile.read(ogg); 39 string outname = prenamea.front.hit~ to!string(counter) ~ ".ogg"; 40 Stream oggout = new BufferedFile(outname,FileMode.OutNew); 41 oggout.write(shiftL(ogg,newlen)); 42 oggout.close(); 43 writefln("Creating file " ~ prenamea.front.hit ~ to!string(counter) ~".ogg"); 44 counter++; 45 } 46 47 writefln("Done!!!"); 48 } 49 50 ubyte[] shiftL(ubyte[] ogg,int ogglength){ 51 ubyte[] temp = new ubyte[ogglength]; 52 for(int x = 0;x < ogglength;x++){ 53 temp[x] = cast(byte)(ogg[x]-1); 54 } 55 return temp; 56 }
下载D语言编译器
cd dmd2windowsin
编译
dmd wakfupk.d -release
在 dmd2windowsin 目录下会生成 wakfupk.exe
使用
进入 Wakfu 游戏目录
WAKFUcontentssoundsmusics
将 wakfupk.exe 放置目录内
将 musics.pk 文件 拖动到 wakfupk.exe 即可提取成功
其它PK文件同理
下载地址:
https://iblackly.lanzous.com/b05m7imje
以上是关于Wakfu .pk 音频文件提取的主要内容,如果未能解决你的问题,请参考以下文章