From 087b7e7abfe81dd7f0fdcdea36ac9f245950df1a Mon Sep 17 00:00:00 2001 From: Loki Rautio Date: Sat, 7 Mar 2026 21:12:22 -0600 Subject: Revert "Project modernization (#630)" This code was not tested and breaks in Release builds, reverting to restore functionality of the nightly. All in-game menus do not work and generating a world crashes. This reverts commit a9be52c41a02d207233199e98898fe7483d7e817. --- Minecraft.World/C4JThread.cpp | 80 +++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'Minecraft.World/C4JThread.cpp') diff --git a/Minecraft.World/C4JThread.cpp b/Minecraft.World/C4JThread.cpp index 7993a0f6..d0794f06 100644 --- a/Minecraft.World/C4JThread.cpp +++ b/Minecraft.World/C4JThread.cpp @@ -21,7 +21,7 @@ CRITICAL_SECTION C4JThread::ms_threadListCS; #ifdef _XBOX_ONE // 4J Stu - On XboxOne the main thread is not the one that does all the static init, so we have to set this up later -C4JThread *C4JThread::m_mainThread = nullptr; +C4JThread *C4JThread::m_mainThread = NULL; void C4JThread::StaticInit() { @@ -109,12 +109,12 @@ C4JThread::C4JThread( C4JThreadStartFunc* startFunc, void* param, const char* th CPU = SCE_KERNEL_CPU_MASK_USER_1; } - m_threadID = sceKernelCreateThread(m_threadName, entryPoint, g_DefaultPriority, m_stackSize, 0, CPU, nullptr); + m_threadID = sceKernelCreateThread(m_threadName, entryPoint, g_DefaultPriority, m_stackSize, 0, CPU, NULL); app.DebugPrintf("***************************** start thread %s **************************\n", m_threadName); #else m_threadID = 0; m_threadHandle = 0; - m_threadHandle = CreateThread(nullptr, m_stackSize, entryPoint, this, CREATE_SUSPENDED, &m_threadID); + m_threadHandle = CreateThread(NULL, m_stackSize, entryPoint, this, CREATE_SUSPENDED, &m_threadID); #endif EnterCriticalSection(&ms_threadListCS); ms_threadList.push_back(this); @@ -128,8 +128,8 @@ C4JThread::C4JThread( const char* mainThreadName) user_registerthread(); #endif - m_startFunc = nullptr; - m_threadParam = nullptr; + m_startFunc = NULL; + m_threadParam = NULL; m_stackSize = 0; #ifdef __PS3__ @@ -178,7 +178,7 @@ C4JThread::~C4JThread() #endif #if defined __ORBIS__ - scePthreadJoin(m_threadID, nullptr); + scePthreadJoin(m_threadID, NULL); #endif EnterCriticalSection(&ms_threadListCS); @@ -212,7 +212,7 @@ void * C4JThread::entryPoint(void *param) pThread->m_exitCode = (*pThread->m_startFunc)(pThread->m_threadParam); pThread->m_completionFlag->Set(); pThread->m_isRunning = false; - scePthreadExit(nullptr); + scePthreadExit(NULL); } #elif defined __PSVITA__ struct StrArg { @@ -233,14 +233,14 @@ SceInt32 C4JThread::entryPoint(SceSize argSize, void *pArgBlock) PSVitaTLSStorage::RemoveThread(pThread->m_threadID); user_removethread(); - sceKernelExitDeleteThread(nullptr); + sceKernelExitDeleteThread(NULL); return pThread->m_exitCode; } #else DWORD WINAPI C4JThread::entryPoint(LPVOID lpParam) { - C4JThread* pThread = static_cast(lpParam); + C4JThread* pThread = (C4JThread*)lpParam; SetThreadName(-1, pThread->m_threadName); pThread->m_exitCode = (*pThread->m_startFunc)(pThread->m_threadParam); pThread->m_isRunning = false; @@ -270,7 +270,7 @@ void C4JThread::Run() scePthreadAttrDestroy(&m_threadAttr); #elif defined __PSVITA__ StrArg strArg = {this}; -// m_threadID = sceKernelCreateThread(m_threadName, entryPoint, m_priority, m_stackSize, 0, m_CPUMask, nullptr); +// m_threadID = sceKernelCreateThread(m_threadName, entryPoint, m_priority, m_stackSize, 0, m_CPUMask, NULL); sceKernelStartThread( m_threadID, sizeof(strArg), &strArg); #else ResumeThread(m_threadHandle); @@ -439,7 +439,7 @@ C4JThread* C4JThread::getCurrentThread() #endif //__PS3__ EnterCriticalSection(&ms_threadListCS); - for(size_t i=0;im_threadID) { @@ -450,7 +450,7 @@ C4JThread* C4JThread::getCurrentThread() LeaveCriticalSection(&ms_threadListCS); - return nullptr; + return NULL; } bool C4JThread::isMainThread() @@ -480,12 +480,12 @@ C4JThread::Event::Event(EMode mode/* = e_modeAutoClear*/) #elif defined __ORBIS__ char name[1] = {0}; - sceKernelCreateEventFlag( &m_event, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr); + sceKernelCreateEventFlag( &m_event, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL); #elif defined __PSVITA__ char name[1] = {0}; - m_event = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr); + m_event = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL); #else - m_event = CreateEvent( nullptr, (m_mode == e_modeManualClear), FALSE, nullptr ); + m_event = CreateEvent( NULL, (m_mode == e_modeManualClear), FALSE, NULL ); #endif //__PS3__ } @@ -554,7 +554,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs ) SceKernelUseconds *pTimeoutMicrosecs; if( timeoutMs == INFINITE ) { - pTimeoutMicrosecs = nullptr; + pTimeoutMicrosecs = NULL; } else { @@ -566,7 +566,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs ) { waitMode |= SCE_KERNEL_EVF_WAITMODE_CLEAR_PAT; } - int err = sceKernelWaitEventFlag(m_event, 1, waitMode, nullptr, pTimeoutMicrosecs); + int err = sceKernelWaitEventFlag(m_event, 1, waitMode, NULL, pTimeoutMicrosecs); switch(err) { case SCE_OK: return WAIT_OBJECT_0; @@ -579,7 +579,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs ) SceUInt32 *pTimeoutMicrosecs; if( timeoutMs == INFINITE ) { - pTimeoutMicrosecs = nullptr; + pTimeoutMicrosecs = NULL; } else { @@ -591,7 +591,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs ) { waitMode |= SCE_KERNEL_EVF_WAITMODE_CLEAR_ALL; } - int err = sceKernelWaitEventFlag(m_event, 1, waitMode, nullptr, pTimeoutMicrosecs); + int err = sceKernelWaitEventFlag(m_event, 1, waitMode, NULL, pTimeoutMicrosecs); switch(err) { case SCE_OK: return WAIT_OBJECT_0; @@ -623,15 +623,15 @@ C4JThread::EventArray::EventArray( int size, EMode mode/* = e_modeAutoClear*/) assert(err == CELL_OK); #elif defined __ORBIS__ char name[1] = {0}; - sceKernelCreateEventFlag( &m_events, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr); + sceKernelCreateEventFlag( &m_events, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL); #elif defined __PSVITA__ char name[1] = {0}; - m_events = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr); + m_events = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL); #else m_events = new HANDLE[size]; for(int i=0;i(lpParam); + EventQueue* p = (EventQueue*)lpParam; p->threadPoll(); return 0; } -- cgit v1.2.3