Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/ColladaManager.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | public: | ||||
{ | { | ||||
// Support hotloading | // Support hotloading | ||||
RegisterFileReloadFunc(ReloadChangedFileCB, this); | RegisterFileReloadFunc(ReloadChangedFileCB, this); | ||||
} | } | ||||
~CColladaManagerImpl() | ~CColladaManagerImpl() | ||||
{ | { | ||||
if (dll.IsLoaded()) | if (dll.IsLoaded()) | ||||
set_logger(NULL, NULL); // unregister the log handler | set_logger(nullptr, nullptr); // unregister the log handler | ||||
UnregisterFileReloadFunc(ReloadChangedFileCB, this); | UnregisterFileReloadFunc(ReloadChangedFileCB, this); | ||||
} | } | ||||
Status ReloadChangedFile(const VfsPath& path) | Status ReloadChangedFile(const VfsPath& path) | ||||
{ | { | ||||
// Ignore files that aren't in the right path | // Ignore files that aren't in the right path | ||||
if (!boost::algorithm::starts_with(path.string(), L"art/skeletons/")) | if (!boost::algorithm::starts_with(path.string(), L"art/skeletons/")) | ||||
return INFO::OK; | return INFO::OK; | ||||
▲ Show 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | if (m_skeletonHashInvalidated) | ||||
// We need two u64s per file | // We need two u64s per file | ||||
m_skeletonHashes.clear(); | m_skeletonHashes.clear(); | ||||
m_skeletonHashes.reserve(paths.size()*2); | m_skeletonHashes.reserve(paths.size()*2); | ||||
CFileInfo fileInfo; | CFileInfo fileInfo; | ||||
for (const VfsPath& path : paths) | for (const VfsPath& path : paths) | ||||
{ | { | ||||
// This will cause an assertion failure if *it doesn't exist, | // This will cause an assertion failure if *it doesn't exist, | ||||
// because fileinfo is not a NULL pointer, which is annoying but that | // because fileinfo is not a nullptr pointer, which is annoying but that | ||||
// should never happen, unless there really is a problem | // should never happen, unless there really is a problem | ||||
if (m_VFS->GetFileInfo(path, &fileInfo) != INFO::OK) | if (m_VFS->GetFileInfo(path, &fileInfo) != INFO::OK) | ||||
{ | { | ||||
LOGERROR("Failed to stat '%s' for DAE caching", path.string8()); | LOGERROR("Failed to stat '%s' for DAE caching", path.string8()); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_skeletonHashes.push_back((u64)fileInfo.MTime() & ~1); //skip lowest bit, since zip and FAT don't preserve it | m_skeletonHashes.push_back((u64)fileInfo.MTime() & ~1); //skip lowest bit, since zip and FAT don't preserve it | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | VfsPath CColladaManager::GetLoadablePath(const VfsPath& pathnameNoExtension, FileType type) | ||||
// No valid cached version, check if we have a source .dae | // No valid cached version, check if we have a source .dae | ||||
if (ret != INFO::SKIPPED) | if (ret != INFO::SKIPPED) | ||||
{ | { | ||||
// No valid cached version was found, and no source .dae exists | // No valid cached version was found, and no source .dae exists | ||||
ENSURE(ret < 0); | ENSURE(ret < 0); | ||||
// Check if source (uncached) .pmd/psa exists | // Check if source (uncached) .pmd/psa exists | ||||
sourcePath = pathnameNoExtension.ChangeExtension(extn); | sourcePath = pathnameNoExtension.ChangeExtension(extn); | ||||
if (m_VFS->GetFileInfo(sourcePath, NULL) != INFO::OK) | if (m_VFS->GetFileInfo(sourcePath, nullptr) != INFO::OK) | ||||
{ | { | ||||
// Broken reference, the caller will need to handle this | // Broken reference, the caller will need to handle this | ||||
return L""; | return L""; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
return sourcePath; | return sourcePath; | ||||
} | } | ||||
Show All 32 Lines |
Wildfire Games · Phabricator