Merge branch 'master' of https://vcs.firestormviewer.org/phoenix-firestorm into linux-updates
commit
db332be67c
|
|
@ -209,9 +209,36 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
|
|||
{
|
||||
ofs.write((const char*)buffer, bytes);
|
||||
|
||||
mPosition = ofs.tellp(); // <FS:Ansariel> Fix asset caching
|
||||
|
||||
success = TRUE;
|
||||
}
|
||||
}
|
||||
// <FS:Ansariel> Fix asset caching
|
||||
else if (mMode == READ_WRITE)
|
||||
{
|
||||
// Don't truncate if file already exists
|
||||
llofstream ofs(filename, std::ios::in | std::ios::binary);
|
||||
if (ofs)
|
||||
{
|
||||
ofs.seekp(mPosition, std::ios::beg);
|
||||
ofs.write((const char*)buffer, bytes);
|
||||
mPosition += bytes;
|
||||
success = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// File doesn't exist - open in write mode
|
||||
ofs.open(filename, std::ios::binary);
|
||||
if (ofs.is_open())
|
||||
{
|
||||
ofs.write((const char*)buffer, bytes);
|
||||
mPosition += bytes;
|
||||
success = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
else
|
||||
{
|
||||
llofstream ofs(filename, std::ios::binary);
|
||||
|
|
|
|||
|
|
@ -3352,13 +3352,29 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b
|
|||
// only allocate as much space in the cache as is needed for the local cache
|
||||
data_size = llmin(data_size, bytes);
|
||||
|
||||
LLFileSystem file(mesh_id, LLAssetType::AT_MESH, LLFileSystem::WRITE);
|
||||
// <FS:Ansariel> Fix asset caching
|
||||
//LLFileSystem file(mesh_id, LLAssetType::AT_MESH, LLFileSystem::WRITE);
|
||||
LLFileSystem file(mesh_id, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
|
||||
if (file.getMaxSize() >= bytes)
|
||||
{
|
||||
LLMeshRepository::sCacheBytesWritten += data_size;
|
||||
++LLMeshRepository::sCacheWrites;
|
||||
|
||||
file.write(data, data_size);
|
||||
|
||||
// <FS:Ansariel> Fix asset caching
|
||||
S32 remaining = bytes - file.tell();
|
||||
if (remaining > 0)
|
||||
{
|
||||
U8* block = new(std::nothrow) U8[remaining];
|
||||
if (block)
|
||||
{
|
||||
memset(block, 0, remaining);
|
||||
file.write(block, remaining);
|
||||
delete[] block;
|
||||
}
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -3411,7 +3427,9 @@ void LLMeshLODHandler::processData(LLCore::BufferArray * /* body */, S32 /* body
|
|||
if (result == MESH_OK)
|
||||
{
|
||||
// good fetch from sim, write to cache
|
||||
LLFileSystem file(mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLFileSystem::WRITE);
|
||||
// <FS:Ansariel> Fix asset caching
|
||||
//LLFileSystem file(mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLFileSystem::WRITE);
|
||||
LLFileSystem file(mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
|
||||
|
||||
S32 offset = mOffset;
|
||||
S32 size = mRequestedBytes;
|
||||
|
|
@ -3475,7 +3493,9 @@ void LLMeshSkinInfoHandler::processData(LLCore::BufferArray * /* body */, S32 /*
|
|||
&& gMeshRepo.mThread->skinInfoReceived(mMeshID, data, data_size))
|
||||
{
|
||||
// good fetch from sim, write to cache
|
||||
LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE);
|
||||
// <FS:Ansariel> Fix asset caching
|
||||
//LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE);
|
||||
LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
|
||||
|
||||
S32 offset = mOffset;
|
||||
S32 size = mRequestedBytes;
|
||||
|
|
@ -3523,7 +3543,9 @@ void LLMeshDecompositionHandler::processData(LLCore::BufferArray * /* body */, S
|
|||
&& gMeshRepo.mThread->decompositionReceived(mMeshID, data, data_size))
|
||||
{
|
||||
// good fetch from sim, write to cache
|
||||
LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE);
|
||||
// <FS:Ansariel> Fix asset caching
|
||||
//LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE);
|
||||
LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
|
||||
|
||||
S32 offset = mOffset;
|
||||
S32 size = mRequestedBytes;
|
||||
|
|
@ -3570,7 +3592,9 @@ void LLMeshPhysicsShapeHandler::processData(LLCore::BufferArray * /* body */, S3
|
|||
&& gMeshRepo.mThread->physicsShapeReceived(mMeshID, data, data_size) == MESH_OK)
|
||||
{
|
||||
// good fetch from sim, write to cache for caching
|
||||
LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE);
|
||||
// <FS:Ansariel> Fix asset caching
|
||||
//LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE);
|
||||
LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
|
||||
|
||||
S32 offset = mOffset;
|
||||
S32 size = mRequestedBytes;
|
||||
|
|
|
|||
Loading…
Reference in New Issue