MCPcopy Create free account
hub / github.com/defold/defold / ReadFile

Function ReadFile

engine/resource/src/providers/provider_archive.cpp:222–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220 }
221
222 static dmResourceProvider::Result ReadFile(dmResourceProvider::HArchiveInternal internal, dmhash_t path_hash, const char* path, uint8_t* buffer, uint32_t buffer_len)
223 {
224 GameArchiveFile* archive = (GameArchiveFile*)internal;
225 EntryInfo* entry = archive->m_EntryMap.Get(path_hash);
226 if (entry)
227 {
228 if (buffer_len < dmEndian::ToNetwork(entry->m_ArchiveInfo->m_ResourceSize))
229 return dmResourceProvider::RESULT_INVAL_ERROR;
230 dmResourceArchive::ReadEntry(archive->m_ArchiveIndex, entry->m_ArchiveInfo, buffer);
231 return dmResourceProvider::RESULT_OK;
232 }
233
234 return dmResourceProvider::RESULT_NOT_FOUND;
235 }
236
237 static dmResourceProvider::Result ReadFilePartial(dmResourceProvider::HArchiveInternal internal, dmhash_t path_hash, const char* path, uint32_t offset, uint32_t size, uint8_t* buffer, uint32_t* nread)
238 {

Callers

nothing calls this directly

Calls 3

ToNetworkFunction · 0.85
ReadEntryFunction · 0.85
GetMethod · 0.45

Tested by

no test coverage detected