| 805 | } |
| 806 | |
| 807 | static Result CheckAndGetResourceFromPath(HFactory factory, dmhash_t canonical_path_hash, void** resource_out) |
| 808 | { |
| 809 | *resource_out = 0; |
| 810 | |
| 811 | // Try to get from already loaded resources |
| 812 | ResourceDescriptor* rd = factory->m_Resources->Get(canonical_path_hash); |
| 813 | if (rd) |
| 814 | { |
| 815 | assert(factory->m_ResourceToHash->Get((uintptr_t) rd->m_Resource)); |
| 816 | rd->m_ReferenceCount++; |
| 817 | *resource_out = rd->m_Resource; |
| 818 | return RESULT_OK; |
| 819 | } |
| 820 | |
| 821 | if (factory->m_Resources->Full()) |
| 822 | { |
| 823 | dmLogError("The max number of resources (%d) has been passed, tweak \"%s\" in the config file.", factory->m_Resources->Capacity(), MAX_RESOURCES_KEY); |
| 824 | return RESULT_OUT_OF_RESOURCES; |
| 825 | } |
| 826 | |
| 827 | return RESULT_RESOURCE_NOT_FOUND; |
| 828 | } |
| 829 | |
| 830 | static Result CheckAndGetResourceTypeFromPath(HFactory factory, const char* canonical_path, HResourceType* resource_type_out) |
| 831 | { |
no test coverage detected