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

@@ -35,7 +35,7 @@ SonyLeaderboardManager::SonyLeaderboardManager()
m_myXUID = INVALID_XUID;
m_scores = NULL;
m_scores = nullptr;
m_statsType = eStatsType_Kills;
m_difficulty = 0;
@@ -47,7 +47,7 @@ SonyLeaderboardManager::SonyLeaderboardManager()
InitializeCriticalSection(&m_csViewsLock);
m_running = false;
m_threadScoreboard = NULL;
m_threadScoreboard = nullptr;
}
SonyLeaderboardManager::~SonyLeaderboardManager()
@@ -288,7 +288,7 @@ bool SonyLeaderboardManager::getScoreByIds()
SonyRtcTick last_sort_date;
SceNpScoreRankNumber mTotalRecord;
SceNpId *npIds = NULL;
SceNpId *npIds = nullptr;
int ret;
uint32_t num = 0;
@@ -322,7 +322,7 @@ bool SonyLeaderboardManager::getScoreByIds()
ZeroMemory(comments, sizeof(SceNpScoreComment) * num);
/* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t boardID=0,\n\t npId=%i,\n\t friendCount*sizeof(SceNpId)=%i*%i=%i,\
rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t NULL, 0, NULL, 0,\n\t friendCount=%i,\n...\n",
rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t nullptr, 0, nullptr, 0,\n\t friendCount=%i,\n...\n",
transaction, npId, friendCount, sizeof(SceNpId), friendCount*sizeof(SceNpId),
rankData, friendCount*sizeof(SceNpScorePlayerRankData), friendCount
); */
@@ -342,9 +342,9 @@ bool SonyLeaderboardManager::getScoreByIds()
destroyTransactionContext(ret);
if (npIds != NULL) delete [] npIds;
if (ptr != NULL) delete [] ptr;
if (comments != NULL) delete [] comments;
if (npIds != nullptr) delete [] npIds;
if (ptr != nullptr) delete [] ptr;
if (comments != nullptr) delete [] comments;
return false;
}
@@ -355,9 +355,9 @@ bool SonyLeaderboardManager::getScoreByIds()
m_eStatsState = eStatsState_Failed;
if (npIds != NULL) delete [] npIds;
if (ptr != NULL) delete [] ptr;
if (comments != NULL) delete [] comments;
if (npIds != nullptr) delete [] npIds;
if (ptr != nullptr) delete [] ptr;
if (comments != nullptr) delete [] comments;
return false;
}
@@ -387,14 +387,14 @@ bool SonyLeaderboardManager::getScoreByIds()
comments, sizeof(SceNpScoreComment) * tmpNum, //OUT: Comments
#endif
NULL, 0, // GameData. (unused)
nullptr, 0, // GameData. (unused)
tmpNum,
&last_sort_date,
&mTotalRecord,
NULL // Reserved, specify null.
nullptr // Reserved, specify null.
);
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED)
@@ -425,7 +425,7 @@ bool SonyLeaderboardManager::getScoreByIds()
m_readCount = num;
// Filter scorers and construct output structure.
if (m_scores != NULL) delete [] m_scores;
if (m_scores != nullptr) delete [] m_scores;
m_scores = new ReadScore[m_readCount];
convertToOutput(m_readCount, m_scores, ptr, comments);
m_maxRank = m_readCount;
@@ -458,7 +458,7 @@ error3:
delete [] ptr;
delete [] comments;
error2:
if (npIds != NULL) delete [] npIds;
if (npIds != nullptr) delete [] npIds;
error1:
if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed;
app.DebugPrintf("[SonyLeaderboardManager] getScoreByIds() FAILED, ret=0x%X\n", ret);
@@ -511,14 +511,14 @@ bool SonyLeaderboardManager::getScoreByRange()
comments, sizeof(SceNpScoreComment) * num, //OUT: Comment Data
NULL, 0, // GameData.
nullptr, 0, // GameData.
num,
&last_sort_date,
&m_maxRank, // 'Total number of players registered in the target scoreboard.'
NULL // Reserved, specify null.
nullptr // Reserved, specify null.
);
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED)
@@ -539,7 +539,7 @@ bool SonyLeaderboardManager::getScoreByRange()
delete [] ptr;
delete [] comments;
m_scores = NULL;
m_scores = nullptr;
m_readCount = 0;
m_eStatsState = eStatsState_Ready;
@@ -557,7 +557,7 @@ bool SonyLeaderboardManager::getScoreByRange()
//m_stats = ptr; //Maybe: addPadding(num,ptr);
if (m_scores != NULL) delete [] m_scores;
if (m_scores != nullptr) delete [] m_scores;
m_readCount = ret;
m_scores = new ReadScore[m_readCount];
for (int i=0; i<m_readCount; i++)
@@ -642,15 +642,15 @@ bool SonyLeaderboardManager::setScore()
rscore.m_score, //IN: new score,
&comment, // Comments
NULL, // GameInfo
nullptr, // GameInfo
&tmp, //OUT: current rank,
#ifndef __PS3__
NULL, //compareDate
nullptr, //compareDate
#endif
NULL // Reserved, specify null.
nullptr // Reserved, specify null.
);
if (ret==SCE_NP_COMMUNITY_SERVER_ERROR_NOT_BEST_SCORE) //0x8002A415
@@ -695,7 +695,7 @@ void SonyLeaderboardManager::Tick()
{
case eStatsState_Ready:
{
assert(m_scores != NULL || m_readCount == 0);
assert(m_scores != nullptr || m_readCount == 0);
view.m_numQueries = m_readCount;
view.m_queries = m_scores;
@@ -707,7 +707,7 @@ void SonyLeaderboardManager::Tick()
if (view.m_numQueries > 0)
ret = eStatsReturn_Success;
if (m_readListener != NULL)
if (m_readListener != nullptr)
{
app.DebugPrintf("[SonyLeaderboardManager] OnStatsReadComplete(%i, %i, _), m_readCount=%i.\n", ret, m_maxRank, m_readCount);
m_readListener->OnStatsReadComplete(ret, m_maxRank, view);
@@ -716,16 +716,16 @@ void SonyLeaderboardManager::Tick()
m_eStatsState = eStatsState_Idle;
delete [] m_scores;
m_scores = NULL;
m_scores = nullptr;
}
break;
case eStatsState_Failed:
{
view.m_numQueries = 0;
view.m_queries = NULL;
view.m_queries = nullptr;
if ( m_readListener != NULL )
if ( m_readListener != nullptr )
m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, 0, view);
m_eStatsState = eStatsState_Idle;
@@ -747,7 +747,7 @@ bool SonyLeaderboardManager::OpenSession()
{
if (m_openSessions == 0)
{
if (m_threadScoreboard == NULL)
if (m_threadScoreboard == nullptr)
{
m_threadScoreboard = new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard");
m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS);
@@ -837,7 +837,7 @@ void SonyLeaderboardManager::FlushStats() {}
void SonyLeaderboardManager::CancelOperation()
{
m_readListener = NULL;
m_readListener = nullptr;
m_eStatsState = eStatsState_Canceled;
if (m_requestId != 0)
@@ -980,7 +980,7 @@ void SonyLeaderboardManager::fromBase32(void *out, SceNpScoreComment *in)
for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++)
{
ch[0] = getComment(in)[i];
unsigned char fivebits = strtol(ch, NULL, 32) << 3;
unsigned char fivebits = strtol(ch, nullptr, 32) << 3;
int sByte = (i*5) / 8;
int eByte = (5+(i*5)) / 8;
@@ -1041,7 +1041,7 @@ bool SonyLeaderboardManager::test_string(string testing)
int ctx = createTransactionContext(m_titleContext);
if (ctx<0) return false;
int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, NULL);
int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, nullptr);
if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED)
{