Project modernization (#630)

* Fixed boats falling and a TP glitch #266

* Replaced every C-style cast with C++ ones

* Replaced every C-style cast with C++ ones

* Fixed boats falling and a TP glitch #266

* Updated NULL to nullptr and fixing some type issues

* Modernized and fixed a few bugs

- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.

* Fixing more conflicts

* Replace int loops with size_t and start work on overrides
This commit is contained in:
ModMaker101
2026-03-07 21:56:03 -05:00
committed by GitHub
parent 1be5faaea7
commit a9be52c41a
1373 changed files with 19903 additions and 19449 deletions

View File

@@ -29,8 +29,8 @@ static SceRemoteStorageStatus statParams;
// 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;
}
@@ -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;
@@ -322,8 +322,8 @@ int SonyRemoteStorage::getDataProgress()
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)
@@ -346,7 +346,7 @@ bool SonyRemoteStorage::shutdown()
app.DebugPrintf("Term request done \n");
m_bInitialised = false;
free(m_memPoolBuffer);
m_memPoolBuffer = NULL;
m_memPoolBuffer = nullptr;
return true;
}
else
@@ -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_t 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);
@@ -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_t 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);