2014-08-11 18:04:44 +00:00
|
|
|
#ifndef MISC_RESOURCEHELPERS_H
|
|
|
|
#define MISC_RESOURCEHELPERS_H
|
|
|
|
|
2024-02-22 22:44:12 +00:00
|
|
|
#include <components/vfs/pathutil.hpp>
|
|
|
|
|
2024-02-23 01:34:01 +00:00
|
|
|
#include <span>
|
2014-08-11 18:04:44 +00:00
|
|
|
#include <string>
|
2021-06-29 01:47:23 +00:00
|
|
|
#include <string_view>
|
2014-08-11 18:04:44 +00:00
|
|
|
|
2015-03-19 00:45:01 +00:00
|
|
|
namespace VFS
|
|
|
|
{
|
|
|
|
class Manager;
|
|
|
|
}
|
|
|
|
|
2022-10-03 17:49:20 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
2023-02-15 22:19:51 +00:00
|
|
|
class RefId;
|
2022-10-03 17:49:20 +00:00
|
|
|
}
|
|
|
|
|
2014-08-11 18:04:44 +00:00
|
|
|
namespace Misc
|
|
|
|
{
|
2015-05-01 16:37:24 +00:00
|
|
|
// Workarounds for messy resource handling in vanilla morrowind
|
|
|
|
// The below functions are provided on a opt-in basis, instead of built into the VFS,
|
|
|
|
// so we have the opportunity to use proper resource handling for content created in OpenMW-CS.
|
2014-08-11 18:04:44 +00:00
|
|
|
namespace ResourceHelpers
|
|
|
|
{
|
2014-08-12 10:18:38 +00:00
|
|
|
bool changeExtensionToDds(std::string& path);
|
2022-08-22 14:55:53 +00:00
|
|
|
std::string correctResourcePath(
|
2024-02-23 01:34:01 +00:00
|
|
|
std::span<const std::string_view> topLevelDirectories, std::string_view resPath, const VFS::Manager* vfs);
|
2022-08-22 14:55:53 +00:00
|
|
|
std::string correctTexturePath(std::string_view resPath, const VFS::Manager* vfs);
|
|
|
|
std::string correctIconPath(std::string_view resPath, const VFS::Manager* vfs);
|
|
|
|
std::string correctBookartPath(std::string_view resPath, const VFS::Manager* vfs);
|
|
|
|
std::string correctBookartPath(std::string_view resPath, int width, int height, const VFS::Manager* vfs);
|
2023-01-14 00:35:50 +00:00
|
|
|
/// Use "xfoo.nif" instead of "foo.nif" if "xfoo.kf" is available
|
|
|
|
/// Note that if "xfoo.nif" is actually unavailable, we can't fall back to "foo.nif". :(
|
2024-10-19 12:07:47 +00:00
|
|
|
VFS::Path::Normalized correctActorModelPath(VFS::Path::NormalizedView resPath, const VFS::Manager* vfs);
|
2024-04-18 02:01:12 +00:00
|
|
|
std::string correctMaterialPath(std::string_view resPath, const VFS::Manager* vfs);
|
2023-06-17 18:47:42 +00:00
|
|
|
|
2024-11-15 00:25:40 +00:00
|
|
|
// Prepends "meshes/".
|
|
|
|
VFS::Path::Normalized correctMeshPath(VFS::Path::NormalizedView resPath);
|
2021-06-29 01:47:23 +00:00
|
|
|
|
2024-04-14 17:51:48 +00:00
|
|
|
// Prepends "sound/".
|
2024-02-22 22:44:12 +00:00
|
|
|
VFS::Path::Normalized correctSoundPath(VFS::Path::NormalizedView resPath);
|
2023-07-19 13:21:17 +00:00
|
|
|
|
2024-04-14 17:51:48 +00:00
|
|
|
// Prepends "music/".
|
|
|
|
VFS::Path::Normalized correctMusicPath(VFS::Path::NormalizedView resPath);
|
2023-08-18 07:03:37 +00:00
|
|
|
|
2023-06-17 18:47:42 +00:00
|
|
|
// Removes "meshes\\".
|
|
|
|
std::string_view meshPathForESM3(std::string_view resPath);
|
|
|
|
|
2024-02-22 22:44:12 +00:00
|
|
|
VFS::Path::Normalized correctSoundPath(VFS::Path::NormalizedView resPath, const VFS::Manager& vfs);
|
2021-11-10 22:06:35 +00:00
|
|
|
|
2021-06-29 01:47:23 +00:00
|
|
|
/// marker objects that have a hardcoded function in the game logic, should be hidden from the player
|
2022-10-03 17:49:20 +00:00
|
|
|
bool isHiddenMarker(const ESM::RefId& id);
|
2024-11-15 00:02:43 +00:00
|
|
|
|
|
|
|
VFS::Path::Normalized getLODMeshName(
|
|
|
|
int esmVersion, VFS::Path::NormalizedView resPath, const VFS::Manager& vfs, unsigned char lod = 0);
|
2014-08-11 18:04:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|