bool VGMFile::LoadVGMFile() { bool val = Load(); if (!val) return false; Format* fmt = GetFormat(); if (fmt) fmt->OnNewFile(this); pRoot->AddLogItem(new LogItem(wstring(L"Loaded \"" + name + L"\" successfully.").c_str(), LOG_LEVEL_INFO, L"VGMFile")); return val; }
void SonyPS2Scanner::SearchForSampColl (RawFile* file) { uint32_t nFileLength = file->size(); if (nFileLength < 32) return; if (StringToLower(file->GetExtension()) == L"bd") { // Hack for incorrectly ripped bd files. Should ALWAYS start with 16 0x00 bytes (must... suppress... rage) // If it doesn't, we'll throw out this file and create a new one with the correct formating uint8_t buf[16]; file->GetBytes(0, 16, buf); int num = CountBytesOfVal(buf, 16, 0); //The first 16 bytes must be all 0x00 if (num != 16) { uint32_t newFileSize = file->size() + 16; uint8_t* newdataBuf = new uint8_t[newFileSize]; file->GetBytes(0, file->size(), newdataBuf+16); memset(newdataBuf, 0, 16); pRoot->CreateVirtFile(newdataBuf, newFileSize, file->GetFileName(), file->GetParRawFileFullPath().c_str()); return; } SonyPS2SampColl* sampColl = new SonyPS2SampColl(file, 0); //sampColl->LoadVGMFile(); Format* fmt = sampColl->GetFormat(); if (fmt) fmt->OnNewFile(sampColl); } //uint8_t buf[32]; //file->GetBytes(0, 32, buf); //int num = CountBytesOfVal(buf, 16, 0); //The first 16 bytes must be all 0x00 //if (num != 16) // return; //num = CountBytesOfVal(buf+16, 16, 0); //It is either extremely unlikely or impossible for bytes 16-31 to be all 0 //if (num == 16) // return; //SonyPS2SampColl* sampColl = new SonyPS2SampColl(file, 0); //sampColl->LoadVGMFile(); }