Merge branch 'master' into 1.5

# Conflicts:
#	Source/Engine/Serialization/Stream.cpp
This commit is contained in:
Wojtek Figat
2022-11-21 15:51:57 +01:00
62 changed files with 391 additions and 351 deletions

View File

@@ -622,6 +622,33 @@ bool FlaxStorage::LoadAssetChunk(FlaxChunk* chunk)
// Seek
stream->SetPosition(chunk->LocationInFile.Address);
if (stream->HasError())
{
// Sometimes stream->HasError() from setposition. result in a crash or missing media in release (stream _file._handle = nullptr).
// When retrying, it looks like it works and we can continue. We need this to success.
for (int retry = 0; retry < 5; retry++)
{
Platform::Sleep(50);
stream = OpenFile();
failed = stream == nullptr;
if (!failed)
{
stream->SetPosition(chunk->LocationInFile.Address);
}
if (!stream->HasError())
break;
}
}
if (stream->HasError())
{
failed = true;
UnlockChunks();
LOG(Warning, "SetPosition failed on chunk {0}.", ToString());
return failed;
}
// Load data
auto size = chunk->LocationInFile.Size;
if (chunk->Flags & FlaxChunkFlags::CompressedLZ4)