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

Function ReadResourcePartial

engine/resource/src/resource_mounts.cpp:352–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350}
351
352dmResource::Result ReadResourcePartial(HContext ctx, dmhash_t path_hash, const char* path, uint32_t offset, uint32_t size, uint8_t* buffer, uint32_t* nread)
353{
354 DM_MUTEX_SCOPED_LOCK(ctx->m_Mutex);
355
356 uint32_t num_mounts = ctx->m_Mounts.Size();
357 for (uint32_t i = 0; i < num_mounts; ++i)
358 {
359 ArchiveMount& mount = ctx->m_Mounts[i];
360 dmResourceProvider::Result result = dmResourceProvider::ReadFilePartial(mount.m_Archive, path_hash, path, offset, size, buffer, nread);
361 if (dmResourceProvider::RESULT_NOT_FOUND == result)
362 continue;
363 if (dmResourceProvider::RESULT_OK == result)
364 {
365 DM_RESOURCE_DBG_LOG(3, "%s: %s (offset: %u size: %u)\n", __FUNCTION__, path, offset, size);
366 DebugPrintMount(3, mount);
367 return dmResource::RESULT_OK;
368 }
369 return ProviderResultToResult(result);
370 }
371
372 if (!ctx->m_CustomFiles.Empty())
373 return ReadCustomResourcePartial(ctx, path_hash, offset, size, buffer, nread);
374
375 return dmResource::RESULT_RESOURCE_NOT_FOUND;
376}
377
378// ****************************************
379// Custom files

Callers 2

TEST_FFunction · 0.85

Calls 6

DebugPrintMountFunction · 0.85
ProviderResultToResultFunction · 0.85
ReadFilePartialFunction · 0.50
SizeMethod · 0.45
EmptyMethod · 0.45

Tested by 1

TEST_FFunction · 0.68