mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-07 15:01:24 +01:00
Forgot to close header file for PS2 WMUS.
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@922 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
ef1aa13b3d
commit
8489991ec9
@ -1,101 +1,102 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
|
|
||||||
//#include <windows.h>
|
//#include <windows.h>
|
||||||
//#include <tchar.h>
|
//#include <tchar.h>
|
||||||
|
|
||||||
/* WMUS - Arbitrary extension chosen for The Warriors (PS2) */
|
/* WMUS - Arbitrary extension chosen for The Warriors (PS2) */
|
||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ps2_wmus(STREAMFILE *streamFile)
|
VGMSTREAM * init_vgmstream_ps2_wmus(STREAMFILE *streamFile)
|
||||||
{
|
{
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM * vgmstream = NULL;
|
||||||
char filename[260];
|
char filename[260];
|
||||||
|
|
||||||
int loop_flag = 1;
|
int loop_flag = 1;
|
||||||
int channel_count;
|
int channel_count;
|
||||||
off_t start_offset;
|
off_t start_offset;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
int blockCount;
|
int blockCount;
|
||||||
int shortBlockSize;
|
int shortBlockSize;
|
||||||
int lastBlockLocation;
|
int lastBlockLocation;
|
||||||
|
|
||||||
char filenameWHED[260];
|
char filenameWHED[260];
|
||||||
STREAMFILE * streamFileWHED = NULL;
|
STREAMFILE * streamFileWHED = NULL;
|
||||||
|
|
||||||
//_TCHAR szBuffer[100];
|
//_TCHAR szBuffer[100];
|
||||||
|
|
||||||
/* check extension, case insensitive */
|
/* check extension, case insensitive */
|
||||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||||
|
|
||||||
if (strcasecmp("wmus",filename_extension(filename)))
|
if (strcasecmp("wmus",filename_extension(filename)))
|
||||||
{
|
{
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for .WHED file */
|
/* check for .WHED file */
|
||||||
strcpy(filenameWHED, filename);
|
strcpy(filenameWHED, filename);
|
||||||
strcpy(filenameWHED + strlen(filenameWHED) - 4, "WHED");
|
strcpy(filenameWHED + strlen(filenameWHED) - 4, "WHED");
|
||||||
|
|
||||||
streamFileWHED = streamFile->open(streamFile, filenameWHED, STREAMFILE_DEFAULT_BUFFER_SIZE);
|
streamFileWHED = streamFile->open(streamFile, filenameWHED, STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||||
if (!streamFileWHED)
|
if (!streamFileWHED)
|
||||||
{
|
{
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check loopand channel */
|
/* check loopand channel */
|
||||||
loop_flag = 1;
|
loop_flag = 1;
|
||||||
channel_count = read_32bitLE(0x14, streamFileWHED);
|
channel_count = read_32bitLE(0x14, streamFileWHED);
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
/* build the VGMSTREAM */
|
||||||
vgmstream = allocate_vgmstream(channel_count, loop_flag);
|
vgmstream = allocate_vgmstream(channel_count, loop_flag);
|
||||||
if (!vgmstream)
|
if (!vgmstream)
|
||||||
{
|
{
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fill in the vital statistics */
|
/* fill in the vital statistics */
|
||||||
vgmstream->channels = channel_count;
|
vgmstream->channels = channel_count;
|
||||||
vgmstream->sample_rate = read_32bitLE(0x04, streamFileWHED);
|
vgmstream->sample_rate = read_32bitLE(0x04, streamFileWHED);
|
||||||
|
|
||||||
vgmstream->coding_type = coding_PSX;
|
vgmstream->coding_type = coding_PSX;
|
||||||
|
|
||||||
vgmstream->interleave_block_size = read_32bitLE(0x18, streamFileWHED);
|
vgmstream->interleave_block_size = read_32bitLE(0x18, streamFileWHED);
|
||||||
blockCount = read_32bitLE(0x1C, streamFileWHED) * channel_count;
|
blockCount = read_32bitLE(0x1C, streamFileWHED) * channel_count;
|
||||||
shortBlockSize = read_32bitLE(0x20, streamFileWHED);
|
shortBlockSize = read_32bitLE(0x20, streamFileWHED);
|
||||||
|
|
||||||
vgmstream->num_samples = (vgmstream->interleave_block_size * blockCount) / 16 / channel_count * 28;
|
vgmstream->num_samples = (vgmstream->interleave_block_size * blockCount) / 16 / channel_count * 28;
|
||||||
vgmstream->loop_start_sample = 0;
|
vgmstream->loop_start_sample = 0;
|
||||||
|
|
||||||
lastBlockLocation = (vgmstream->interleave_block_size * blockCount) - (vgmstream->interleave_block_size - shortBlockSize);
|
lastBlockLocation = (vgmstream->interleave_block_size * blockCount) - (vgmstream->interleave_block_size - shortBlockSize);
|
||||||
vgmstream->loop_end_sample = lastBlockLocation / 16 / channel_count * 28;
|
vgmstream->loop_end_sample = lastBlockLocation / 16 / channel_count * 28;
|
||||||
|
|
||||||
//_stprintf(szBuffer, _T("%x"), lastBlockLocation);
|
//_stprintf(szBuffer, _T("%x"), lastBlockLocation);
|
||||||
//MessageBox(NULL, szBuffer, _T("Foo"), MB_OK);
|
//MessageBox(NULL, szBuffer, _T("Foo"), MB_OK);
|
||||||
|
|
||||||
|
|
||||||
vgmstream->layout_type = layout_interleave;
|
vgmstream->layout_type = layout_interleave;
|
||||||
vgmstream->meta_type = meta_PS2_WMUS;
|
vgmstream->meta_type = meta_PS2_WMUS;
|
||||||
|
|
||||||
start_offset = 0;
|
start_offset = 0;
|
||||||
|
|
||||||
/* open the file for reading by each channel */
|
/* open the file for reading by each channel */
|
||||||
{
|
{
|
||||||
for (i=0;i<channel_count;i++) {
|
for (i=0;i<channel_count;i++) {
|
||||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||||
|
|
||||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||||
|
|
||||||
vgmstream->ch[i].channel_start_offset=
|
vgmstream->ch[i].channel_start_offset=
|
||||||
vgmstream->ch[i].offset=
|
vgmstream->ch[i].offset=
|
||||||
(off_t)(start_offset+vgmstream->interleave_block_size*i);
|
(off_t)(start_offset+vgmstream->interleave_block_size*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return vgmstream;
|
return vgmstream;
|
||||||
|
|
||||||
/* clean up anything we may have opened */
|
/* clean up anything we may have opened */
|
||||||
fail:
|
fail:
|
||||||
if (vgmstream) close_vgmstream(vgmstream);
|
if (streamFileWHED) close_streamfile(streamFileWHED);
|
||||||
return NULL;
|
if (vgmstream) close_vgmstream(vgmstream);
|
||||||
}
|
return NULL;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user