aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/PS3/PS3Extras
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-08 19:08:36 -0400
committerGitHub <noreply@github.com>2026-03-08 18:08:36 -0500
commit28614b922fb77149a54da1a87bebfbc98736f296 (patch)
tree7f828ba86a4ee18d0a80d29de64f6199a5412512 /Minecraft.Client/PS3/PS3Extras
parent88798b501d0cf6287b6f87acb2592676e3cec58d (diff)
Modernize project codebase (#906)
* 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 * Add safety checks and fix a issue with vector going OOR
Diffstat (limited to 'Minecraft.Client/PS3/PS3Extras')
-rw-r--r--Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp14
-rw-r--r--Minecraft.Client/PS3/PS3Extras/C4JSpursJob.h4
-rw-r--r--Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp2
-rw-r--r--Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp10
-rw-r--r--Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp8
-rw-r--r--Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp18
-rw-r--r--Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp4
-rw-r--r--Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp10
-rw-r--r--Minecraft.Client/PS3/PS3Extras/winerror.h2
9 files changed, 36 insertions, 36 deletions
diff --git a/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp b/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp
index fd8ddd9a..bce76078 100644
--- a/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp
+++ b/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp
@@ -16,13 +16,13 @@ static const unsigned int NUM_SUBMIT_JOBS = 128;
#define DMA_ALIGNMENT (128)
#define JOBHEADER_SYMBOL(JobName) _binary_jqjob_##JobName##_jobbin2_jobheader
-C4JSpursJobQueue* C4JSpursJobQueue::m_pMainJobQueue = NULL;
+C4JSpursJobQueue* C4JSpursJobQueue::m_pMainJobQueue = nullptr;
uint16_t C4JSpursJobQueue::Port::s_jobTagBitmask = 0;
-C4JSpursJobQueue::Port* C4JSpursJobQueue::Port::s_allocatedPorts[16] = {NULL,NULL,NULL,NULL,
- NULL,NULL,NULL,NULL,
- NULL,NULL,NULL,NULL,
- NULL,NULL,NULL,NULL };
+C4JSpursJobQueue::Port* C4JSpursJobQueue::Port::s_allocatedPorts[16] = {nullptr,nullptr,nullptr,nullptr,
+ nullptr,nullptr,nullptr,nullptr,
+ nullptr,nullptr,nullptr,nullptr,
+ nullptr,nullptr,nullptr,nullptr };
bool C4JSpursJobQueue::Port::s_initialised;
CRITICAL_SECTION C4JSpursJobQueue::Port::s_lock;
@@ -43,7 +43,7 @@ C4JSpursJobQueue::C4JSpursJobQueue()
//E create jobQueue
pJobQueue = (JobQueue<JOB_QUEUE_DEPTH>*)memalign(CELL_SPURS_JOBQUEUE_ALIGN, sizeof(JobQueue<JOB_QUEUE_DEPTH>));
- assert(pJobQueue != NULL);
+ assert(pJobQueue != nullptr);
ret = JobQueue<JOB_QUEUE_DEPTH>::create( pJobQueue,
spurs,
@@ -168,7 +168,7 @@ int C4JSpursJobQueue::Port::getFreeJobTag()
void C4JSpursJobQueue::Port::releaseJobTag( int tag )
{
s_jobTagBitmask &= ~(1<<tag);
- s_allocatedPorts[tag] = NULL;
+ s_allocatedPorts[tag] = nullptr;
}
void C4JSpursJobQueue::Port::destroyAll()
diff --git a/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.h b/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.h
index bd77f6d1..273bf0cb 100644
--- a/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.h
+++ b/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.h
@@ -28,7 +28,7 @@
//
// void CompressedTileStorage::compress_SPUSendEvent(int upgradeBlock/*=-1*/)
// {
-// if(g_pCompressSPUThread == NULL)
+// if(g_pCompressSPUThread == nullptr)
// {
// sys_event_port_create(&g_basicEventPort, SYS_EVENT_PORT_LOCAL, SYS_EVENT_PORT_NO_NAME);
// sys_event_queue_attribute_t queue_attr = {SYS_SYNC_PRIORITY, SYS_PPU_QUEUE};
@@ -194,7 +194,7 @@ private:
cell::Spurs::JobQueue::JobQueue<JOB_QUEUE_DEPTH> *pJobQueue;
public:
- static C4JSpursJobQueue& getMainJobQueue() {if(m_pMainJobQueue == NULL) m_pMainJobQueue = new C4JSpursJobQueue; return *m_pMainJobQueue;}
+ static C4JSpursJobQueue& getMainJobQueue() {if(m_pMainJobQueue == nullptr) m_pMainJobQueue = new C4JSpursJobQueue; return *m_pMainJobQueue;}
C4JSpursJobQueue();
void shutdown();
diff --git a/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp b/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp
index 94d7ef87..56dd9878 100644
--- a/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp
+++ b/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp
@@ -17,7 +17,7 @@
static const bool sc_verbose = true;
-cell::Spurs::Spurs2* C4JThread_SPU::ms_spurs2Object = NULL;
+cell::Spurs::Spurs2* C4JThread_SPU::ms_spurs2Object = nullptr;
void C4JThread_SPU::initSPURS()
{
diff --git a/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp b/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp
index 2b0a523f..53a8639d 100644
--- a/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp
+++ b/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp
@@ -3,7 +3,7 @@
#include "EdgeZLib.h"
#include "edge/zlib/edgezlib_ppu.h"
-static CellSpurs* s_pSpurs = NULL;
+static CellSpurs* s_pSpurs = nullptr;
//Set this to 5 if you want deflate/inflate to run in parallel on 5 SPUs.
@@ -12,7 +12,7 @@ const uint32_t kMaxNumDeflateQueueEntries = 64;
static CellSpursEventFlag s_eventFlagDeflate; //Cannot be on stack
static CellSpursTaskset s_taskSetDeflate; //Cannot be on stack
static EdgeZlibDeflateQHandle s_deflateQueue;
-static void* s_pDeflateQueueBuffer = NULL;
+static void* s_pDeflateQueueBuffer = nullptr;
static void* s_pDeflateTaskContext[kNumDeflateTasks];
static uint32_t s_numElementsToCompress; //Cannot be on stack
@@ -22,7 +22,7 @@ const uint32_t kMaxNumInflateQueueEntries = 64;
static CellSpursEventFlag s_eventFlagInflate; //Cannot be on stack
static CellSpursTaskset s_taskSetInflate; //Cannot be on stack
static EdgeZlibInflateQHandle s_inflateQueue;
-static void* s_pInflateQueueBuffer = NULL;
+static void* s_pInflateQueueBuffer = nullptr;
static void* s_pInflateTaskContext[kNumInflateTasks];
static uint32_t s_numElementsToDecompress; //Cannot be on stack
@@ -195,9 +195,9 @@ bool EdgeZLib::Compress(void* pDestination, uint32_t* pDestSize, const void* pSo
// The Deflate Task will wake up and process this work.
//
//////////////////////////////////////////////////////////////////////////
- uint32_t* pDst = NULL;
+ uint32_t* pDst = nullptr;
bool findingSizeOnly = false;
- if(pDestination == NULL && *pDestSize == 0)
+ if(pDestination == nullptr && *pDestSize == 0)
{
pDst = (uint32_t*)malloc(SrcSize);
findingSizeOnly = true;
diff --git a/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp b/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp
index 03d916ab..442aab06 100644
--- a/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp
+++ b/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp
@@ -13,18 +13,18 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID)
if( (cd = l10n_get_converter( L10N_UTF16, L10N_UTF8 )) == -1 )
{
app.DebugPrintf("l10n_get_converter: no such converter\n");
- return NULL;
+ return nullptr;
}
- l10n_convert_str( cd, wchString, &src_len, NULL, &dst_len );
- uint8_t *strUtf8=(uint8_t *)malloc(dst_len);
+ l10n_convert_str( cd, wchString, &src_len, nullptr, &dst_len );
+ uint8_t *strUtf8=static_cast<uint8_t *>(malloc(dst_len));
memset(strUtf8,0,dst_len);
result = l10n_convert_str( cd, wchString, &src_len, strUtf8, &dst_len );
if( result != ConversionOK )
{
app.DebugPrintf("l10n_convert: conversion error : 0x%x\n", result);
- return NULL;
+ return nullptr;
}
return strUtf8;
diff --git a/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp b/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp
index 4143c555..c11a8593 100644
--- a/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp
+++ b/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp
@@ -74,8 +74,8 @@ int _wcsicmp( const wchar_t * dst, const wchar_t * src )
wchar_t f,l;
// validation section
- // _VALIDATE_RETURN(dst != NULL, EINVAL, _NLSCMPERROR);
- // _VALIDATE_RETURN(src != NULL, EINVAL, _NLSCMPERROR);
+ // _VALIDATE_RETURN(dst != nullptr, EINVAL, _NLSCMPERROR);
+ // _VALIDATE_RETURN(src != nullptr, EINVAL, _NLSCMPERROR);
do {
f = towlower(*dst);
@@ -90,7 +90,7 @@ size_t wcsnlen(const wchar_t *wcs, size_t maxsize)
{
size_t n;
-// Note that we do not check if s == NULL, because we do not
+// Note that we do not check if s == nullptr, because we do not
// return errno_t...
for (n = 0; n < maxsize && *wcs; n++, wcs++)
@@ -134,7 +134,7 @@ VOID GetLocalTime(LPSYSTEMTIME lpSystemTime)
lpSystemTime->wMilliseconds = cellRtcGetMicrosecond(&dateTime)/1000;
}
-HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PS3_STUBBED; return NULL; }
+HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PS3_STUBBED; return nullptr; }
VOID Sleep(DWORD dwMilliseconds)
{
C4JThread::Sleep(dwMilliseconds);
@@ -267,8 +267,8 @@ BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) { return TLSStoragePS3::In
LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect)
{
int err;
- sys_addr_t newAddress = NULL;
- if(lpAddress == NULL)
+ sys_addr_t newAddress = nullptr;
+ if(lpAddress == nullptr)
{
// reserve, and possibly commit also
int commitSize = 0;
@@ -382,7 +382,7 @@ BOOL SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHi
int fd = (int) hFile;
uint64_t pos = 0, bitsToMove = (int64_t) lDistanceToMove;
- if (lpDistanceToMoveHigh != NULL)
+ if (lpDistanceToMoveHigh != nullptr)
bitsToMove |= ((uint64_t) (*lpDistanceToMoveHigh)) << 32;
int whence = 0;
@@ -490,7 +490,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
}
else
{
- err = cellFsOpen(filePath, flags, &fd ,NULL, 0);
+ err = cellFsOpen(filePath, flags, &fd ,nullptr, 0);
iFilesOpen++;
//printf("\n\nFiles Open - %d\n\n",iFilesOpen);
}
@@ -675,7 +675,7 @@ errno_t _i64toa_s(int64_t _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_
int _wtoi(const wchar_t *_Str)
{
- return wcstol(_Str, NULL, 10);
+ return wcstol(_Str, nullptr, 10);
}
diff --git a/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp b/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp
index e7eca53f..a04e45d9 100644
--- a/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp
+++ b/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp
@@ -16,12 +16,12 @@ C4JThread::EventArray *ShutdownManager::s_eventArray[eThreadIdCount];
void ShutdownManager::Initialise()
{
#ifdef __PS3__
- cellSysutilRegisterCallback( 1, SysUtilCallback, NULL );
+ cellSysutilRegisterCallback( 1, SysUtilCallback, nullptr );
for( int i = 0; i < eThreadIdCount; i++ )
{
s_threadShouldRun[i] = true;
s_threadRunning[i] = 0;
- s_eventArray[i] = NULL;
+ s_eventArray[i] = nullptr;
}
// Special case for storage manager, which we will manually set now to be considered as running - this will be unset by StorageManager.ExitRequest if required
s_threadRunning[eStorageManagerThreads] = true;
diff --git a/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp b/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp
index 0906802d..a3b09d6d 100644
--- a/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp
+++ b/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp
@@ -4,7 +4,7 @@
-TLSStoragePS3* TLSStoragePS3::m_pInstance = NULL;
+TLSStoragePS3* TLSStoragePS3::m_pInstance = nullptr;
BOOL TLSStoragePS3::m_activeList[sc_maxSlots];
__thread LPVOID TLSStoragePS3::m_values[sc_maxSlots];
@@ -16,7 +16,7 @@ TLSStoragePS3::TLSStoragePS3()
for(int i=0;i<sc_maxSlots; i++)
{
m_activeList[i] = false;
- m_values[i] = NULL;
+ m_values[i] = nullptr;
}
}
@@ -37,7 +37,7 @@ int TLSStoragePS3::Alloc()
if(m_activeList[i] == false)
{
m_activeList[i] = true;
- m_values[i] = NULL;
+ m_values[i] = nullptr;
return i;
}
}
@@ -51,7 +51,7 @@ BOOL TLSStoragePS3::Free( DWORD _index )
return false; // not been allocated
m_activeList[_index] = false;
- m_values[_index] = NULL;
+ m_values[_index] = nullptr;
return true;
}
@@ -66,7 +66,7 @@ BOOL TLSStoragePS3::SetValue( DWORD _index, LPVOID _val )
LPVOID TLSStoragePS3::GetValue( DWORD _index )
{
if(m_activeList[_index] == false)
- return NULL;
+ return nullptr;
return m_values[_index];
}
diff --git a/Minecraft.Client/PS3/PS3Extras/winerror.h b/Minecraft.Client/PS3/PS3Extras/winerror.h
index 88763467..b9a4549c 100644
--- a/Minecraft.Client/PS3/PS3Extras/winerror.h
+++ b/Minecraft.Client/PS3/PS3Extras/winerror.h
@@ -3551,7 +3551,7 @@
//
// MessageText:
//
-// The password is too complex to be converted to a LAN Manager password. The LAN Manager password returned is a NULL string.
+// The password is too complex to be converted to a LAN Manager password. The LAN Manager password returned is a nullptr string.
//
#define ERROR_NULL_LM_PASSWORD 1304L