added some more checks in various formats

BETA source for GENH3

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@554 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2009-01-05 11:58:27 +00:00
parent 191bf53d0b
commit 8cf75ca9fa
33 changed files with 3831 additions and 176 deletions

View File

@ -0,0 +1,55 @@
Attribute VB_Name = "Modul1"
Sub ValueChange(Ctrl As Control, ByVal V, ByVal MaxV, ByVal Farbe)
Vertikal = (Ctrl.ScaleWidth <= Ctrl.ScaleHeight)
If Vertikal Then
W = Ctrl.ScaleHeight
TW = Ctrl.TextWidth("100")
If Ctrl.Width < TW Then Ctrl.Width = TW
Else
W = Ctrl.ScaleWidth
End If
Xw = (Abs(V) / Abs(MaxV)) * W
Proz$ = LTrim$(Str$(Int((Xw / W) * 100)))
T$ = "%"
F = Farbe
DM = 14
Select Case F
Case 7, 10, 11, 13, 14
F = 0
DM = 9
Case 15
F = 0
DM = 6
End Select
Ctrl.DrawMode = DM
Ctrl.ForeColor = QBColor(F)
Ctrl.AutoRedraw = True
Ctrl.Cls
Select Case Vertikal
Case 0
Ctrl.CurrentX = (W - Ctrl.TextWidth(Proz$ + "%")) \ 2
Ctrl.Print Proz$ + T$;
Case -1
Ctrl.CurrentX = (Ctrl.ScaleWidth - Ctrl.TextWidth(Proz$)) \ 2
Ctrl.CurrentY = (Ctrl.ScaleHeight - 2 * Ctrl.TextHeight(Proz$)) \ 2
Ctrl.Print Proz$;
Ctrl.CurrentX = (Ctrl.ScaleWidth - Ctrl.TextWidth("%")) \ 2
Ctrl.CurrentY = (Ctrl.ScaleHeight - (Ctrl.TextHeight(Proz$)) \ 2) \ 2
Ctrl.Print "%";
End Select
If V > 0 Then
Select Case Vertikal
Case 0
Ctrl.Line (0, 0)-(Xw, Ctrl.ScaleHeight), QBColor(Farbe), BF
Case -1
Ctrl.Line (0, Ctrl.ScaleHeight - Xw)-(Ctrl.ScaleWidth, Ctrl.ScaleHeight), QBColor(Farbe), BF
End Select
End If
Ctrl.AutoRedraw = False
End Sub

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,50 @@
VERSION 5.00
Begin VB.Form Form2
Caption = "Form2"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 6195
LinkTopic = "Form2"
ScaleHeight = 3090
ScaleWidth = 6195
StartUpPosition = 3 'Windows-Standard
Begin VB.CommandButton Command1
Caption = "Start"
Height = 375
Left = 1440
TabIndex = 1
Top = 1560
Width = 3135
End
Begin VB.TextBox Text1
Alignment = 2 'Zentriert
Height = 285
IMEMode = 3 'DISABLE
Left = 1440
PasswordChar = "*"
TabIndex = 0
Top = 1200
Width = 3135
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
If Text1.Text = "burnout" Then
Unload Form2
Form1.Show
Else:
MsgBox ("Wrong password, cya :P")
Unload Form2
Unload Form1
End If
End Sub

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,39 @@
Type=Exe
Form=Form1.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation
Object={49CBE90A-5F9F-4127-919C-0B74E18CB87E}#1.0#0; CK-Tools.ocx
Form=frmABOUT.frm
Form=Form2.frm
IconForm="Form1"
Startup="Form1"
HelpFile=""
ExeName32="GENeric Header Creator 3.exe"
Path32="C:\Dokumente und Einstellungen\Administrator\Desktop\Generic Header Creator"
Command32=""
Name="Projekt1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="PC"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
[MS Transaction Server]
AutoRefresh=1

View File

@ -0,0 +1,3 @@
Form1 = 0, 0, 601, 456, Z, 22, 29, 623, 485, C
frmABOUT = 0, 0, 0, 0, C, 132, 174, 733, 630, C
Form2 = 110, 145, 711, 601, , 44, 58, 645, 514, C

View File

@ -0,0 +1,19 @@
VERSION 5.00
Begin VB.Form frmABOUT
Caption = "Form2"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form2"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 'Windows-Standard
End
Attribute VB_Name = "frmABOUT"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Binary file not shown.

View File

@ -1,34 +1,38 @@
#include "meta.h"
#include "../util.h"
/* ASD (found in Miss Moonlight) */
/* ASD - found in Miss Moonlight (DC) */
VGMSTREAM * init_vgmstream_dc_asd(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag;
int channel_count;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("asd",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x20,streamFile) != 0x00000000 &&
read_32bitBE(0x24,streamFile) != 0x00000000)
goto fail;
/* We have no "Magic" words in this header format, so we have to do some,
other checks, it seems the samplecount is stored twice in the header,
we'll compare it... */
if (read_32bitLE(0x0,streamFile) != read_32bitLE(0x4,streamFile))
goto fail;
/* compare the frequency with the bitrate, if it doesn't match we'll close
the vgmstream... */
if (read_32bitLE(0x10,streamFile)/read_32bitLE(0xC,streamFile) != (uint16_t)read_16bitLE(0xA,streamFile)*2)
goto fail;
loop_flag = 0;
channel_count = read_16bitLE(0x0A,streamFile);
/* build the VGMSTREAM */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x800;
vgmstream->channels = channel_count;
/* fill in the vital statistics */
start_offset = get_streamfile_size(streamFile) - read_32bitLE(0x0,streamFile);
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x0C,streamFile);
vgmstream->coding_type = coding_PCM16LE;
vgmstream->num_samples = read_32bitLE(0x0,streamFile)/2/channel_count;
@ -36,21 +40,16 @@ VGMSTREAM * init_vgmstream_dc_asd(STREAMFILE *streamFile) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = read_32bitLE(0x0,streamFile)/2/channel_count;
}
switch (channel_count) {
case 1:
vgmstream->layout_type = layout_none;
break;
case 2:
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x2;
break;
default:
goto fail;
}
vgmstream->meta_type = meta_DC_ASD;
if (vgmstream->channels == 1) {
vgmstream->layout_type = layout_none;
} else if (vgmstream->channels == 2) {
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x2;
}
/* open the file for reading */
{
int i;

View File

@ -6,10 +6,10 @@ VGMSTREAM * init_vgmstream_dc_str(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag = 0;
int channel_count;
int samples;
int channel_count;
int samples;
int i;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
@ -20,50 +20,54 @@ VGMSTREAM * init_vgmstream_dc_str(STREAMFILE *streamFile) {
goto fail;
loop_flag = (read_32bitLE(0x00,streamFile)!=0x00000000);
channel_count = read_32bitLE(0x18,streamFile);
samples=read_32bitLE(0x08,streamFile);
samples=read_32bitLE(0x08,streamFile);
channel_count = 2;
vgmstream = allocate_vgmstream(channel_count,loop_flag);
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
switch (channel_count) {
case 1:
vgmstream->layout_type = layout_none;
break;
case 2:
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x0C,streamFile);
break;
default:
goto fail;
}
switch (samples) {
case 4:
vgmstream->coding_type = coding_AICA;
vgmstream->num_samples = read_32bitLE(0x14,streamFile);
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = read_32bitLE(0x14,streamFile);
}
break;
case 16:
vgmstream->coding_type = coding_PCM16LE;
vgmstream->num_samples = read_32bitLE(0x14,streamFile)/2/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = read_32bitLE(0x14,streamFile)/2/channel_count;
}
break;
default:
goto fail;
/* fill in the vital statistics */
switch (read_32bitLE(0x00,streamFile)) {
case 1:
channel_count = 2;
break;
case 2:
channel_count = 2;
break;
case 3:
channel_count = 6;
break;
default:
goto fail;
}
switch (samples) {
case 4:
vgmstream->coding_type = coding_AICA;
vgmstream->num_samples = read_32bitLE(0x14,streamFile);
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = read_32bitLE(0x14,streamFile);
}
break;
case 16:
vgmstream->coding_type = coding_PCM16LE;
vgmstream->num_samples = read_32bitLE(0x14,streamFile)/2/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = read_32bitLE(0x14,streamFile)/2/channel_count;
}
break;
default:
goto fail;
}
vgmstream->channels = channel_count;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x0C,streamFile);
vgmstream->channels = channel_count;
start_offset = 0x800;
vgmstream->sample_rate = read_32bitLE(0x04,streamFile);
vgmstream->meta_type = meta_DC_STR;
vgmstream->meta_type = meta_DC_STR;
/* open the file for reading */
{
@ -74,11 +78,10 @@ VGMSTREAM * init_vgmstream_dc_str(STREAMFILE *streamFile) {
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = file;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+
vgmstream->interleave_block_size*i;
vgmstream->ch[i].adpcm_step_index = 0x7f; /* AICA */
}
}

View File

@ -2,40 +2,37 @@
#include "../util.h"
/* WAV+DCS
2008-12-06 - manakoAT : Evil Twin - Cypriens Chronicles...
2008-12-07 - manakoAT : Added a function to read the Header file and for
retrieving the channels/frequency, Frequency starts
always at a "data" chunk - 0x0C bytes, Channels
always - 0x0E bytes...
*/
2008-12-06 - manakoAT : Evil Twin - Cypriens Chronicles...
2008-12-07 - manakoAT : Added a function to read the Header file and for
retrieving the channels/frequency, Frequency starts
always at a "data" chunk - 0x0C bytes, Channels
always - 0x0E bytes... */
VGMSTREAM * init_vgmstream_dc_wav_dcs(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
VGMSTREAM * vgmstream = NULL;
STREAMFILE * streamFileWAV = NULL;
char filename[260];
char filenameWAV[260];
int i;
int channel_count;
int loop_flag;
int frequency;
int dataBuffer = 0;
int Founddata = 0;
size_t file_size;
off_t current_chunk;
/* check extension, case insensitive */
char filenameWAV[260];
int i;
int channel_count;
int loop_flag;
int frequency;
int dataBuffer = 0;
int Founddata = 0;
size_t file_size;
off_t current_chunk;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("dcs",filename_extension(filename))) goto fail;
/* Getting the Header file name... */
strcpy(filenameWAV,filename);
strcpy(filenameWAV+strlen(filenameWAV)-3,"wav");
/* Look if the Header file is present, else cancel vgmstream */
streamFileWAV = streamFile->open(streamFile,filenameWAV,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!streamFileWAV) goto fail;
/* Getting the Header file name... */
strcpy(filenameWAV,filename);
strcpy(filenameWAV+strlen(filenameWAV)-3,"wav");
/* Look if the Header file is present, else cancel vgmstream */
streamFileWAV = streamFile->open(streamFile,filenameWAV,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!streamFileWAV) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFileWAV) != 0x52494646 || /* "RIFF" */
@ -46,62 +43,57 @@ VGMSTREAM * init_vgmstream_dc_wav_dcs(STREAMFILE *streamFile) {
/* scan file until we find a "data" string */
file_size = get_streamfile_size(streamFileWAV);
{
current_chunk = 0;
/* Start at 0 and loop until we reached the
file size, or until we found a "data string */
while (!Founddata && current_chunk < file_size) {
dataBuffer = (read_32bitBE(current_chunk,streamFileWAV));
if (dataBuffer == 0x64617461) { /* "data" */
/* if "data" string found, retrieve the needed infos */
Founddata = 1;
/* We will cancel the search here if we have a match */
break;
}
/* else we will increase the search offset by 1 */
current_chunk = current_chunk + 1;
}
}
if (Founddata == 0) {
goto fail;
} else if (Founddata == 1) {
channel_count = (uint16_t)read_16bitLE(current_chunk-0x0E,streamFileWAV);
{
current_chunk = 0;
/* Start at 0 and loop until we reached the
file size, or until we found a "data string */
while (!Founddata && current_chunk < file_size) {
dataBuffer = (read_32bitBE(current_chunk,streamFileWAV));
if (dataBuffer == 0x64617461) { /* "data" */
/* if "data" string found, retrieve the needed infos */
Founddata = 1;
/* We will cancel the search here if we have a match */
break;
}
/* else we will increase the search offset by 1 */
current_chunk = current_chunk + 1;
}
}
if (Founddata == 0) {
goto fail;
} else if (Founddata == 1) {
channel_count = (uint16_t)read_16bitLE(current_chunk-0x0E,streamFileWAV);
frequency = read_32bitLE(current_chunk-0x0C,streamFileWAV);
}
loop_flag = 0;
}
loop_flag = 0;
/* Seems we're dealing with a vaild file+header,
now we can finally build the VGMSTREAM */
now we can finally 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 = frequency;
vgmstream->num_samples=(get_streamfile_size(streamFile))*2/channel_count;
if(loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = (get_streamfile_size(streamFile))*2/channel_count;
}
vgmstream->channels = channel_count;
vgmstream->sample_rate = frequency;
vgmstream->num_samples=(get_streamfile_size(streamFile))*2/channel_count;
if(loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = (get_streamfile_size(streamFile))*2/channel_count;
}
switch (channel_count) {
case 1:
vgmstream->layout_type = layout_none;
break;
case 2:
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x4000;
break;
default:
goto fail;
}
if (channel_count == 1) {
vgmstream->layout_type = layout_none;
} else if (channel_count > 1) {
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x4000;
}
vgmstream->coding_type = coding_AICA;
vgmstream->coding_type = coding_AICA;
vgmstream->meta_type = meta_DC_WAV_DCS;
/* open the file for reading */
{
for (i=0;i<channel_count;i++) {
@ -112,8 +104,8 @@ VGMSTREAM * init_vgmstream_dc_wav_dcs(STREAMFILE *streamFile) {
}
}
close_streamfile(streamFileWAV); streamFileWAV=NULL;
close_streamfile(streamFileWAV); streamFileWAV=NULL;
return vgmstream;
/* clean up anything we may have opened */

View File

@ -6,32 +6,32 @@ VGMSTREAM * init_vgmstream_ikm(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag = 0;
int channel_count;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("ikm",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x494B4D00 && /* "IKM\0" */
read_32bitBE(0x40,streamFile) != 0x41535400) /* AST\0 */
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x494B4D00) /* "IKM\0" */
goto fail;
if (read_32bitBE(0x40,streamFile) != 0x41535400) /* AST\0 */
goto fail;
loop_flag = (read_32bitLE(0x14,streamFile)!=0);
loop_flag = (read_32bitLE(0x14,streamFile)!=0); /* Not sure */
channel_count = read_32bitLE(0x50,streamFile);
/* build the VGMSTREAM */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
/* fill in the vital statistics */
start_offset = 0x800;
vgmstream->channels = channel_count;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x44,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = (read_32bitLE(0x4C,streamFile)-0x800)*28/16/channel_count;
vgmstream->num_samples = (read_32bitLE(0x4C,streamFile)-start_offset)/16/channel_count*28;
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x14,streamFile);
vgmstream->loop_end_sample = read_32bitLE(0x18,streamFile);
@ -53,7 +53,6 @@ VGMSTREAM * init_vgmstream_ikm(STREAMFILE *streamFile) {
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+
vgmstream->interleave_block_size*i;
}
}

View File

@ -1,32 +1,34 @@
#include "meta.h"
#include "../util.h"
/* LEG (header format found in Legaia 2 - Duel Saga) */
/* LEG - found in Legaia 2 - Duel Saga (PS2)
the headers are stored seperately in the main executable... */
VGMSTREAM * init_vgmstream_leg(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag = 0;
int channel_count;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("leg",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x10,streamFile) != 0x00000000) /* 0x00000000" */
/* comparing the filesize with (num_samples*0x800) + headersize,
if it doesn't match, we will abort the vgmstream... */
if ((read_32bitLE(0x48,streamFile)*0x800)+0x4C != get_streamfile_size(streamFile))
goto fail;
loop_flag = (read_32bitLE(0x44,streamFile)!=0);
channel_count = 2;
/* build the VGMSTREAM */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
/* fill in the vital statistics */
start_offset = 0x4C;
vgmstream->channels = channel_count;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x40,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = (read_32bitLE(0x48,streamFile)*0x800)*28/16/channel_count;

View File

@ -6,41 +6,45 @@ VGMSTREAM * init_vgmstream_xss(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag = 0;
int channel_count;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("xss",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x04,streamFile) != 0x00F41200)
goto fail;
if (read_32bitBE(0x08,streamFile) != 0xE2344A00)
goto fail;
/* check header */
if ((uint16_t)read_16bitLE(0x15A,streamFile) != 0x10)
goto fail;
if (read_32bitLE(0x154,streamFile) / read_32bitLE(0x150,streamFile) !=
(uint16_t)read_16bitLE(0x158,streamFile))
goto fail;
loop_flag = (read_32bitLE(0x144,streamFile)!=0);
channel_count = read_16bitLE(0x14E,streamFile);
channel_count = (uint16_t)read_16bitLE(0x14E,streamFile);
/* build the VGMSTREAM */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
/* fill in the vital statistics */
start_offset = 0x800;
vgmstream->channels = channel_count;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x150,streamFile);
vgmstream->coding_type = coding_PCM16LE;
vgmstream->num_samples = (get_streamfile_size(streamFile)-0x800)/2/channel_count;
vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset)/2/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x144,streamFile)/2/channel_count;
vgmstream->loop_end_sample = read_32bitLE(0x148,streamFile)/2/channel_count;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x2;
if (vgmstream->channels == 1) {
vgmstream->layout_type = layout_none;
} else if (vgmstream->channels > 1) {
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x2;
}
vgmstream->meta_type = meta_XSS;
/* open the file for reading */