diff --git a/Code/Misc/Misc.vcxproj b/Code/Misc/Misc.vcxproj index 6c3db1ec..2d9392a3 100644 --- a/Code/Misc/Misc.vcxproj +++ b/Code/Misc/Misc.vcxproj @@ -152,8 +152,10 @@ - true - true + false + false + false + false @@ -172,8 +174,10 @@ - true - true + false + false + false + false diff --git a/Code/Misc/Resource/ResourceManager.cpp b/Code/Misc/Resource/ResourceManager.cpp index b4195bb4..67776888 100644 --- a/Code/Misc/Resource/ResourceManager.cpp +++ b/Code/Misc/Resource/ResourceManager.cpp @@ -123,7 +123,7 @@ bool Release(std::map& resources, ResourceData* res resource->resource = 0; break; - case Oyster::Resource::ResourceType_UNKNOWN: + case Oyster::Resource::ResourceType_CUSTOM: resource->unloadFnc(resource->resource); resource->resource = 0; break; @@ -137,6 +137,13 @@ bool Release(std::map& resources, ResourceData* res } ResourceData* Load(/*Out*/ResourceData* targetMem, /*in*/const wchar_t source[], /*in*/ResourceType type) { + targetMem->resource = 0; + targetMem->loadFnc = 0; + targetMem->unloadFnc = 0; + targetMem->resourceID = 0; + targetMem->resourcetype = type; + targetMem->resourceSize = 0; + std::string sOut; bool success = false; @@ -182,13 +189,20 @@ ResourceData* Load(/*Out*/ResourceData* targetMem, /*in*/const wchar_t source[], } ResourceData* Load(/*Out*/ResourceData* targetMem, /*in*/const wchar_t source[], LoadFunction loadFnc, UnloadFunction unloadFnc) { + targetMem->resource = 0; + targetMem->loadFnc = 0; + targetMem->unloadFnc = 0; + targetMem->resourceID = 0; + targetMem->resourcetype = ResourceType_CUSTOM; + targetMem->resourceSize = 0; + if(loadFnc) { targetMem->resource = loadFnc(source); if(targetMem->resource) { targetMem->resourceSize = 0; - targetMem->resourcetype = ResourceType_UNKNOWN; + targetMem->resourcetype = ResourceType_CUSTOM; targetMem->loadFnc = loadFnc; targetMem->unloadFnc = unloadFnc; } @@ -208,7 +222,7 @@ ResourceData* Reload(std::map resources, ResourceDa return Load(resource, filename, resource->loadFnc, resource->unloadFnc); break; - case Oyster::Resource::ResourceType_UNKNOWN: + case Oyster::Resource::ResourceType_CUSTOM: { resource->unloadFnc(resource->resource); diff --git a/Code/Misc/Resource/ResourceManager.h b/Code/Misc/Resource/ResourceManager.h index 4ab34b9b..4c90966e 100644 --- a/Code/Misc/Resource/ResourceManager.h +++ b/Code/Misc/Resource/ResourceManager.h @@ -29,10 +29,8 @@ namespace Oyster ResourceType_Byte_UNICODE, /**< Handle can be interpeted as char[] or char* */ ResourceType_Byte_UTF16LE, /**< Handle can be interpeted as char[] or char* */ - ResourceType_COUNT, /**< Handle can be interpeted as ? */ - - ResourceType_UNKNOWN = -1, /**< Handle can be interpeted as void* */ - ResourceType_INVALID = -2, /**< Invalid or non existing resource */ + ResourceType_CUSTOM, /**< Handle can be interpeted as whatever */ + ResourceType_INVALID, /**< Handle can be interpeted as whatever */ }; /** A resource handler interface to interact with when loading resources.