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

Function ReadCustomResource

engine/resource/src/resource_mounts.cpp:256–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254}
255
256static dmResource::Result ReadCustomResource(HContext ctx, dmhash_t path_hash, uint8_t* buffer, uint32_t buffer_size)
257{
258 // Lock should already be held
259 CustomFile* file = ctx->m_CustomFiles.Get(path_hash);
260 if (file)
261 {
262 if (file->m_Size > buffer_size)
263 return dmResource::RESULT_INVAL; // Shouldn't really happen as we just queried the size
264
265 memcpy(buffer, file->m_Resource, buffer_size);
266
267 DM_RESOURCE_DBG_LOG(3, "ReadResource OK: %s " DM_HASH_FMT " (%u bytes) (custom file)\n", dmHashReverseSafe64(path_hash), path_hash, buffer_size);
268 return dmResource::RESULT_OK;
269 }
270 return dmResource::RESULT_RESOURCE_NOT_FOUND;
271}
272
273static dmResource::Result ReadCustomResourcePartial(HContext ctx, dmhash_t path_hash, uint32_t offset, uint32_t size, uint8_t* buffer, uint32_t* nread)
274{

Callers 1

ReadResourceFunction · 0.85

Calls 2

dmHashReverseSafe64Function · 0.85
GetMethod · 0.45

Tested by

no test coverage detected