| 254 | } |
| 255 | |
| 256 | static 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 | |
| 273 | static dmResource::Result ReadCustomResourcePartial(HContext ctx, dmhash_t path_hash, uint32_t offset, uint32_t size, uint8_t* buffer, uint32_t* nread) |
| 274 | { |
no test coverage detected