码迷,mamicode.com
首页 > 其他好文 > 详细

Wakfu .pk 音频文件提取

时间:2020-05-17 01:10:44      阅读:78      评论:0      收藏:0      [点我收藏+]

标签:main   cto   http   set   使用   head   hit   ima   buffered   

原作者是: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语言编译器

下载 D语言编译器 v2.066.0

 

cd dmd2\windows\bin

 

编译

dmd wakfupk.d -release

在 dmd2\windows\bin 目录下会生成 wakfupk.exe

 

使用

进入 Wakfu 游戏目录

WAKFU\contents\sounds\musics

 

将 wakfupk.exe 放置目录内

将 musics.pk 文件 拖动到 wakfupk.exe 即可提取成功

 

其它PK文件同理

 

下载地址:

https://iblackly.lanzous.com/b05m7imje

 

技术图片

Wakfu .pk 音频文件提取

标签:main   cto   http   set   使用   head   hit   ima   buffered   

原文地址:https://www.cnblogs.com/iblackly/p/12903031.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!