More TU30-Dev to TU24-Dev

This commit is contained in:
GabsPuNs
2026-05-11 01:28:07 -04:00
parent ab1a735b40
commit 6cfeb9096a
9 changed files with 94 additions and 95 deletions

View File

@@ -238,7 +238,7 @@ ConsoleSaveFileOriginal::~ConsoleSaveFileOriginal()
pagesCommitted = 0;
// Make sure we don't have any thumbnail data still waiting round - we can't need it now we've destroyed the save file anyway
#if defined _XBOX
app.GetSaveThumbnail(NULL,NULL);
app.GetSaveThumbnail(nullptr,nullptr);
#elif defined __PS3__
app.GetSaveThumbnail(nullptr,nullptr, nullptr,nullptr);
#endif
@@ -497,7 +497,7 @@ void ConsoleSaveFileOriginal::finalizeWrite()
{
unsigned int pagesRequired = ( desiredSize + (CSF_PAGE_SIZE - 1 ) ) / CSF_PAGE_SIZE;
void *pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, COMMIT_ALLOCATION, PAGE_READWRITE);
if( pvRet == NULL )
if( pvRet == nullptr )
{
__debugbreak();
}
@@ -700,7 +700,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail )
#ifdef MINECRAFT_SERVER_BUILD
// on the server we dont want to block the tick thread doing compression!!!
// sna[pshot pvSaveMem while we still hold the lock then hand it off to a background thread
byte *snap = new (std::nothrow) byte[fileSize];
BYTE *snap = new (std::nothrow) BYTE[fileSize];
if (snap)
{
// copy the save buffer while we still own the lock so nothing can write to it mid-copy
@@ -734,18 +734,16 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail )
ReleaseSaveAccess();
s_bgSaveActive.store(true, std::memory_order_release);
std::thread([snap, fileSize, thumb, thumbSz, meta, metaLen, this]()
{
Compression::UseDefaultThreadStorage();
std::thread([snap, fileSize, thumb, thumbSz, meta, metaLen, this]() {
unsigned int compLen = fileSize + 8;
byte *buf = static_cast<byte *>(StorageManager.AllocateSaveData(compLen));
BYTE *buf = static_cast<BYTE *>(StorageManager.AllocateSaveData(compLen));
if (!buf)
{
// FAIL!! attempt precalc
compLen = 0;
Compression::getCompression()->Compress(nullptr, &compLen, snap, fileSize);
compLen += 8;
buf = static_cast<byte *>(StorageManager.AllocateSaveData(compLen));
buf = static_cast<BYTE *>(StorageManager.AllocateSaveData(compLen));
}
if (buf)
{
@@ -1193,6 +1191,7 @@ void *ConsoleSaveFileOriginal::getWritePointer(FileEntry *file)
return static_cast<char *>(pvSaveMem) + file->currentFilePointer;;
}
#ifdef MINECRAFT_SERVER_BUILD
void ConsoleSaveFileOriginal::flushPendingBackgroundSave()
{