Fix KRDataBlock crashes on Win32

This commit is contained in:
Kearwood Kip Gilbert
2019-08-17 21:57:55 -07:00
parent b9c737ac2f
commit 3b0b087262
4 changed files with 64 additions and 21 deletions

View File

@@ -321,34 +321,34 @@ void KRContext::loadResource(std::string path) {
}
}
KrResult KRContext::unloadResource(const KrUnloadResourceInfo* unloadResourceInfo)
{
if (unloadResourceInfo->resourceHandle < 0 || unloadResourceInfo->resourceHandle >= m_resourceMapSize) {
return KR_ERROR_OUT_OF_BOUNDS;
}
KRResource* resource = m_resourceMap[unloadResourceInfo->resourceHandle];
if (resource == nullptr) {
return KR_ERROR_NOT_MAPPED;
}
// TODO - Need to implement unloading logic
KrResult KRContext::unloadResource(const KrUnloadResourceInfo* unloadResourceInfo)
{
if (unloadResourceInfo->resourceHandle < 0 || unloadResourceInfo->resourceHandle >= m_resourceMapSize) {
return KR_ERROR_OUT_OF_BOUNDS;
}
KRResource* resource = m_resourceMap[unloadResourceInfo->resourceHandle];
if (resource == nullptr) {
return KR_ERROR_NOT_MAPPED;
}
// TODO - Need to implement unloading logic
return KR_ERROR_NOT_IMPLEMENTED;
}
KrResult KRContext::createBundle(const KrCreateBundleInfo* createBundleInfo)
{
if (createBundleInfo->resourceHandle < 0 || createBundleInfo->resourceHandle >= m_resourceMapSize) {
return KR_ERROR_OUT_OF_BOUNDS;
if (createBundleInfo->resourceHandle < 0 || createBundleInfo->resourceHandle >= m_resourceMapSize) {
return KR_ERROR_OUT_OF_BOUNDS;
}
KRResource* bundle = m_pBundleManager->createBundle(createBundleInfo->pBundleName);
m_resourceMap[createBundleInfo->resourceHandle] = bundle;
KRResource* bundle = m_pBundleManager->createBundle(createBundleInfo->pBundleName);
m_resourceMap[createBundleInfo->resourceHandle] = bundle;
return KR_SUCCESS;
}
KrResult KRContext::saveResource(const KrSaveResourceInfo* saveResourceInfo)
{
if (saveResourceInfo->resourceHandle < 0 || saveResourceInfo->resourceHandle >= m_resourceMapSize) {
return KR_ERROR_OUT_OF_BOUNDS;
if (saveResourceInfo->resourceHandle < 0 || saveResourceInfo->resourceHandle >= m_resourceMapSize) {
return KR_ERROR_OUT_OF_BOUNDS;
}
KRResource* resource = m_resourceMap[saveResourceInfo->resourceHandle];
if (resource == nullptr) {