void P2H_DatabaseHdr (DatabaseHdrPtr pDatabase) { UInt16 lType; BS_DatabaseHdrHeader (pDatabase); lType = IsResource (pDatabase) ? RL_RESOURCES : RL_RECORDS; P2H_RecordList (&pDatabase->recordList, lType); }
void H2P_DatabaseHdr (DatabaseHdrPtr pDatabase) { UInt16 lType; if (! pDatabase) return; lType = IsResource (pDatabase) ? RL_RESOURCES : RL_RECORDS; H2P_RecordList (&pDatabase->recordList, lType); BS_DatabaseHdrHeader (pDatabase); }
void Relocate_DatabaseHdr (DatabaseHdrPtr pDatabase, UInt32 oldBase, UInt32 newBase) { if (! pDatabase) return; if (pDatabase->appInfoID != 0) pDatabase->appInfoID = pDatabase->appInfoID + newBase - oldBase; if (pDatabase->sortInfoID != 0) pDatabase->sortInfoID = pDatabase->sortInfoID + newBase - oldBase; //pDatabase->creator = pDatabase->creator + newBase - oldBase; //pDatabase->uniqueIDSeed = pDatabase->uniqueIDSeed + newBase - oldBase; Relocate_RecordList(&(pDatabase->recordList), oldBase, newBase, IsResource(pDatabase) ? RL_RESOURCES : RL_RECORDS); }
ModelReader * Platform::GetReader(string const & file, string const & searchScope) const { string const ext = my::GetFileExtension(file); ASSERT(!ext.empty(), ()); uint32_t const logPageSize = (ext == DATA_FILE_EXTENSION) ? READER_CHUNK_LOG_SIZE : 10; uint32_t const logPageCount = (ext == DATA_FILE_EXTENSION) ? READER_CHUNK_LOG_COUNT : 4; SourceT sources[SOURCE_COUNT]; size_t n = 0; if (searchScope.empty()) { // Default behaviour - use predefined scope for resource files and writable path for all others. if (IsResource(file, ext)) n = GetSearchSources(file, m_androidDefResScope, sources); else { // Add source for map files and other dynamic stored data. sources[n++] = WRITABLE_PATH; sources[n++] = FULL_PATH; } } else { // Use passed scope as client wishes. n = GetSearchSources(file, searchScope, sources); } #ifdef DEBUG DbgLogger logger(file); #endif for (size_t i = 0; i < n; ++i) { #ifdef DEBUG logger.SetSource(sources[i]); #endif switch (sources[i]) { case EXTERNAL_RESOURCE: for (size_t j = 0; j < m_extResFiles.size(); ++j) { try { return new ZipFileReader(m_extResFiles[j], file, logPageSize, logPageCount); } catch (Reader::OpenException const &) { } } break; case WRITABLE_PATH: { string const path = m_writableDir + file; if (IsFileExistsByFullPath(path)) return new FileReader(path, logPageSize, logPageCount); break; } case SETTINGS_PATH: { string const path = m_settingsDir + file; if (IsFileExistsByFullPath(path)) return new FileReader(path, logPageSize, logPageCount); break; } case FULL_PATH: if (IsFileExistsByFullPath(file)) return new FileReader(file, logPageSize, logPageCount); break; case RESOURCE: ASSERT_EQUAL(file.find("assets/"), string::npos, ()); try { return new ZipFileReader(m_resourcesDir, "assets/" + file, logPageSize, logPageCount); } catch (Reader::OpenException const &) { } break; default: CHECK(false, ("Unsupported source:", sources[i])); break; } } LOG(LWARNING, ("Can't get reader for:", file)); MYTHROW(FileAbsentException, ("File not found", file)); return 0; }