diff options
| author | qwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com> | 2026-03-16 21:44:26 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-16 21:44:26 -0500 |
| commit | ce739f6045ec72127491286ea3f3f21e537c1b55 (patch) | |
| tree | f33bd42a47c1b4a7b2153a7fb77127ee3b407db9 /Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp | |
| parent | 255a18fe8e9b57377975f82e2b227afe2a12eda0 (diff) | |
| parent | 5a59f5d146b43811dde6a5a0245ee9875d7b5cd1 (diff) | |
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp')
| -rw-r--r-- | Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp index 4468d163..47beb63c 100644 --- a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp +++ b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp @@ -25,12 +25,12 @@ static SceRemoteStorageStatus statParams; // { // app.DebugPrintf("remoteStorageGetCallback err : 0x%08x\n"); // } -// +// // void remoteStorageCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) // { // app.DebugPrintf("remoteStorageCallback err : 0x%08x\n"); // -// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, NULL); +// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, nullptr); // } @@ -39,13 +39,13 @@ static SceRemoteStorageStatus statParams; void SonyRemoteStorage::SetRetrievedDescData() { DescriptionData* pDescDataTest = (DescriptionData*)m_remoteFileInfo->fileDescription; - ESavePlatform testPlatform = (ESavePlatform)MAKE_FOURCC(pDescDataTest->m_platform[0], pDescDataTest->m_platform[1], pDescDataTest->m_platform[2], pDescDataTest->m_platform[3]); + ESavePlatform testPlatform = static_cast<ESavePlatform>(MAKE_FOURCC(pDescDataTest->m_platform[0], pDescDataTest->m_platform[1], pDescDataTest->m_platform[2], pDescDataTest->m_platform[3])); if(testPlatform == SAVE_FILE_PLATFORM_NONE) { // new version of the descData DescriptionData_V2* pDescData2 = (DescriptionData_V2*)m_remoteFileInfo->fileDescription; m_retrievedDescData.m_descDataVersion = GetU32FromHexBytes(pDescData2->m_descDataVersion); - m_retrievedDescData.m_savePlatform = (ESavePlatform)MAKE_FOURCC(pDescData2->m_platform[0], pDescData2->m_platform[1], pDescData2->m_platform[2], pDescData2->m_platform[3]); + m_retrievedDescData.m_savePlatform = static_cast<ESavePlatform>(MAKE_FOURCC(pDescData2->m_platform[0], pDescData2->m_platform[1], pDescData2->m_platform[2], pDescData2->m_platform[3])); m_retrievedDescData.m_seed = GetU64FromHexBytes(pDescData2->m_seed); m_retrievedDescData.m_hostOptions = GetU32FromHexBytes(pDescData2->m_hostOptions); m_retrievedDescData.m_texturePack = GetU32FromHexBytes(pDescData2->m_texturePack); @@ -58,7 +58,7 @@ void SonyRemoteStorage::SetRetrievedDescData() // old version,copy the data across to the new version DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription; m_retrievedDescData.m_descDataVersion = 1; - m_retrievedDescData.m_savePlatform = (ESavePlatform)MAKE_FOURCC(pDescData->m_platform[0], pDescData->m_platform[1], pDescData->m_platform[2], pDescData->m_platform[3]); + m_retrievedDescData.m_savePlatform = static_cast<ESavePlatform>(MAKE_FOURCC(pDescData->m_platform[0], pDescData->m_platform[1], pDescData->m_platform[2], pDescData->m_platform[3])); m_retrievedDescData.m_seed = GetU64FromHexBytes(pDescData->m_seed); m_retrievedDescData.m_hostOptions = GetU32FromHexBytes(pDescData->m_hostOptions); m_retrievedDescData.m_texturePack = GetU32FromHexBytes(pDescData->m_texturePack); @@ -73,7 +73,7 @@ void SonyRemoteStorage::SetRetrievedDescData() void getSaveInfoReturnCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) { - SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; + SonyRemoteStorage* pRemoteStorage = static_cast<SonyRemoteStorage *>(lpParam); app.DebugPrintf("remoteStorageGetInfoCallback err : 0x%08x\n", error_code); if(error_code == 0) { @@ -99,7 +99,7 @@ void getSaveInfoReturnCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int static void getSaveInfoInitCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) { - SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; + SonyRemoteStorage* pRemoteStorage = static_cast<SonyRemoteStorage *>(lpParam); if(error_code != 0) { app.DebugPrintf("getSaveInfoInitCallback err : 0x%08x\n", error_code); @@ -143,7 +143,7 @@ bool SonyRemoteStorage::getSaveData( const char* localDirname, CallbackFunc cb, static void setSaveDataInitCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) { - SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; + SonyRemoteStorage* pRemoteStorage = static_cast<SonyRemoteStorage *>(lpParam); if(error_code != 0) { app.DebugPrintf("setSaveDataInitCallback err : 0x%08x\n", error_code); @@ -181,7 +181,7 @@ const char* SonyRemoteStorage::getLocalFilename() const char* SonyRemoteStorage::getSaveNameUTF8() { if(m_getInfoStatus != e_infoFound) - return NULL; + return nullptr; return m_retrievedDescData.m_saveNameUTF8; } @@ -193,7 +193,7 @@ ESavePlatform SonyRemoteStorage::getSavePlatform() } -__int64 SonyRemoteStorage::getSaveSeed() +int64_t SonyRemoteStorage::getSaveSeed() { if(m_getInfoStatus != e_infoFound) return 0; @@ -223,9 +223,9 @@ const char* SonyRemoteStorage::getRemoteSaveFilename() int SonyRemoteStorage::getSaveFilesize() { - if(m_getInfoStatus == e_infoFound) + if(m_getInfoStatus == e_infoFound) { - return m_remoteFileInfo->fileSize; + return m_remoteFileInfo->fileSize; } return 0; } @@ -244,7 +244,7 @@ bool SonyRemoteStorage::setData( PSAVE_INFO info, CallbackFunc cb, LPVOID lpPara int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) { - SonyRemoteStorage *pClass= (SonyRemoteStorage *)lpParam; + SonyRemoteStorage *pClass= static_cast<SonyRemoteStorage *>(lpParam); if(pClass->m_bAborting) { @@ -261,12 +261,12 @@ int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThum } else { - app.DebugPrintf("Thumbnail data is NULL, or has size 0\n"); - pClass->m_thumbnailData = NULL; + app.DebugPrintf("Thumbnail data is nullptr, or has size 0\n"); + pClass->m_thumbnailData = nullptr; pClass->m_thumbnailDataSize = 0; } - if(pClass->m_SetDataThread != NULL) + if(pClass->m_SetDataThread != nullptr) delete pClass->m_SetDataThread; pClass->m_SetDataThread = new C4JThread(setDataThread, pClass, "setDataThread"); @@ -277,7 +277,7 @@ int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThum int SonyRemoteStorage::setDataThread(void* lpParam) { - SonyRemoteStorage* pClass = (SonyRemoteStorage*)lpParam; + SonyRemoteStorage* pClass = static_cast<SonyRemoteStorage *>(lpParam); pClass->m_startTime = System::currentTimeMillis(); pClass->setDataInternal(); return 0; @@ -288,9 +288,9 @@ bool SonyRemoteStorage::saveIsAvailable() if(m_getInfoStatus != e_infoFound) return false; #ifdef __PS3__ - return (getSavePlatform() == SAVE_FILE_PLATFORM_PSVITA); + return (getSavePlatform() == SAVE_FILE_PLATFORM_PSVITA); #elif defined __PSVITA__ - return (getSavePlatform() == SAVE_FILE_PLATFORM_PS3); + return (getSavePlatform() == SAVE_FILE_PLATFORM_PS3); #else // __ORBIS__ return true; #endif @@ -320,10 +320,10 @@ int SonyRemoteStorage::getDataProgress() int nextChunk = ((sizeTransferred + chunkSize) * 100) / totalSize; - __int64 time = System::currentTimeMillis(); + int64_t time = System::currentTimeMillis(); int elapsedSecs = (time - m_startTime) / 1000; - float estimatedTransfered = float(elapsedSecs * transferRatePerSec); - int progVal = m_dataProgress + (estimatedTransfered / float(totalSize)) * 100; + float estimatedTransfered = static_cast<float>(elapsedSecs * transferRatePerSec); + int progVal = m_dataProgress + (estimatedTransfered / static_cast<float>(totalSize)) * 100; if(progVal > nextChunk) return nextChunk; if(progVal > 99) @@ -341,15 +341,15 @@ bool SonyRemoteStorage::shutdown() if(m_bInitialised) { int ret = sceRemoteStorageTerm(); - if(ret >= 0) + if(ret >= 0) { app.DebugPrintf("Term request done \n"); m_bInitialised = false; free(m_memPoolBuffer); - m_memPoolBuffer = NULL; + m_memPoolBuffer = nullptr; return true; - } - else + } + else { app.DebugPrintf("Error in Term request: 0x%x \n", ret); return false; @@ -406,10 +406,11 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData& descData) unsigned int uiHostOptions; bool bHostOptionsRead; DWORD uiTexturePack; - char seed[22]; - app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); + char seed[22]; + app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize, reinterpret_cast<unsigned char*>(seed), + uiHostOptions, bHostOptionsRead, uiTexturePack); - __int64 iSeed = strtoll(seed,NULL,10); + int64_t iSeed = strtoll(seed, nullptr,10); SetU64HexBytes(descData.m_seed, iSeed); // Save the host options that this world was last played with SetU32HexBytes(descData.m_hostOptions, uiHostOptions); @@ -433,7 +434,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData) char descDataVersion[9]; sprintf(descDataVersion,"%08x",sc_CurrentDescDataVersion); memcpy(descData.m_descDataVersion,descDataVersion,8); // Don't copy null - + descData.m_platform[0] = SAVE_FILE_PLATFORM_LOCAL & 0xff; descData.m_platform[1] = (SAVE_FILE_PLATFORM_LOCAL >> 8) & 0xff; @@ -448,7 +449,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData) char seed[22]; app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); - __int64 iSeed = strtoll(seed,NULL,10); + int64_t iSeed = strtoll(seed, nullptr,10); SetU64HexBytes(descData.m_seed, iSeed); // Save the host options that this world was last played with SetU32HexBytes(descData.m_hostOptions, uiHostOptions); @@ -468,7 +469,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData) uint32_t SonyRemoteStorage::GetU32FromHexBytes(char* hexBytes) { char hexString[9]; - ZeroMemory(hexString,9); + ZeroMemory(hexString,9); memcpy(hexString, hexBytes,8); uint32_t u32Val = 0; @@ -481,7 +482,7 @@ uint32_t SonyRemoteStorage::GetU32FromHexBytes(char* hexBytes) uint64_t SonyRemoteStorage::GetU64FromHexBytes(char* hexBytes) { char hexString[17]; - ZeroMemory(hexString,17); + ZeroMemory(hexString,17); memcpy(hexString, hexBytes,16); uint64_t u64Val = 0; |
