Commit 337cdf74 authored by Florian Oetke's avatar Florian Oetke
Browse files

fixed asset manager load order

parent c307816e
Pipeline #2953 passed with stage
in 13 minutes and 27 seconds
...@@ -209,23 +209,6 @@ namespace mirrage::asset { ...@@ -209,23 +209,6 @@ namespace mirrage::asset {
throw std::system_error(static_cast<Asset_error>(PHYSFS_getLastErrorCode()), throw std::system_error(static_cast<Asset_error>(PHYSFS_getLastErrorCode()),
"Unable to set write-dir: "s + write_dir); "Unable to set write-dir: "s + write_dir);
for(auto ea : Embedded_asset::instances()) {
LOG(plog::info) << "Include embedded asset \"" << ea->name() << "\": " << ea->data().size()
<< " bytes MD5: "
<< util::md5(std::string(reinterpret_cast<const char*>(ea->data().data()),
std::size_t(ea->data().size_bytes())));
auto name = "embedded_" + ea->name() + ".zip";
if(!PHYSFS_mountMemory(ea->data().data(),
static_cast<PHYSFS_uint64>(ea->data().size_bytes()),
nullptr,
name.c_str(),
nullptr,
1)) {
throw std::system_error(static_cast<Asset_error>(PHYSFS_getLastErrorCode()),
"Unable to add embedded archive: "s + ea->name());
}
}
auto add_source = [](std::string path) { auto add_source = [](std::string path) {
auto apath = PHYSFS_getRealDir(path.c_str()); auto apath = PHYSFS_getRealDir(path.c_str());
if(apath) { if(apath) {
...@@ -276,6 +259,23 @@ namespace mirrage::asset { ...@@ -276,6 +259,23 @@ namespace mirrage::asset {
} }
} }
for(auto ea : Embedded_asset::instances()) {
LOG(plog::info) << "Include embedded asset \"" << ea->name() << "\": " << ea->data().size()
<< " bytes MD5: "
<< util::md5(std::string(reinterpret_cast<const char*>(ea->data().data()),
std::size_t(ea->data().size_bytes())));
auto name = "embedded_" + ea->name() + ".zip";
if(!PHYSFS_mountMemory(ea->data().data(),
static_cast<PHYSFS_uint64>(ea->data().size_bytes()),
nullptr,
name.c_str(),
nullptr,
1)) {
throw std::system_error(static_cast<Asset_error>(PHYSFS_getLastErrorCode()),
"Unable to add embedded archive: "s + ea->name());
}
}
// unmount default search-path // unmount default search-path
PHYSFS_unmount(PHYSFS_getBaseDir()); PHYSFS_unmount(PHYSFS_getBaseDir());
PHYSFS_unmount(append_file(PHYSFS_getBaseDir(), "..").c_str()); PHYSFS_unmount(append_file(PHYSFS_getBaseDir(), "..").c_str());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment