aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp
diff options
context:
space:
mode:
authorqwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com>2026-03-16 21:44:26 -0500
committerGitHub <noreply@github.com>2026-03-16 21:44:26 -0500
commitce739f6045ec72127491286ea3f3f21e537c1b55 (patch)
treef33bd42a47c1b4a7b2153a7fb77127ee3b407db9 /Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp
parent255a18fe8e9b57377975f82e2b227afe2a12eda0 (diff)
parent5a59f5d146b43811dde6a5a0245ee9875d7b5cd1 (diff)
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp')
-rw-r--r--Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp92
1 files changed, 48 insertions, 44 deletions
diff --git a/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp b/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp
index bdd58e17..ab7b4770 100644
--- a/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp
+++ b/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp
@@ -27,21 +27,25 @@
void SonyRemoteStorage_PS3::npauthhandler(int event, int result, void *arg)
{
#ifdef __PS3__
- if (event != SCE_NP_MANAGER_EVENT_GOT_TICKET || result <= 0)
+ if (event != SCE_NP_MANAGER_EVENT_GOT_TICKET || result <= 0)
{
app.DebugPrintf("Could not retrieve ticket: 0x%x\n", result);
- }
- else
+ }
+ else
{
psnTicketSize = result;
psnTicket = malloc(psnTicketSize);
- if (psnTicket == NULL)
+<<<<<<< HEAD
+ if (psnTicket == nullptr)
+=======
+ if (psnTicket == NULL)
+>>>>>>> origin/main
{
app.DebugPrintf("Failed to allocate for ticket\n");
}
int ret = sceNpManagerGetTicket(psnTicket, &psnTicketSize);
- if (ret < 0)
+ if (ret < 0)
{
app.DebugPrintf("Could not retrieve ticket: 0x%x\n", ret);
free(psnTicket);
@@ -60,7 +64,7 @@ int SonyRemoteStorage_PS3::initPreconditions()
SceNpId npId;
ret = sceNpManagerGetNpId(&npId);
- if(ret < 0)
+ if(ret < 0)
{
return ret;
}
@@ -68,17 +72,17 @@ int SonyRemoteStorage_PS3::initPreconditions()
ticketVersion.major = 3;
ticketVersion.minor = 0;
ret = sceNpManagerRequestTicket2(&npId, &ticketVersion, TICKETING_SERVICE_ID, NULL, 0, NULL, 0);
- if(ret < 0)
+ if(ret < 0)
{
return ret;
}
m_waitingForTicket = true;
- while(m_waitingForTicket)
+ while(m_waitingForTicket)
{
cellSysutilCheckCallback();
sys_timer_usleep(50000); //50 milliseconds.
}
- if(psnTicket == NULL)
+ if(psnTicket == nullptr)
return -1;
return 0;
@@ -86,7 +90,7 @@ int SonyRemoteStorage_PS3::initPreconditions()
void SonyRemoteStorage_PS3::staticInternalCallback(const SceRemoteStorageEvent event, int32_t retCode, void * userData)
{
- ((SonyRemoteStorage_PS3*)userData)->internalCallback(event, retCode);
+ static_cast<SonyRemoteStorage_PS3 *>(userData)->internalCallback(event, retCode);
}
void SonyRemoteStorage_PS3::internalCallback(const SceRemoteStorageEvent event, int32_t retCode)
@@ -104,12 +108,12 @@ void SonyRemoteStorage_PS3::internalCallback(const SceRemoteStorageEvent event,
break;
case GET_DATA_RESULT:
- if(retCode >= 0)
+ if(retCode >= 0)
{
app.DebugPrintf("Get Data success \n");
m_status = e_getDataSucceeded;
- }
- else
+ }
+ else
{
app.DebugPrintf("An error occurred while Get Data was being processed. retCode: 0x%x \n", retCode);
m_status = e_error;
@@ -126,12 +130,12 @@ void SonyRemoteStorage_PS3::internalCallback(const SceRemoteStorageEvent event,
break;
case GET_STATUS_RESULT:
- if(retCode >= 0)
+ if(retCode >= 0)
{
app.DebugPrintf("Get Status success \n");
app.DebugPrintf("Remaining Syncs for this user: %llu\n", outputGetStatus->remainingSyncs);
app.DebugPrintf("Number of files on the cloud: %d\n", outputGetStatus->numFiles);
- for(int i = 0; i < outputGetStatus->numFiles; i++)
+ for(int i = 0; i < outputGetStatus->numFiles; i++)
{
app.DebugPrintf("\n*** File %d information: ***\n", (i + 1));
app.DebugPrintf("File name: %s \n", outputGetStatus->data[i].fileName);
@@ -142,8 +146,8 @@ void SonyRemoteStorage_PS3::internalCallback(const SceRemoteStorageEvent event,
app.DebugPrintf("Visibility: \"%s\" \n", (outputGetStatus->data[i].visibility == 0)?"Private":((outputGetStatus->data[i].visibility == 1)?"Public read only":"Public read and write"));
}
m_status = e_getStatusSucceeded;
- }
- else
+ }
+ else
{
app.DebugPrintf("An error occurred while Get Status was being processed. retCode: 0x%x \n", retCode);
m_status = e_error;
@@ -158,12 +162,12 @@ void SonyRemoteStorage_PS3::internalCallback(const SceRemoteStorageEvent event,
break;
case SET_DATA_RESULT:
- if(retCode >= 0)
+ if(retCode >= 0)
{
app.DebugPrintf("Set Data success \n");
m_status = e_setDataSucceeded;
- }
- else
+ }
+ else
{
app.DebugPrintf("An error occurred while Set Data was being processed. retCode: 0x%x \n", retCode);
m_status = e_error;
@@ -230,7 +234,7 @@ bool SonyRemoteStorage_PS3::init(CallbackFunc cb, LPVOID lpParam)
params.callback = staticInternalCallback;
params.userData = this;
params.thread.threadAffinity = 0; //Not used in PS3
- params.thread.threadPriority = 1000; //Must be between [0-3071], being 0 the highest.
+ params.thread.threadPriority = 1000; //Must be between [0-3071], being 0 the highest.
params.psnTicket = psnTicket;
params.psnTicketSize = psnTicketSize;
strcpy(params.clientId, CLIENT_ID);
@@ -239,27 +243,27 @@ bool SonyRemoteStorage_PS3::init(CallbackFunc cb, LPVOID lpParam)
params.timeout.receiveMs = 120 * 1000; //120 seconds is the default
params.timeout.sendMs = 120 * 1000; //120 seconds is the default
params.pool.memPoolSize = 7 * 1024 * 1024;
- if(m_memPoolBuffer == NULL)
+ if(m_memPoolBuffer == nullptr)
m_memPoolBuffer = malloc(params.pool.memPoolSize);
params.pool.memPoolBuffer = m_memPoolBuffer;
// SceRemoteStorageAbortReqParams abortParams;
ret = sceRemoteStorageInit(params);
- if(ret >= 0 || ret == SCE_REMOTE_STORAGE_ERROR_ALREADY_INITIALISED)
+ if(ret >= 0 || ret == SCE_REMOTE_STORAGE_ERROR_ALREADY_INITIALISED)
{
// abortParams.requestId = ret;
//ret = sceRemoteStorageAbort(abortParams);
app.DebugPrintf("Session will be created \n");
- //if(ret >= 0)
+ //if(ret >= 0)
//{
// printf("Session aborted \n");
- //} else
+ //} else
//{
// printf("Error aborting session: 0x%x \n", ret);
//}
- }
- else
+ }
+ else
{
app.DebugPrintf("Error creating session: 0x%x \n", ret);
return false;
@@ -279,12 +283,12 @@ bool SonyRemoteStorage_PS3::getRemoteFileInfo(SceRemoteStorageStatus* pInfo, Cal
reqId = sceRemoteStorageGetStatus(params, outputGetStatus);
m_status = e_getStatusInProgress;
- if(reqId >= 0)
+ if(reqId >= 0)
{
app.DebugPrintf("Get Status request sent \n");
return true;
- }
- else
+ }
+ else
{
app.DebugPrintf("Error sending Get Status request: 0x%x \n", reqId);
return false;
@@ -303,11 +307,11 @@ void SonyRemoteStorage_PS3::abort()
params.requestId = reqId;
int ret = sceRemoteStorageAbort(params);
- if(ret >= 0)
+ if(ret >= 0)
{
app.DebugPrintf("Abort request done \n");
- }
- else
+ }
+ else
{
app.DebugPrintf("Error in Abort request: 0x%x \n", ret);
}
@@ -343,9 +347,9 @@ bool SonyRemoteStorage_PS3::setDataInternal()
bool bHostOptionsRead;
DWORD uiTexturePack;
char seed[22];
- app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
+ 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);
char seedHex[17];
sprintf(seedHex,"%016llx",iSeed);
memcpy(descData.m_seed,seedHex,16); // Don't copy null
@@ -377,14 +381,14 @@ bool SonyRemoteStorage_PS3::setDataInternal()
reqId = sceRemoteStorageSetData(params);
app.DebugPrintf("\n*******************************\n");
- if(reqId >= 0)
+ if(reqId >= 0)
{
app.DebugPrintf("Set Data request sent \n");
m_bTransferStarted = true;
m_status = e_setDataInProgress;
return true;
- }
- else
+ }
+ else
{
app.DebugPrintf("Error sending Set Data request: 0x%x \n", reqId);
return false;
@@ -406,12 +410,12 @@ bool SonyRemoteStorage_PS3::getData( const char* remotePath, const char* localPa
reqId = sceRemoteStorageGetData(params, &outputGetData);
app.DebugPrintf("\n*******************************\n");
- if(reqId >= 0)
+ if(reqId >= 0)
{
app.DebugPrintf("Get Data request sent \n");
m_bTransferStarted = true;
m_status = e_getDataInProgress;
- } else
+ } else
{
app.DebugPrintf("Error sending Get Data request: 0x%x \n", reqId);
}
@@ -430,20 +434,20 @@ void SonyRemoteStorage_PS3::runCallback()
int SonyRemoteStorage_PS3::SaveCompressCallback(LPVOID lpParam,bool bRes)
{
- SonyRemoteStorage_PS3* pRS = (SonyRemoteStorage_PS3*)lpParam;
+ SonyRemoteStorage_PS3* pRS = static_cast<SonyRemoteStorage_PS3 *>(lpParam);
pRS->m_compressedSaveState = e_state_Idle;
return 0;
}
int SonyRemoteStorage_PS3::LoadCompressCallback(void *pParam,bool bIsCorrupt, bool bIsOwner)
{
- SonyRemoteStorage_PS3* pRS = (SonyRemoteStorage_PS3*)pParam;
+ SonyRemoteStorage_PS3* pRS = static_cast<SonyRemoteStorage_PS3 *>(pParam);
int origFilesize = StorageManager.GetSaveSize();
void* pOrigSaveData = malloc(origFilesize);
unsigned int retFilesize;
StorageManager.GetSaveData( pOrigSaveData, &retFilesize );
// check if this save file is already compressed
- if(*((int*)pOrigSaveData) != 0)
+ if(*static_cast<int *>(pOrigSaveData) != 0)
{
app.DebugPrintf("compressing save data\n");
@@ -451,7 +455,7 @@ int SonyRemoteStorage_PS3::LoadCompressCallback(void *pParam,bool bIsCorrupt, bo
// We add 4 bytes to the start so that we can signal compressed data
// And another 4 bytes to store the decompressed data size
unsigned int compLength = origFilesize+8;
- byte *compData = (byte *)malloc( compLength );
+ byte *compData = static_cast<byte *>(malloc(compLength));
Compression::UseDefaultThreadStorage();
Compression::getCompression()->Compress(compData+8,&compLength,pOrigSaveData,origFilesize);
ZeroMemory(compData,8);