public UInt64 IsFormat(StreamReader.IReader fileReader, UInt64 offset, UInt64 length) { // Check for Mark ID (" KPV") if (fileReader.Read_32bitsBE(offset) != 0x58564147) { return(0); } uint channel_count = fileReader.Read_32bitsBE(offset + 0x28); uint sample_rate = fileReader.Read_32bitsBE(offset + 0x3C); if (!VGM_Utils.CheckChannels(channel_count)) { return(0); } if (!VGM_Utils.CheckSampleRate(sample_rate)) { return(0); } uint fileLength = fileReader.Read_32bitsBE(offset + 0x04) + fileReader.Read_32bitsBE(offset + 0x40); return(fileLength); }
public UInt64 IsFormat(StreamReader.IReader fileReader, UInt64 offset, UInt64 length) { // Check for Mark ID (" KPV") if (fileReader.Read_32bitsBE(offset) != 0x204B5056) { return(0); } uint channel_count = fileReader.Read_32bits(offset + 0x14); uint sample_rate = fileReader.Read_32bits(offset + 0x10); if (!VGM_Utils.CheckChannels(channel_count)) { return(0); } if (!VGM_Utils.CheckSampleRate(sample_rate)) { return(0); } uint fileLength = fileReader.Read_32bits(offset + 0x04); uint interleave = fileReader.Read_32bits(offset + 0x0C) / channel_count; int blockCount = (int)(fileLength / interleave); if ((fileLength % interleave) != 0) { blockCount++; } fileLength = (uint)(blockCount * interleave * channel_count); return(fileLength + fileReader.Read_32bits(offset + 0x08)); }
public UInt64 IsFormat(StreamReader.IReader fileReader, UInt64 offset, UInt64 length) { // Check for Mark ID ("AUS ") if (fileReader.Read_32bitsBE(offset) != 0x41555320) { return(0); } uint channel_count = fileReader.Read_32bits(offset + 0x0C); uint sample_rate = fileReader.Read_32bits(offset + 0x10); if (!VGM_Utils.CheckChannels(channel_count)) { return(0); } if (!VGM_Utils.CheckSampleRate(sample_rate)) { return(0); } uint fileLength = (fileReader.Read_32bits(offset + 0x08) * 28 / 16) * channel_count; return(fileLength + 0x28); }
public UInt64 IsFormat(StreamReader.IReader fileReader, UInt64 offset, UInt64 length) { // Check for Mark ID ("SShd") if (fileReader.Read_32bitsBE(offset) != 0x53536864) { return(0); } // Check for Mark ID ("SSbd") if (fileReader.Read_32bitsBE(offset + 0x20) != 0x53536264) { return(0); } uint channel_count = fileReader.Read_32bits(offset + 0x10); uint sample_rate = fileReader.Read_32bits(offset + 0x0c); if (!VGM_Utils.CheckChannels(channel_count)) { return(0); } if (!VGM_Utils.CheckSampleRate(sample_rate)) { return(0); } uint fileLength = fileReader.Read_32bits(offset + 0x024); return(fileLength + 0x28); }
public UInt64 IsFormat(StreamReader.IReader fileReader, UInt64 offset, UInt64 length) { if (fileReader.Read_32bitsBE(offset + 0) != 0x5253544D) /* "RSTM" */ { return(0); } if ((fileReader.Read_32bitsBE(offset + 0x04) != 0xFEFF0100) && (fileReader.Read_32bitsBE(offset + 0x04) != 0xFEFF0001)) { return(0); } /* get head offset, check */ UInt64 head_offset = fileReader.Read_16bitsBE(offset + 0x0C); if (head_offset == 0x10) { m_Description = "Nintendo RSTM Header v1"; } else { m_Description = "Nintendo RSTM Header v2"; } UInt64 rl_head_offset = head_offset + offset; if (fileReader.Read_32bitsBE(head_offset + offset) != 0x48454144) /* "HEAD" */ { return(0); } /* check type details */ byte codec_number = fileReader.Read_8Bits((head_offset == 0x10) ? rl_head_offset + 0x8 : rl_head_offset + 0x20); bool loop_flag = (fileReader.Read_8Bits((head_offset == 0x10) ? rl_head_offset + 0x19 : rl_head_offset + 0x21) != 0); uint channel_count = fileReader.Read_8Bits((head_offset == 0x10) ? rl_head_offset + 0xa : rl_head_offset + 0x22); uint sample_rate = fileReader.Read_16bitsBE((head_offset == 0x10) ? rl_head_offset + 0xc : rl_head_offset + 0x24); if (!VGM_Utils.CheckChannels(channel_count)) { return(0); } if (!VGM_Utils.CheckSampleRate(sample_rate)) { return(0); } if (codec_number > 2) { return(0); } return(fileReader.Read_32bitsBE(offset + 0x08)); }
public UInt64 IsFormat(StreamReader.IReader fileReader, UInt64 offset, UInt64 length) { // Check for Mark ID ("Svag") if (fileReader.Read_32bitsBE(offset) != 0x53766167) { return(0); } // Check for Sample Rate if (!VGM_Utils.CheckSampleRate(fileReader.Read_32bits(offset + 0x08))) { return(0); } // Check Channels count if (!VGM_Utils.CheckChannels(fileReader.Read_32bits(offset + 0x0C))) { return(0); } // Values from 0 -> 0x1C are duplicated at offset 0x400 for (UInt64 i = 0; i < 0x1C / 4; i++) { if (fileReader.Read_32bits(offset + i) != fileReader.Read_32bits(offset + 0x400 + i)) { return(0); } } // Try to find file Length UInt64 startOffset = 0x800; UInt64 fileLength = fileReader.Read_32bits(offset + 0x04); //if (!VGM_Utils.IsPS2ADPCM(fileReader, startOffset + offset, startOffset + offset + fileLength)) // return 0; if (fileReader.Read_32bits(offset + 0x30) == 0x45434B2E) { m_Description = "Konami SVAG (KCE-Tokyo)"; } else { m_Description = "Konami SVAG (KONAMITYO)"; } return(fileLength + startOffset); }
public UInt64 IsFormat(StreamReader.IReader fileReader, UInt64 offset, UInt64 length) { // Check for Mark ID ("NPSF") if (fileReader.Read_32bitsBE(offset) != 0x4E505346) { return(0); } uint channel_count = fileReader.Read_32bits(offset + 0x0C); uint sample_rate = fileReader.Read_32bits(offset + 0x18); if (!VGM_Utils.CheckChannels(channel_count)) { return(0); } if (!VGM_Utils.CheckSampleRate(sample_rate)) { return(0); } if (fileReader.Read_32bits(offset + 0x10) != 0x800) { return(0); } uint fileLength = fileReader.Read_32bits(offset + 0x08); m_Filename = fileReader.Read_String(offset + 0x34, 0x20); if (channel_count == 1) { return(fileLength + 0x800); } else { uint blockCount = fileLength / 0x800; if ((fileLength % 0x800) != 0) { blockCount++; } fileLength = (blockCount * channel_count * 0x800) + 0x800; } return(fileLength); }