Improve asset file opening

Avoid wrapping asset files via StormLib, open them directly via SDL
instead.
This commit is contained in:
Gleb Mazovetskiy 2021-10-23 09:15:59 +01:00
commit 7d91bc461a
7 changed files with 33 additions and 40 deletions

View file

@ -21,6 +21,7 @@ std::optional<std::string> appPath;
std::optional<std::string> basePath;
std::optional<std::string> prefPath;
std::optional<std::string> configPath;
std::optional<std::string> assetsPath;
void AddTrailingSlash(std::string &path)
{
@ -84,6 +85,13 @@ const std::string &ConfigPath()
return *configPath;
}
const std::string &AssetsPath()
{
if (!assetsPath)
assetsPath.emplace(AppPath() + "assets/");
return *assetsPath;
}
void SetBasePath(const std::string &path)
{
basePath = path;
@ -102,6 +110,11 @@ void SetConfigPath(const std::string &path)
AddTrailingSlash(*configPath);
}
void SetMpqDir(const std::string &path)
{
mpqDir = std::string(path);
}
} // namespace paths
} // namespace devilution