mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-12 01:30:49 +01:00
add support for P2BT & GBTS (pop'n'music)
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@555 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
8cf75ca9fa
commit
317112bb68
@ -18,7 +18,7 @@
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="C:\Program Files (x86)\Winamp\Plugins"
|
||||
OutputDirectory="C:\Program Files\Winamp\Plugins"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
>
|
||||
@ -462,6 +462,10 @@
|
||||
RelativePath=".\meta\ps2_filp.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_gbts.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_hgc1.c"
|
||||
>
|
||||
@ -506,6 +510,10 @@
|
||||
RelativePath=".\meta\ps2_npsf.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_p2bt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_pnb.c"
|
||||
>
|
||||
|
@ -320,6 +320,9 @@ VGMSTREAM * init_vgmstream_thp(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_wii_sts(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_p2bt(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_gbts(STREAMFILE *streamFile);
|
||||
VGMSTREAM * init_vgmstream_wii_sng(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_aax(STREAMFILE *streamFile);
|
||||
|
0
src/meta/ngc_iadp.c
Normal file
0
src/meta/ngc_iadp.c
Normal file
92
src/meta/ps2_gbts.c
Normal file
92
src/meta/ps2_gbts.c
Normal file
@ -0,0 +1,92 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* GBTS : Pop'n'Music 9 Bgm File */
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_gbts(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
|
||||
int loop_flag=0;
|
||||
int channel_count;
|
||||
off_t start_offset;
|
||||
off_t loopStart = 0;
|
||||
off_t loopEnd = 0;
|
||||
size_t filelength;
|
||||
|
||||
int i;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("gbts",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check loop */
|
||||
start_offset=0x801;
|
||||
|
||||
filelength = get_streamfile_size(streamFile);
|
||||
do {
|
||||
// Loop Start ...
|
||||
if(read_8bit(start_offset,streamFile)==0x06) {
|
||||
if(loopStart==0) loopStart = start_offset-0x801;
|
||||
}
|
||||
|
||||
// Loop End ...
|
||||
if(read_8bit(start_offset,streamFile)==0x03) {
|
||||
if(loopEnd==0) loopEnd = start_offset-0x801-0x10;
|
||||
}
|
||||
|
||||
start_offset+=0x10;
|
||||
|
||||
} while (start_offset<(int32_t)filelength);
|
||||
|
||||
loop_flag = (loopEnd!=0);
|
||||
channel_count=read_32bitLE(0x1C,streamFile);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitLE(0x18,streamFile);;
|
||||
|
||||
/* Check for Compression Scheme */
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->num_samples = read_32bitLE(0x0C,streamFile)/16*28/vgmstream->channels;
|
||||
vgmstream->interleave_block_size = 0x10;
|
||||
|
||||
/* Get loop point values */
|
||||
if(vgmstream->loop_flag) {
|
||||
vgmstream->loop_start_sample = (loopStart/(vgmstream->interleave_block_size)*vgmstream->interleave_block_size)/16*28;
|
||||
vgmstream->loop_start_sample += (loopStart%vgmstream->interleave_block_size)/16*28;
|
||||
vgmstream->loop_start_sample /=vgmstream->channels;
|
||||
vgmstream->loop_end_sample = (loopEnd/(vgmstream->interleave_block_size)*vgmstream->interleave_block_size)/16*28;
|
||||
vgmstream->loop_end_sample += (loopEnd%vgmstream->interleave_block_size)/16*28;
|
||||
vgmstream->loop_end_sample /=vgmstream->channels;
|
||||
}
|
||||
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->meta_type = meta_PS2_GBTS;
|
||||
|
||||
start_offset = (off_t)0x800;
|
||||
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
vgmstream->ch[i].offset=
|
||||
(off_t)(start_offset+vgmstream->interleave_block_size*i);
|
||||
}
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
70
src/meta/ps2_p2bt.c
Normal file
70
src/meta/ps2_p2bt.c
Normal file
@ -0,0 +1,70 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* P2BT : Pop'n'Music 7 & 8 Bgm File */
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_p2bt(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
|
||||
int loop_flag=0;
|
||||
int channel_count;
|
||||
off_t start_offset;
|
||||
int i;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("p2bt",filename_extension(filename))) goto fail;
|
||||
|
||||
if((read_32bitBE(0x00,streamFile)!=0x4d4F5645) && // MOVE
|
||||
(read_32bitBE(0x00,streamFile)!=0x50324254)) // P2BT
|
||||
goto fail;
|
||||
|
||||
/* check loop */
|
||||
loop_flag = (read_32bitLE(0x0C,streamFile)!=0);
|
||||
channel_count=read_32bitLE(0x20,streamFile);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitLE(0x08,streamFile);;
|
||||
|
||||
/* Check for Compression Scheme */
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->num_samples = read_32bitLE(0x10,streamFile)/16*28/vgmstream->channels;
|
||||
|
||||
/* Get loop point values */
|
||||
if(vgmstream->loop_flag) {
|
||||
vgmstream->loop_start_sample = read_32bitLE(0x0C,streamFile)/16*28/vgmstream->channels;
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
|
||||
vgmstream->interleave_block_size = read_32bitLE(0x14,streamFile);;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->meta_type = meta_PS2_P2BT;
|
||||
|
||||
start_offset = (off_t)0x800;
|
||||
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
vgmstream->ch[i].offset=
|
||||
(off_t)(start_offset+vgmstream->interleave_block_size*i);
|
||||
}
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -178,7 +178,10 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_ss_stream,
|
||||
init_vgmstream_thp,
|
||||
init_vgmstream_wii_sts,
|
||||
init_vgmstream_ps2_p2bt,
|
||||
init_vgmstream_ps2_gbts,
|
||||
init_vgmstream_wii_sng,
|
||||
// init_vgmstream_iadp,
|
||||
init_vgmstream_aax,
|
||||
};
|
||||
|
||||
@ -2016,6 +2019,15 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_STS_WII:
|
||||
snprintf(temp,TEMPSIZE,"Shikigami no Shiro (WII) Header");
|
||||
break;
|
||||
case meta_PS2_P2BT:
|
||||
snprintf(temp,TEMPSIZE,"Pop'n'Music 7 Header");
|
||||
break;
|
||||
case meta_PS2_GBTS:
|
||||
snprintf(temp,TEMPSIZE,"Pop'n'Music 9 Header");
|
||||
break;
|
||||
case meta_NGC_IADP:
|
||||
snprintf(temp,TEMPSIZE,"Dr MUTO Header");
|
||||
break;
|
||||
case meta_RSTM_shrunken:
|
||||
snprintf(temp,TEMPSIZE,"Nintendo RSTM header, corrupted by Atlus");
|
||||
|
@ -358,6 +358,10 @@ typedef enum {
|
||||
meta_FFXI_BGW, /* FFXI BGW */
|
||||
meta_FFXI_SPW, /* FFXI SPW */
|
||||
meta_STS_WII, /* Shikigami No Shiro 3 STS Audio File */
|
||||
meta_PS2_P2BT, /* Pop'n'Music 7 Audio File */
|
||||
meta_PS2_GBTS, /* Pop'n'Music 9 Audio File */
|
||||
meta_NGC_IADP, /* Gamecube Interleave DSP */
|
||||
|
||||
} meta_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -217,7 +217,9 @@ char * extension_list[] = {
|
||||
"smp\0SMP Audio File (*.SMP)\0",
|
||||
"emff\0EMFF Audio File (*.EMFF)\0",
|
||||
"thp\0THP Audio File (*.THP)\0",
|
||||
"p2bt\0P2BT Audio File (*.P2BT)\0",
|
||||
"rwar\0RWAR Audio File (*.RWSD)\0",
|
||||
"gbts\0GBTS Audio File (*.GBTS)\0",
|
||||
"aax\0AAX Audio File (*.AAX)\0",
|
||||
"mwv\0MWV Audio File (*.MWV)\0",
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user