MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / index_db

Method index_db

ogsr_engine/xrCore/arc_db.cpp:78–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78void CLocatorAPI::archive::index_db(CLocatorAPI& loc, const char* fs_entry_point) const
79{
80 IReader* hdr = open_archive_chunk(hSrcFile, 1, path.c_str(), size);
81 R_ASSERT(hdr);
82 RStringVec fv;
83 while (!hdr->eof())
84 {
85 string_path name, full;
86 string1024 buffer_start;
87 size_t buffer_size = hdr->r_u16();
88 VERIFY(buffer_size < sizeof(name) + 4 * sizeof(u32));
89 VERIFY(buffer_size < sizeof(buffer_start));
90 u8* buffer = (u8*)&*buffer_start;
91 hdr->r(buffer, buffer_size);
92
93 u32 size_real = *(u32*)buffer;
94 buffer += sizeof(size_real);
95
96 u32 size_compr = *(u32*)buffer;
97 buffer += sizeof(size_compr);
98
99 // Skip unused checksum
100 buffer += sizeof(u32);
101
102 size_t name_length = buffer_size - 4 * sizeof(u32);
103 Memory.mem_copy(name, buffer, name_length);
104 name[name_length] = 0;
105 buffer += buffer_size - 4 * sizeof(u32);
106
107 u32 ptr = *(u32*)buffer;
108 buffer += sizeof(ptr);
109
110 strconcat(sizeof(full), full, fs_entry_point, name);
111
112 loc.Register(full, vfs_idx, ptr, size_real, size_compr, 0);
113 }
114 hdr->close();
115}
116
117IReader* CLocatorAPI::archive::read_db(const char* fname, const struct file& desc, u32 gran) const
118{

Callers

nothing calls this directly

Calls 7

open_archive_chunkFunction · 0.85
eofMethod · 0.80
c_strMethod · 0.45
r_u16Method · 0.45
rMethod · 0.45
RegisterMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected