mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 15:54:05 +01:00
add PS2_PNB for PsychoNauts Bgm Files
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@193 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
701fce7c3c
commit
eac7190023
@ -270,6 +270,10 @@
|
||||
RelativePath=".\meta\ps2_npsf.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_pnb.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_rxw.c"
|
||||
>
|
||||
|
@ -65,4 +65,6 @@ VGMSTREAM * init_vgmstream_ps2_str(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_ild(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_pnb(STREAMFILE *streamFile);
|
||||
|
||||
#endif
|
||||
|
66
src/meta/ps2_pnb.c
Normal file
66
src/meta/ps2_pnb.c
Normal file
@ -0,0 +1,66 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* PNB : PsychoNauts Bgm File */
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_pnb(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("pnb",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check loop */
|
||||
loop_flag = (read_32bitLE(0x0C,streamFile)!=0xFFFFFFFF);
|
||||
channel_count=1;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->channels = 1;
|
||||
vgmstream->sample_rate = 44100;
|
||||
|
||||
/* Check for Compression Scheme */
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->num_samples = read_32bitBE(0x08,streamFile)/16*28;
|
||||
|
||||
/* Get loop point values */
|
||||
if(vgmstream->loop_flag) {
|
||||
vgmstream->loop_start_sample = read_32bitBE(0x0C,streamFile)/16*28;
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
|
||||
vgmstream->interleave_block_size = 0x10;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->meta_type = meta_PS2_PNB;
|
||||
|
||||
start_offset = (off_t)read_32bitBE(0x00,streamFile);
|
||||
|
||||
/* 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;
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
* List of functions that will recognize files. These should correspond pretty
|
||||
* directly to the metadata types
|
||||
*/
|
||||
#define INIT_VGMSTREAM_FCNS 31
|
||||
#define INIT_VGMSTREAM_FCNS 32
|
||||
VGMSTREAM * (*init_vgmstream_fcns[INIT_VGMSTREAM_FCNS])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_adx, /* 0 */
|
||||
init_vgmstream_brstm, /* 1 */
|
||||
@ -47,7 +47,8 @@ VGMSTREAM * (*init_vgmstream_fcns[INIT_VGMSTREAM_FCNS])(STREAMFILE *streamFile)
|
||||
init_vgmstream_ps2_vag, /* 27 */
|
||||
init_vgmstream_psx_gms, /* 28 */
|
||||
init_vgmstream_ps2_str, /* 29 */
|
||||
init_vgmstream_ps2_ild /* 30 */
|
||||
init_vgmstream_ps2_ild, /* 30 */
|
||||
init_vgmstream_ps2_pnb /* 31 */
|
||||
};
|
||||
|
||||
/* internal version with all parameters */
|
||||
@ -715,6 +716,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_PS2_ILD:
|
||||
snprintf(temp,TEMPSIZE,"ILD header");
|
||||
break;
|
||||
case meta_PS2_PNB:
|
||||
snprintf(temp,TEMPSIZE,"assumed PNB (PsychoNauts Bgm File) by .pnb header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
|
@ -95,7 +95,7 @@ typedef enum {
|
||||
meta_PSX_GMS, /* GMS File (used in PS1 & PS2) */
|
||||
meta_PS2_STR, /* Pacman STR+STH files */
|
||||
meta_PS2_ILD, /* ILD File */
|
||||
|
||||
meta_PS2_PNB, /* PsychoNauts Bgm File */
|
||||
meta_PSX_XA, /* CD-XA with RIFF header */
|
||||
|
||||
meta_RAW, /* RAW PCM file */
|
||||
|
@ -104,7 +104,8 @@ char * extension_list[] = {
|
||||
"vag\0VAG Audio File (*.VAG)\0",
|
||||
"gms\0GMS Audio File (*.GMS)\0",
|
||||
"str\0STR Audio File (*.STR)\0",
|
||||
"ild\0ILD Audio File (*.ILD)\0"
|
||||
"ild\0ILD Audio File (*.ILD)\0",
|
||||
"pnb\0PNB Audio File (*.PNB)\0"
|
||||
};
|
||||
|
||||
void about(HWND hwndParent) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user