Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GameDevWeek
Dependencies
Cpp
mirrage
Commits
337cdf74
Commit
337cdf74
authored
Mar 29, 2019
by
Florian Oetke
Browse files
fixed asset manager load order
parent
c307816e
Pipeline
#2953
passed with stage
in 13 minutes and 27 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/mirrage/asset/src/asset_manager.cpp
View file @
337cdf74
...
...
@@ -209,23 +209,6 @@ namespace mirrage::asset {
throw
std
::
system_error
(
static_cast
<
Asset_error
>
(
PHYSFS_getLastErrorCode
()),
"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
apath
=
PHYSFS_getRealDir
(
path
.
c_str
());
if
(
apath
)
{
...
...
@@ -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
PHYSFS_unmount
(
PHYSFS_getBaseDir
());
PHYSFS_unmount
(
append_file
(
PHYSFS_getBaseDir
(),
".."
).
c_str
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment