gemot encubed  

Go Back   gemot encubed > Gemot > Technical Issues

Technical Issues For bug reports, problem solving, and help running Japanese software.

Reply
 
Thread Tools Display Modes
  #1  
Old 2006-08-20, 13:53
Guest
 
Posts: n/a
Default ever17 music format

I managed to extract the music from ever17 but I'm not exactly sure what format it's in or how I can figure out. It's a .waf file which is something I've never heard of before (at least according to bgm.dat). Any tips or suggestions would be appriciated...
Reply With Quote
  #2  
Old 2006-08-26, 14:45
Vobulle
Guest
 
Posts: n/a
Default

Try using Kid Tools (somewhere here : http://ayuanx.go.8866.org/ ), you will get them in wavefiles. Otherwise there seems to be a waf plugin for foobar, at least...
Reply With Quote
  #3  
Old 2006-08-26, 20:07
Guest
 
Posts: n/a
Default

thanks that did exactly what I wanted
Reply With Quote
  #4  
Old 2006-08-31, 09:43
meplaygames
Guest
 
Posts: n/a
Default how to extract music files?

How do you extract the .waf files from the bgm.dat file?
Reply With Quote
  #5  
Old 2006-08-31, 10:03
meplaygames
Guest
 
Posts: n/a
Default

Ok, thanks people. It did the job.
Reply With Quote
  #6  
Old 2006-11-13, 02:35
X-Calibar X-Calibar is offline
Regular
 
Join Date: Jun 2005
Posts: 73
Send a message via AIM to X-Calibar
Default

Hi everyone~
I downloaded Kid Tools from the site [Thanks!]; And my fears were confirmed ;) :P The music is in a 22KHz! [When I first got the game; when I got to the main menu I noticed it immediately]
I'm hoping to change or replace the music in Ever17 [if I can I'll buy the Ever17 Soundtrack], but due to the ... confusing format; I'm not sure if I'm going to be able to...

Does anyone know how to do this? I couldn't see a way to replace/add files using Kid Tools;
Is there something out there I'm missing?
The only clue I could find was... http://www.jgames.net/Display.asp?RootID=97627
Code:

=========================== 
     BGM分离程序源码 
(就是先从bgm.dat分离出waf再 
将其修改为能播放的wav文件) 
=========================== 
#include <stdio.h> 
#include <string.h>  

/*完整wav文件头数据结构*/ 
static unsigned char header_riff[4]={0x52,0x49,0x46,0x46};/*RIFF文件的旗标*/ 
static unsigned int wav_file_size;/*音频文件长度*/ 
static unsigned char header_wavfmt[12]= 
{0x57,0x41,0x56,0x45,0x66,0x6D,0x74,0x20,0x32,0x00,0x00,0x00};/*wav格式信息名称和字段长度*/ 
static unsigned char wav_feature[16];/*wav格式信息内容*/ 
static unsigned char fill_total[2]={0x20,0x00};/*填充字节总数*/ 
static unsigned char fill_code[32];/*重要的填充字节,与音频播放软件解码有关*/ 
static unsigned char header_fact[12]= 
{0x66,0x61,0x63,0x74,0x04,0x00,0x00,0x00,0x30,0x83,0x6A,0x00};/*fact字段名称与内容*/ 
static unsigned char header_data[4]={0x64,0x61,0x74,0x61};/*data字段名称*/ 
static unsigned int wav_data_size;/*音频数据长度*/ 

/*bgm.dat文件头数据结构*/ 
static unsigned char flag[4];/*bgm.dat的文件旗标*/ 
static unsigned int file_total;/*bgm.dat的包含waf文件总数*/ 
static unsigned char fill_size[8];/*为了将文件头凑够16个字节的填充字节*/ 
static struct 
{ 
 unsigned int start;/*文件数据起始地址*/ 
 unsigned int size;/*文件数据长度*/ 
 unsigned char name[24];/*文件名*/ 
} file_index[256];/*bgm.dat的文件索引信息*/ 

/*程序所需的变量及数组*/ 
static unsigned char rw_buffer[40000000];/*数据读写缓冲区*/ 
static unsigned char *p;/*指向缓冲区数组的指针*/ 
static unsigned int i,j;/*常用循环变量*/ 

int main() 
{ 
 FILE *fp,*fp1; 
 fp=fopen("bgm.dat","rb"); 

 /*读取bgm.dat的文件头*/ 
 fread(flag,1,4,fp); 
 fread(&file_total,4,1,fp); 
 fread(fill_size,1,8,fp); 

 /*读取bgm.dat的文件索引信息*/ 
 for (i=0;i<file_total;i++) 
 { 
  fread(&(file_index[i].start),4,1,fp);/*读取waf文件数据在全部文件索引信息之后的起始地址*/ 
  fread(&(file_index[i].size),4,1,fp);/*读取waf文件数据长度*/  
  fread(file_index[i].name,1,24,fp);/*读取waf文件名*/ 
 } 

 /*数据校正*/ 
 for (i=0;i<file_total;i++) 
 { 
  /*因为地址数据是正确的所以不变*/ 
  file_index[i].size=file_index[i].size>>1;/*实际的waf文件数据长度应该是前面所得数据的一半*/ 
  file_index[i].name[8]='v';/*将文件名的最后一个字母改成“v”以便输出wav文件*/ 
 } 

 /*读取音频数据并输出音频文件*/ 
 for (i=0;i<file_total;i++) 
 { 
  /*读取完整的waf文件数据到缓冲区*/ 
  j=file_index[i].size;fread(rw_buffer,1,j,fp); 

  /*取得对应于wav文件的信息*/ 
  for (j=4;j<20;j++)/*提取wav文件格式信息,*/ 
   wav_feature[j-4]=rw_buffer[j]; 
  wav_feature[0]=2;/*这个千万注意,因为waf里面是0,如果不改过来,根本无法播放*/ 
  for (j=20;j<52;j++)/*提取填充码*/ 
   fill_code[j-20]=rw_buffer[j]; 
  /*计算音频数据长度*/ 
  wav_data_size=rw_buffer[52]; 
  wav_data_size^=rw_buffer[53]<<8; 
  wav_data_size^=rw_buffer[54]<<16; 
  wav_data_size^=rw_buffer[55]<<24; 
  wav_file_size=wav_data_size+82;/*计算出转换成WAV文件的RIFF根节点数据长度*/ 

  /*写入输出文件*/ 
  fp1=fopen(file_index[i].name,"wb"); 
  fwrite(header_riff,1,4,fp1); 
  fwrite(&wav_file_size,4,1,fp1); 
  fwrite(header_wavfmt,1,12,fp1); 
  fwrite(wav_feature,1,16,fp1); 
  fwrite(fill_total,1,2,fp1); 
  fwrite(fill_code,1,32,fp1); 
  fwrite(header_fact,1,12,fp1); 
  fwrite(header_data,1,4,fp1); 
  fwrite(&wav_data_size,4,1,fp1); 
  p=rw_buffer;p+=56;/*调整缓冲区指针指向纯粹的wav数据开始*/ 
  fwrite(p,1,wav_data_size,fp1);/*写入完整的音频数据*/ 
  fclose(fp1); 
 } 
 fclose(fp); 
 return(0); 
}
Which I'm guessing is used to extract the wav...? I'm quite rusty with my programming! But... With this can't I figure out how to reverse the process? [...]
Anybody know anything about this?
[an easy program already out there for this ? :P :)]
Or maybe I just need to open up the dat with some kind of hex thing? find the header? and replace the data after the header? ........
I should just live with it ;) But, if there's a chance?!

Thanks for reading!
Reply With Quote
  #7  
Old 2006-11-17, 10:25
X-Calibar X-Calibar is offline
Regular
 
Join Date: Jun 2005
Posts: 73
Send a message via AIM to X-Calibar
Default

Well I finally looked at this; the code confused me lol
I downloaded a hex editor for the first time :P

Looked through the dat and made observations...
The beginning/header of the .dat contains the names of the files and 2 fields [I imagine the beginning and end of each song memory address]
I haven't explored it enough to understand how to figure it out though; if I'm right.

Each WAF file actually begins with WAF so it was very simple to find the beginning and the ends of each bgm file [and rip it!]

Converting I figured out pretty simply through observations :
my notes:


header (replacing the following respectively allows conversion)

.waf
57 41 46 00 00 YY 02 00 22 ... 04 04 00 F4 ... FF 88 01 18 FF 00 ...

YY is 00 longint 570425856

.wav

52 49 46 46 46 XX XX 00 57 41 56 45 66 6D 74 20 32 00 00 YY 02 00 02 00 22 ... 04 04 00 20 00 F4 ... FF 88 01 18 FF 64 61 74 61 00 ...

XX XX is near the end of header followed by 00 and XY XY
YY is 00 longint 33554944

end file needs 70 padding

basically if you do that it converts the existing Waf files to playable Wav files...

When I look at this next I need to find out how to implment this to 44khz files and figure out the memory location thing; If I get it right, I should be able to overwrite the existing songs and change the length of the dat ... and test by loading in Kid Tools!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ever17 completion Mazyrian General Discussion 5 2009-03-19 19:28
Ever17 on Vista? Ayato Technical Issues 2 2008-07-23 12:18
Ever17 jukebox Ayato Technical Issues 7 2007-09-24 12:08
ever17 help mr.aufziehvogel General Discussion 14 2006-12-01 07:53
ever17 help mr.aufziehvogel Technical Issues 4 2006-09-12 06:58


All times are GMT -8. The time now is 16:34.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2023, vBulletin Solutions, Inc.