-added banner sound support for avatar and maybe more games

This commit is contained in:
fix94.1 2012-08-11 15:43:19 +00:00
parent f44356b0c3
commit efaa4ea569

View File

@ -59,6 +59,7 @@ WavDecoder::~WavDecoder()
void WavDecoder::OpenFile() void WavDecoder::OpenFile()
{ {
DataOffset = 0;
SWaveHdr Header; SWaveHdr Header;
SWaveFmtChunk FmtChunk; SWaveFmtChunk FmtChunk;
memset(&Header, 0, sizeof(SWaveHdr)); memset(&Header, 0, sizeof(SWaveHdr));
@ -77,13 +78,19 @@ void WavDecoder::OpenFile()
CloseFile(); CloseFile();
return; return;
} }
else if(FmtChunk.magicFMT != 'fmt ') if(FmtChunk.magicFMT == 'bext') //Stupid metadata
{
DataOffset += le32(FmtChunk.size) + 8;
file_fd->seek(sizeof(SWaveHdr) + le32(FmtChunk.size) + 8, SEEK_SET);
file_fd->read((u8 *)&FmtChunk, sizeof(SWaveFmtChunk));
}
if(FmtChunk.magicFMT != 'fmt ')
{ {
CloseFile(); CloseFile();
return; return;
} }
DataOffset = sizeof(SWaveHdr)+le32(FmtChunk.size)+8; DataOffset += sizeof(SWaveHdr) + le32(FmtChunk.size) + 8;
file_fd->seek(DataOffset, SEEK_SET); file_fd->seek(DataOffset, SEEK_SET);
SWaveChunk DataChunk; SWaveChunk DataChunk;
file_fd->read((u8 *) &DataChunk, sizeof(SWaveChunk)); file_fd->read((u8 *) &DataChunk, sizeof(SWaveChunk));