Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/ColladaManager.cpp
/* Copyright (C) 2017 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 197 Lines • ▼ Show 20 Lines | catch (PSERROR_DllLoader&) | ||||
return false; | return false; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
bool LoadSkeletonDefinitions() | bool LoadSkeletonDefinitions() | ||||
{ | { | ||||
VfsPaths pathnames; | VfsPaths pathnames; | ||||
if (vfs::GetPathnames(m_VFS, L"art/skeletons/", L"*.xml", pathnames) < 0) | if (vfs::GetPathnames(m_VFS, L"art/skeletons/", L"*.xml", pathnames, false) < 0) | ||||
{ | { | ||||
LOGERROR("No skeleton definition files present"); | LOGERROR("No skeleton definition files present"); | ||||
return false; | return false; | ||||
} | } | ||||
bool loaded = false; | bool loaded = false; | ||||
for (const VfsPath& path : pathnames) | for (const VfsPath& path : pathnames) | ||||
{ | { | ||||
Show All 35 Lines | public: | ||||
void PrepareCacheKey(MD5& hash, u32& version) | void PrepareCacheKey(MD5& hash, u32& version) | ||||
{ | { | ||||
// Add converter version to the hash | // Add converter version to the hash | ||||
version = COLLADA_CONVERTER_VERSION; | version = COLLADA_CONVERTER_VERSION; | ||||
// Cache the skeleton files hash data | // Cache the skeleton files hash data | ||||
if (m_skeletonHashInvalidated) | if (m_skeletonHashInvalidated) | ||||
{ | { | ||||
// Sort the paths to not invalidate the cache if mods are mounted in different order | |||||
// (No need to stable_sort as the VFS gurantees that we have no duplicates) | |||||
VfsPaths paths; | VfsPaths paths; | ||||
if (vfs::GetPathnames(m_VFS, L"art/skeletons/", L"*.xml", paths) != INFO::OK) | if (vfs::GetPathnames(m_VFS, L"art/skeletons/", L"*.xml", paths, true) != INFO::OK) | ||||
{ | { | ||||
LOGWARNING("Failed to load skeleton definitions"); | LOGWARNING("Failed to load skeleton definitions"); | ||||
return; | return; | ||||
} | } | ||||
// Sort the paths to not invalidate the cache if mods are mounted in different order | |||||
// (No need to stable_sort as the VFS gurantees that we have no duplicates) | |||||
std::sort(paths.begin(), paths.end()); | |||||
// 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, | ||||
▲ Show 20 Lines • Show All 148 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator