Change NULL to nullptr

This commit is contained in:
zilmar 2021-04-12 21:05:39 +09:30
parent a48f8d1a62
commit cf58754414
189 changed files with 2506 additions and 2505 deletions

View File

@ -31,7 +31,7 @@
</ImportGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ItemDefinitionGroup>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>

View File

@ -3,7 +3,7 @@
CDateTime::CDateTime()
{
m_time = time(NULL);
m_time = time(nullptr);
}
std::string CDateTime::Format(const char * format)
@ -15,6 +15,6 @@ std::string CDateTime::Format(const char * format)
CDateTime & CDateTime::SetToNow(void)
{
m_time = time(NULL);
m_time = time(nullptr);
return *this;
}

View File

@ -17,7 +17,7 @@ CFile::CFile() :
#ifdef USE_WINDOWS_API
m_hFile(INVALID_HANDLE_VALUE),
#else
m_hFile(NULL),
m_hFile(nullptr),
#endif
m_bCloseOnDelete(false)
{
@ -37,7 +37,7 @@ CFile::CFile(const char * lpszFileName, uint32_t nOpenFlags) :
#ifdef USE_WINDOWS_API
m_hFile(INVALID_HANDLE_VALUE),
#else
m_hFile(NULL),
m_hFile(nullptr),
#endif
m_bCloseOnDelete(true)
{
@ -49,7 +49,7 @@ CFile::~CFile()
#ifdef USE_WINDOWS_API
if (m_hFile != INVALID_HANDLE_VALUE && m_bCloseOnDelete)
#else
if (m_hFile != NULL && m_bCloseOnDelete)
if (m_hFile != nullptr && m_bCloseOnDelete)
#endif
{
Close();
@ -63,7 +63,7 @@ bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags)
return false;
}
if (lpszFileName == NULL || strlen(lpszFileName) == 0)
if (lpszFileName == nullptr || strlen(lpszFileName) == 0)
{
return false;
}
@ -99,7 +99,7 @@ bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags)
// Map modeNoInherit flag
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
sa.lpSecurityDescriptor = nullptr;
sa.bInheritHandle = (nOpenFlags & modeNoInherit) == 0;
// Map creation flags
@ -110,7 +110,7 @@ bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags)
}
// Attempt file creation
HANDLE hFile = ::CreateFileA(lpszFileName, dwAccess, dwShareMode, &sa, dwCreateFlag, FILE_ATTRIBUTE_NORMAL, NULL);
HANDLE hFile = ::CreateFileA(lpszFileName, dwAccess, dwShareMode, &sa, dwCreateFlag, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
{ //#define ERROR_PATH_NOT_FOUND 3L
//ULONG err = GetLastError();
@ -151,7 +151,7 @@ bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags)
(nOpenFlags & CFileBase::modeReadWrite) == CFileBase::modeReadWrite)
{
m_hFile = fopen(lpszFileName, "rb+");
if (m_hFile != NULL)
if (m_hFile != nullptr)
{
SeekToBegin();
}
@ -159,7 +159,7 @@ bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags)
else if ((nOpenFlags & CFileBase::modeRead) == CFileBase::modeRead)
{
m_hFile = fopen(lpszFileName, "rb");
if (m_hFile != NULL)
if (m_hFile != nullptr)
{
SeekToBegin();
}
@ -183,10 +183,10 @@ bool CFile::Close()
}
m_hFile = INVALID_HANDLE_VALUE;
#else
if (m_hFile != NULL)
if (m_hFile != nullptr)
{
fclose((FILE *)m_hFile);
m_hFile = NULL;
m_hFile = nullptr;
}
#endif
m_bCloseOnDelete = false;
@ -208,7 +208,7 @@ bool CFile::IsOpen(void) const
#ifdef USE_WINDOWS_API
return m_hFile != INVALID_HANDLE_VALUE;
#else
return m_hFile != NULL;
return m_hFile != nullptr;
#endif
}
@ -237,7 +237,7 @@ bool CFile::Write(const void* lpBuf, uint32_t nCount)
#ifdef USE_WINDOWS_API
ULONG nWritten = 0;
if (!::WriteFile(m_hFile, lpBuf, nCount, &nWritten, NULL))
if (!::WriteFile(m_hFile, lpBuf, nCount, &nWritten, nullptr))
{
return false;
}
@ -265,7 +265,7 @@ uint32_t CFile::Read(void* lpBuf, uint32_t nCount)
#ifdef USE_WINDOWS_API
DWORD dwRead = 0;
if (!::ReadFile(m_hFile, lpBuf, nCount, &dwRead, NULL))
if (!::ReadFile(m_hFile, lpBuf, nCount, &dwRead, nullptr))
{
return 0;
}
@ -279,14 +279,14 @@ uint32_t CFile::Read(void* lpBuf, uint32_t nCount)
int32_t CFile::Seek(int32_t lOff, SeekPosition nFrom)
{
#ifdef USE_WINDOWS_API
ULONG dwNew = ::SetFilePointer(m_hFile, lOff, NULL, (ULONG)nFrom);
ULONG dwNew = ::SetFilePointer(m_hFile, lOff, nullptr, (ULONG)nFrom);
if (dwNew == (ULONG)-1)
{
return -1;
}
return dwNew;
#else
if (m_hFile == NULL)
if (m_hFile == nullptr)
{
return -1;
}
@ -310,7 +310,7 @@ int32_t CFile::Seek(int32_t lOff, SeekPosition nFrom)
uint32_t CFile::GetPosition() const
{
#ifdef USE_WINDOWS_API
return ::SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT);
return ::SetFilePointer(m_hFile, 0, nullptr, FILE_CURRENT);
#else
return (uint32_t)ftell((FILE *)m_hFile);
#endif

View File

@ -11,7 +11,7 @@ CIniFileBase::CIniFileBase(CFileBase & FileObject, const char * FileName) :
m_File(FileObject),
m_FileName(FileName),
m_CurrentSectionDirty(false),
m_SortFunction(NULL)
m_SortFunction(nullptr)
{
}
@ -122,7 +122,7 @@ int CIniFileBase::GetStringFromFile(char * & String, std::unique_ptr<char> &Data
// Increase buffer size
int NewMaxDataSize = MaxDataSize + BufferIncrease;
char * NewBuffer = new char[NewMaxDataSize];
if (NewBuffer == NULL)
if (NewBuffer == nullptr)
{
return -1;
}
@ -208,7 +208,7 @@ void CIniFileBase::SaveCurrentSection(void)
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
std::unique_ptr<char> Data;
char *Input = NULL;
char *Input = nullptr;
// Skip first line as it is the section name
int StartPos = m_CurrentSectionFilePos;
@ -245,7 +245,7 @@ void CIniFileBase::SaveCurrentSection(void)
std::unique_ptr<char> LineData;
int len = 0;
if (m_SortFunction != NULL)
if (m_SortFunction != nullptr)
{
KeyValueVector data;
for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++)
@ -297,7 +297,7 @@ bool CIniFileBase::MoveToSectionNameData(const char * lpSectionName, bool Change
}
std::unique_ptr<char> Data;
char *Input = NULL;
char *Input = nullptr;
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
FILELOC_ITR iter = m_SectionsPos.find(std::string(lpSectionName));
@ -386,7 +386,7 @@ bool CIniFileBase::MoveToSectionNameData(const char * lpSectionName, bool Change
if (strlen(CleanLine(Input)) <= 1) { continue; }
if (Input[0] == '[') { break; }
char * Pos = strchr(Input, '=');
if (Pos == NULL) { continue; }
if (Pos == nullptr) { continue; }
char * Value = &Pos[1];
char * Pos1 = Pos - 1;
@ -408,10 +408,10 @@ const char * CIniFileBase::CleanLine(char * Line)
char * Pos = Line;
// Remove any comment from the line
while (Pos != NULL)
while (Pos != nullptr)
{
Pos = strchr(Pos, '/');
if (Pos != NULL)
if (Pos != nullptr)
{
if (Pos[1] == '/')
{
@ -510,7 +510,7 @@ bool CIniFileBase::DeleteSection(const char * lpSectionName)
{
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, NextLine = 0, result;
std::unique_ptr <char> Data;
char *Input = NULL;
char *Input = nullptr;
do
{
result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos);
@ -570,7 +570,7 @@ bool CIniFileBase::GetString(const char * lpSectionName, const char * lpKeyName,
{
CGuard Guard(m_CS);
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
if (lpSectionName == nullptr || strlen(lpSectionName) == 0)
{
lpSectionName = "default";
}
@ -601,7 +601,7 @@ uint32_t CIniFileBase::GetString(const char * lpSectionName, const char * lpKeyN
std::string strSection;
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
if (lpSectionName == nullptr || strlen(lpSectionName) == 0)
{
strSection = "default";
}
@ -636,7 +636,7 @@ bool CIniFileBase::GetNumber(const char * lpSectionName, const char * lpKeyName,
{
CGuard Guard(m_CS);
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
if (lpSectionName == nullptr || strlen(lpSectionName) == 0)
{
lpSectionName = "default";
}
@ -671,7 +671,7 @@ void CIniFileBase::SaveString(const char * lpSectionName, const char * lpKeyNam
}
std::string strSection;
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
if (lpSectionName == nullptr || strlen(lpSectionName) == 0)
{
strSection = "default";
}
@ -729,7 +729,7 @@ bool CIniFileBase::EntryExists(const char * lpSectionName, const char * lpKeyNam
{
CGuard Guard(m_CS);
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
if (lpSectionName == nullptr || strlen(lpSectionName) == 0)
{
lpSectionName = "default";
}
@ -770,7 +770,7 @@ void CIniFileBase::GetKeyList(const char * lpSectionName, strlist &List)
return;
}
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
if (lpSectionName == nullptr || strlen(lpSectionName) == 0)
{
lpSectionName = "default";
}
@ -794,7 +794,7 @@ void CIniFileBase::GetKeyValueData(const char * lpSectionName, KeyValueData & Li
std::string strSection;
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
if (lpSectionName == nullptr || strlen(lpSectionName) == 0)
{
strSection = "default";
}
@ -807,7 +807,7 @@ void CIniFileBase::GetKeyValueData(const char * lpSectionName, KeyValueData & Li
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
std::unique_ptr <char> Data;
char *Input = NULL;
char *Input = nullptr;
do
{
result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos);
@ -815,7 +815,7 @@ void CIniFileBase::GetKeyValueData(const char * lpSectionName, KeyValueData & Li
if (strlen(CleanLine(Input)) <= 1) { continue; }
if (Input[0] == '[') { break; }
char * Pos = strchr(Input, '=');
if (Pos == NULL) { continue; }
if (Pos == nullptr) { continue; }
Pos[0] = 0;
List.insert(KeyValueData::value_type(Input, &Pos[1]));
@ -882,7 +882,7 @@ std::string CIniFileBase::FormatStr(const char * strFormat, ...)
size_t nlen = _vscprintf(strFormat, args) + 1;
char * buffer = (char *)alloca(nlen * sizeof(char));
buffer[nlen - 1] = 0;
if (buffer != NULL)
if (buffer != nullptr)
{
vsprintf(buffer, strFormat, args);
FormatedStr = buffer;

View File

@ -19,7 +19,7 @@ CLog::~CLog (void)
bool CLog::Open( const char * FileName, LOG_OPEN_MODE mode /* = Log_New */)
{
if (FileName == NULL)
if (FileName == nullptr)
{
return false;
}
@ -68,7 +68,7 @@ void CLog::LogArgs(const char * Message, va_list & args )
size_t nlen = _vscprintf(Message, args) + 1;
char * Msg = (char *)alloca(nlen * sizeof(char));
Msg[nlen - 1] = 0;
if (Msg != NULL)
if (Msg != nullptr)
{
vsprintf(Msg, Message, args);
Log(Msg);

View File

@ -46,8 +46,8 @@ CMemList *MemList(void)
}
CMemList::CMemList() :
m_MemList(NULL),
m_hModule(NULL),
m_MemList(nullptr),
m_hModule(nullptr),
m_cs({0}),
m_NextOrder(1)
{
@ -77,7 +77,7 @@ CMemList::~CMemList()
DumpItems();
}
delete m_MemList;
m_MemList = NULL;
m_MemList = nullptr;
DeleteCriticalSection(&m_cs);
}
@ -128,14 +128,14 @@ void CMemList::DumpItems(void)
HANDLE hLogFile = INVALID_HANDLE_VALUE;
do
{
hLogFile = CreateFileA( LogFileName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL );
hLogFile = CreateFileA( LogFileName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, nullptr );
if (hLogFile == INVALID_HANDLE_VALUE)
{
if (GetLastError() == ERROR_SHARING_VIOLATION)
{
char Msg[3000];
sprintf(Msg, "%s\nCan not be opened for writing please close app using this file\n\nTry Again ?", LogFileName);
int Result = MessageBoxA(NULL, Msg, "Memory Leak", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_SERVICE_NOTIFICATION);
int Result = MessageBoxA(nullptr, Msg, "Memory Leak", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_SERVICE_NOTIFICATION);
if (Result == IDNO)
{
break;
@ -146,33 +146,33 @@ void CMemList::DumpItems(void)
if (hLogFile != INVALID_HANDLE_VALUE)
{
SetFilePointer(hLogFile, 0, NULL, FILE_BEGIN);
SetFilePointer(hLogFile, 0, nullptr, FILE_BEGIN);
DWORD dwWritten = 0;
char Msg[800];
_snprintf(Msg, sizeof(Msg), "Order, Source File, Line Number, Mem Size\r\n");
WriteFile(hLogFile, Msg, (DWORD)strlen(Msg), &dwWritten, NULL);
WriteFile(hLogFile, Msg, (DWORD)strlen(Msg), &dwWritten, nullptr);
for (MEMLIST_ITER item = m_MemList->begin(); item != m_MemList->end(); item++)
{
_snprintf(Msg, sizeof(Msg), "%d,%s, %d, %d\r\n", (*item).second.order, (*item).second.File, (*item).second.line, (*item).second.size);
WriteFile(hLogFile, Msg, (DWORD)strlen(Msg), &dwWritten, NULL);
WriteFile(hLogFile, Msg, (DWORD)strlen(Msg), &dwWritten, nullptr);
}
CloseHandle(hLogFile);
}
char Msg[3000];
sprintf(Msg, "%s%s\n\nMemory Leaks detected\n\nOpen the Log File ?", fname, ext);
int Result = MessageBoxA(NULL, Msg, "Memory Leak", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_SERVICE_NOTIFICATION);
int Result = MessageBoxA(nullptr, Msg, "Memory Leak", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_SERVICE_NOTIFICATION);
if (Result == IDYES)
{
ShellExecuteA(NULL, "open", LogFileName, NULL, NULL, SW_SHOW);
ShellExecuteA(nullptr, "open", LogFileName, nullptr, nullptr, SW_SHOW);
}
}
void* AllocateMemory(size_t size, const char* filename, unsigned int line)
{
void * res = malloc(size);
if (res == NULL)
if (res == nullptr)
{
return res;
}

View File

@ -56,7 +56,7 @@ void* AllocateAddressSpace(size_t size, void * base_address)
void * ptr = mmap((void*)0, size, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0);
if (ptr == MAP_FAILED)
{
return NULL;
return nullptr;
}
msync(ptr, size, MS_SYNC | MS_INVALIDATE);
return ptr;
@ -80,7 +80,7 @@ void* CommitMemory(void* addr, size_t size, MEM_PROTECTION memProtection)
int OsMemProtection;
if (!TranslateFromMemProtect(memProtection, OsMemProtection))
{
return NULL;
return nullptr;
}
#ifdef _WIN32
return VirtualAlloc(addr, size, MEM_COMMIT, OsMemProtection);
@ -118,11 +118,11 @@ bool ProtectMemory(void* addr, size_t size, MEM_PROTECTION memProtection, MEM_PR
#ifdef _WIN32
DWORD OldOsProtect;
BOOL res = VirtualProtect(addr, size, OsMemProtection, &OldOsProtect);
if (OldProtect != NULL)
if (OldProtect != nullptr)
{
if (!TranslateToMemProtect(OldOsProtect, *OldProtect))
{
return NULL;
return nullptr;
}
}
return res != 0;

View File

@ -7,7 +7,7 @@ int _vscprintf(const char * format, va_list pargs)
int retval;
va_list argcopy;
va_copy(argcopy, pargs);
retval = vsnprintf(NULL, 0, format, argcopy);
retval = vsnprintf(nullptr, 0, format, argcopy);
va_end(argcopy);
return retval;
}

View File

@ -6,7 +6,7 @@
CRandom::CRandom()
{
m_state = (uint32_t)time(NULL);
m_state = (uint32_t)time(nullptr);
}
CRandom::CRandom(uint32_t state_value)

View File

@ -71,7 +71,7 @@ void stdstr::ArgFormat(const char * strFormat, va_list & args)
size_t nlen = _vscprintf(strFormat, args) + 1;
char * buffer = (char *)alloca(nlen * sizeof(char));
buffer[nlen - 1] = 0;
if (buffer != NULL)
if (buffer != nullptr)
{
vsprintf(buffer, strFormat, args);
*this = buffer;
@ -200,22 +200,22 @@ stdstr & stdstr::FromUTF16(const wchar_t * UTF16Source, bool * bSuccess)
{
bool bConverted = false;
if (UTF16Source == NULL)
if (UTF16Source == nullptr)
{
*this = "";
bConverted = true;
}
else if (wcslen(UTF16Source) > 0)
{
uint32_t nNeeded = WideCharToMultiByte(CODEPAGE_UTF8, 0, UTF16Source, -1, NULL, 0, NULL, NULL);
uint32_t nNeeded = WideCharToMultiByte(CODEPAGE_UTF8, 0, UTF16Source, -1, nullptr, 0, nullptr, nullptr);
if (nNeeded > 0)
{
char * buf = (char *)alloca(nNeeded + 1);
if (buf != NULL)
if (buf != nullptr)
{
memset(buf, 0, nNeeded + 1);
nNeeded = WideCharToMultiByte(CODEPAGE_UTF8, 0, UTF16Source, -1, buf, nNeeded, NULL, NULL);
nNeeded = WideCharToMultiByte(CODEPAGE_UTF8, 0, UTF16Source, -1, buf, nNeeded, nullptr, nullptr);
if (nNeeded)
{
*this = buf;
@ -236,11 +236,11 @@ std::wstring stdstr::ToUTF16(unsigned int CodePage, bool * bSuccess) const
bool bConverted = false;
std::wstring res;
DWORD nNeeded = MultiByteToWideChar(CodePage, 0, this->c_str(), (int)this->length(), NULL, 0);
DWORD nNeeded = MultiByteToWideChar(CodePage, 0, this->c_str(), (int)this->length(), nullptr, 0);
if (nNeeded > 0)
{
wchar_t * buf = (wchar_t *)alloca((nNeeded + 1) * sizeof(wchar_t));
if (buf != NULL)
if (buf != nullptr)
{
memset(buf, 0, (nNeeded + 1) * sizeof(wchar_t));

View File

@ -39,8 +39,8 @@ public:
stdstr & TrimRight(const char * chars2remove = "\t ");
#ifdef _WIN32
stdstr & FromUTF16(const wchar_t * UTF16Source, bool * bSuccess = NULL);
std::wstring ToUTF16(unsigned int CodePage = CODEPAGE_UTF8, bool * bSuccess = NULL) const;
stdstr & FromUTF16(const wchar_t * UTF16Source, bool * bSuccess = nullptr);
std::wstring ToUTF16(unsigned int CodePage = CODEPAGE_UTF8, bool * bSuccess = nullptr) const;
#endif
void ArgFormat(const char * strFormat, va_list & args);

View File

@ -6,13 +6,13 @@
SyncEvent::SyncEvent(bool bManualReset)
{
#ifdef _WIN32
m_Event = CreateEvent(NULL, bManualReset, FALSE, NULL);
m_Event = CreateEvent(nullptr, bManualReset, FALSE, nullptr);
#else
m_signalled = false;
m_Event = new pthread_mutex_t;
m_cond = new pthread_cond_t;
pthread_mutex_init((pthread_mutex_t*)m_Event, NULL);
pthread_cond_init((pthread_cond_t*)m_cond, NULL);
pthread_mutex_init((pthread_mutex_t*)m_Event, nullptr);
pthread_cond_init((pthread_cond_t*)m_cond, nullptr);
#endif
}

View File

@ -11,8 +11,8 @@
CThread::CThread(CTHREAD_START_ROUTINE lpStartAddress) :
m_StartAddress(lpStartAddress),
m_lpThreadParameter(NULL),
m_thread(NULL),
m_lpThreadParameter(nullptr),
m_thread(nullptr),
#ifndef _WIN32
m_running(false),
#endif
@ -44,13 +44,13 @@ bool CThread::Start(void * lpThreadParameter)
WriteTrace(TraceThread, TraceDebug, "Start");
m_lpThreadParameter = lpThreadParameter;
#ifdef _WIN32
m_thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadWrapper, this, 0, (LPDWORD)&m_threadID);
m_thread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)ThreadWrapper, this, 0, (LPDWORD)&m_threadID);
#else
pthread_t * thread_id = new pthread_t;
m_thread = (void*)thread_id;
int res = pthread_create(thread_id, NULL, (void *(*)(void *))ThreadWrapper, this);
int res = pthread_create(thread_id, nullptr, (void *(*)(void *))ThreadWrapper, this);
#endif
WriteTrace(TraceThread, TraceDebug, "Done");
return true;
@ -64,7 +64,7 @@ void * CThread::ThreadWrapper (CThread * _this)
_this->m_running = true;
WriteTrace(TraceThread, TraceDebug, "Thread is running");
#endif
void * res = NULL;
void * res = nullptr;
try
{
#if defined(__i386__) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM)
@ -87,7 +87,7 @@ void * CThread::ThreadWrapper (CThread * _this)
pthread_t * thread_id = (pthread_t *)_this->m_thread;
delete thread_id;
#endif
_this->m_thread = NULL;
_this->m_thread = nullptr;
WriteTrace(TraceThread, TraceDebug, "Done");
return res;
}
@ -95,7 +95,7 @@ void * CThread::ThreadWrapper (CThread * _this)
bool CThread::isRunning(void) const
{
WriteTrace(TraceThread, TraceDebug, "Start");
if (m_thread == NULL)
if (m_thread == nullptr)
{
WriteTrace(TraceThread, TraceDebug, "Done (res: false), m_thread is null");
return false;

View File

@ -12,7 +12,7 @@
typedef std::map<uint32_t, stdstr> ModuleNameMap;
uint32_t * g_ModuleLogLevel = NULL;
uint32_t * g_ModuleLogLevel = nullptr;
static bool g_TraceClosed = false;
static ModuleNameMap g_ModuleNames;
@ -53,7 +53,7 @@ void WriteTraceFull(uint32_t module, uint8_t severity, const char * file, int li
size_t nlen = _vscprintf(format, args) + 1;
char * Message = (char *)alloca(nlen * sizeof(char));
Message[nlen - 1] = 0;
if (Message != NULL)
if (Message != nullptr)
{
vsprintf(Message, format, args);
GetTraceObjet().TraceMessage(module, severity, file, line, function, Message);
@ -74,7 +74,7 @@ void CloseTrace(void)
if (g_ModuleLogLevel)
{
delete g_ModuleLogLevel;
g_ModuleLogLevel = NULL;
g_ModuleLogLevel = nullptr;
}
}
@ -83,7 +83,7 @@ void TraceSetMaxModule(uint32_t MaxModule, uint8_t DefaultSeverity)
if (g_ModuleLogLevel)
{
delete g_ModuleLogLevel;
g_ModuleLogLevel = NULL;
g_ModuleLogLevel = nullptr;
}
g_ModuleLogLevel = new uint32_t[MaxModule];
for (uint32_t i = 0; i < MaxModule; i++)
@ -119,7 +119,7 @@ CTraceModule * CTraceLog::RemoveTraceModule(CTraceModule * TraceModule)
return TraceModule;
}
}
return NULL;
return nullptr;
}
void CTraceLog::CloseTrace(void)
@ -130,7 +130,7 @@ void CTraceLog::CloseTrace(void)
if (g_ModuleLogLevel)
{
delete g_ModuleLogLevel;
g_ModuleLogLevel = NULL;
g_ModuleLogLevel = nullptr;
}
}
@ -158,7 +158,7 @@ CTraceModule * TraceAddModule(CTraceModule * TraceModule)
{
if (g_TraceClosed)
{
return NULL;
return nullptr;
}
GetTraceObjet().AddTraceModule(TraceModule);
return TraceModule;
@ -235,7 +235,7 @@ void CTraceFileLog::Write(uint32_t module, uint8_t severity, const char * /*file
localtime_r(&ltime, &result);
struct timeval curTime;
gettimeofday(&curTime, NULL);
gettimeofday(&curTime, nullptr);
int milliseconds = curTime.tv_usec / 1000;
stdstr_f timestamp("%04d/%02d/%02d %02d:%02d:%02d.%03d %05d,", result.tm_year+1900, result.tm_mon+1, result.tm_mday, result.tm_hour, result.tm_min, result.tm_sec, milliseconds, CThread::GetCurrentThreadId());

View File

@ -12,9 +12,9 @@
pjutil::DynLibHandle pjutil::DynLibOpen(const char *pccLibraryPath, bool ShowErrors)
{
if (pccLibraryPath == NULL)
if (pccLibraryPath == nullptr)
{
return NULL;
return nullptr;
}
#ifdef _WIN32
UINT LastErrorMode = SetErrorMode(ShowErrors ? 0 : SEM_FAILCRITICALERRORS);
@ -28,8 +28,8 @@ pjutil::DynLibHandle pjutil::DynLibOpen(const char *pccLibraryPath, bool ShowErr
void * pjutil::DynLibGetProc(pjutil::DynLibHandle LibHandle, const char * ProcedureName)
{
if (ProcedureName == NULL)
return NULL;
if (ProcedureName == nullptr)
return nullptr;
#ifdef _WIN32
return GetProcAddress((HMODULE)LibHandle, ProcedureName);
@ -40,7 +40,7 @@ void * pjutil::DynLibGetProc(pjutil::DynLibHandle LibHandle, const char * Proced
void pjutil::DynLibClose(pjutil::DynLibHandle LibHandle)
{
if (LibHandle != NULL)
if (LibHandle != nullptr)
{
#ifdef _WIN32
FreeLibrary((HMODULE)LibHandle);
@ -99,14 +99,14 @@ bool pjutil::TerminatedExistingExe()
stdstr_f Caption("Terminate %s", ModuleName.c_str());
AskedUser = true;
int res = MessageBox(NULL, Message.ToUTF16().c_str(), Caption.ToUTF16().c_str(), MB_YESNO | MB_ICONEXCLAMATION);
int res = MessageBox(nullptr, Message.ToUTF16().c_str(), Caption.ToUTF16().c_str(), MB_YESNO | MB_ICONEXCLAMATION);
if (res != IDYES)
{
break;
}
}
HANDLE hHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, lppe.th32ProcessID);
if (hHandle != NULL)
if (hHandle != nullptr)
{
if (TerminateProcess(hHandle, 0))
{
@ -117,7 +117,7 @@ bool pjutil::TerminatedExistingExe()
{
stdstr_f Message("Failed to terminate pid %d", lppe.th32ProcessID);
stdstr_f Caption("Terminate %s failed!", ModuleName.c_str());
MessageBox(NULL, Message.ToUTF16().c_str(), Caption.ToUTF16().c_str(), MB_YESNO | MB_ICONEXCLAMATION);
MessageBox(nullptr, Message.ToUTF16().c_str(), Caption.ToUTF16().c_str(), MB_YESNO | MB_ICONEXCLAMATION);
}
CloseHandle(hHandle);
}

View File

@ -265,7 +265,7 @@ void MD5::init()
::memset(digest, 0, sizeof(digest));
::memset(buffer, 0, sizeof(buffer));
m_hex_digest = NULL;
m_hex_digest = nullptr;
}
// Constants for MD5Transform routine.

View File

@ -19,14 +19,14 @@
#endif
#include "Platform.h"
// g_ModuleLogLevel may be NULL while AppInit() is still in session in path.cpp.
// The added check to compare to NULL here is at least a temporary workaround.
// g_ModuleLogLevel may be nullptr while AppInit() is still in session in path.cpp.
// The added check to compare to nullptr here is at least a temporary workaround.
#undef WriteTrace
#ifdef _WIN32
#define WriteTrace(m, s, format, ...) if (g_ModuleLogLevel != NULL && g_ModuleLogLevel[(m)] >= (s)) { WriteTraceFull((m), (s), __FILE__, __LINE__, __FUNCTION__, (format), ## __VA_ARGS__); }
#define WriteTrace(m, s, format, ...) if (g_ModuleLogLevel != nullptr && g_ModuleLogLevel[(m)] >= (s)) { WriteTraceFull((m), (s), __FILE__, __LINE__, __FUNCTION__, (format), ## __VA_ARGS__); }
#else
#define WriteTrace(m, s, format, ...) if (g_ModuleLogLevel != NULL && g_ModuleLogLevel[(m)] >= (s)) { WriteTraceFull((m), (s), __FILE__, __LINE__, __PRETTY_FUNCTION__, (format), ## __VA_ARGS__); }
#define WriteTrace(m, s, format, ...) if (g_ModuleLogLevel != nullptr && g_ModuleLogLevel[(m)] >= (s)) { WriteTraceFull((m), (s), __FILE__, __LINE__, __PRETTY_FUNCTION__, (format), ## __VA_ARGS__); }
#endif
// Constants
@ -43,7 +43,7 @@ const char DIRECTORY_DELIMITER2 = '\\';
#endif
const char EXTENSION_DELIMITER = '.';
#ifdef _WIN32
void * CPath::m_hInst = NULL;
void * CPath::m_hInst = nullptr;
#endif
// Helpers
@ -69,9 +69,9 @@ inline void CPath::Init()
{
m_dwFindFileAttributes = 0;
#ifdef _WIN32
m_hFindFile = NULL;
m_hFindFile = nullptr;
#else
m_OpenedDir = NULL;
m_OpenedDir = nullptr;
m_FindWildcard = "";
#endif
}
@ -81,16 +81,16 @@ inline void CPath::Init()
inline void CPath::Exit()
{
#ifdef _WIN32
if (m_hFindFile != NULL)
if (m_hFindFile != nullptr)
{
FindClose(m_hFindFile);
m_hFindFile = NULL;
m_hFindFile = nullptr;
}
#else
if (m_OpenedDir != NULL)
if (m_OpenedDir != nullptr)
{
closedir((DIR*)m_OpenedDir);
m_OpenedDir = NULL;
m_OpenedDir = nullptr;
}
#endif
}
@ -278,7 +278,7 @@ Returns extension completely without delimiters, e.g. "doc"
Globals:
I/O:
Task: Return the individual components of this path.
For any given argument, you can pass NULL if you are not
For any given argument, you can pass nullptr if you are not
interested in that component.
Do not rely on pNames being <= 8 characters, extensions
being <= 3 characters, or drives being 1 character
@ -296,7 +296,7 @@ void CPath::GetComponents(std::string* pDrive, std::string* pDirectory, std::str
const char * BasePath = m_strPath.c_str();
const char * DriveDir = strrchr(BasePath, DRIVE_DELIMITER);
if (DriveDir != NULL)
if (DriveDir != nullptr)
{
size_t len = sizeof(buff_dir) < (DriveDir - BasePath) ? sizeof(buff_drive) : DriveDir - BasePath;
strncpy(buff_drive, BasePath, len);
@ -304,7 +304,7 @@ void CPath::GetComponents(std::string* pDrive, std::string* pDirectory, std::str
}
const char * last = strrchr(BasePath, DIRECTORY_DELIMITER);
if (last != NULL)
if (last != nullptr)
{
size_t len = sizeof(buff_dir) < (last - BasePath) ? sizeof(buff_dir) : last - BasePath;
if (len > 0)
@ -323,7 +323,7 @@ void CPath::GetComponents(std::string* pDrive, std::string* pDirectory, std::str
strncpy(buff_dir, BasePath, sizeof(buff_dir));
}
char * ext = strrchr(buff_name, '.');
if (ext != NULL)
if (ext != nullptr)
{
strncpy(buff_ext, ext + 1, sizeof(buff_ext));
*ext = '\0';
@ -362,7 +362,7 @@ void CPath::GetComponents(std::string* pDirectory, std::string* pName, std::stri
const char * BasePath = m_strPath.c_str();
const char * last = strrchr(BasePath,DIRECTORY_DELIMITER);
if (last != NULL)
if (last != nullptr)
{
int len = sizeof(buff_dir) < (last - BasePath) ? sizeof(buff_dir) : last - BasePath;
if (len > 0)
@ -381,7 +381,7 @@ void CPath::GetComponents(std::string* pDirectory, std::string* pName, std::stri
strncpy(buff_dir,BasePath,sizeof(buff_dir));
}
char * ext = strrchr(buff_name,'.');
if (ext != NULL)
if (ext != nullptr)
{
strncpy(buff_ext,ext + 1,sizeof(buff_ext));
*ext = '\0';
@ -433,7 +433,7 @@ std::string CPath::GetDriveDirectory(void) const
void CPath::GetDirectory(std::string& rDirectory) const
{
#ifdef _WIN32
GetComponents(NULL, &rDirectory);
GetComponents(nullptr, &rDirectory);
#else
GetComponents(&rDirectory);
#endif
@ -454,9 +454,9 @@ void CPath::GetNameExtension(std::string& rNameExtension) const
std::string Extension;
#ifdef _WIN32
GetComponents(NULL, NULL, &Name, &Extension);
GetComponents(nullptr, nullptr, &Name, &Extension);
#else
GetComponents(NULL, &Name, &Extension);
GetComponents(nullptr, &Name, &Extension);
#endif
rNameExtension = Name;
if (!Extension.empty())
@ -478,9 +478,9 @@ std::string CPath::GetNameExtension(void) const
void CPath::GetName(std::string& rName) const
{
#ifdef _WIN32
GetComponents(NULL, NULL, &rName);
GetComponents(nullptr, nullptr, &rName);
#else
GetComponents(NULL, &rName);
GetComponents(nullptr, &rName);
#endif
}
@ -496,9 +496,9 @@ std::string CPath::GetName(void) const
void CPath::GetExtension(std::string& rExtension) const
{
#ifdef _WIN32
GetComponents(NULL, NULL, NULL, &rExtension);
GetComponents(nullptr, nullptr, nullptr, &rExtension);
#else
GetComponents(NULL, NULL, &rExtension);
GetComponents(nullptr, nullptr, &rExtension);
#endif
}
@ -581,7 +581,7 @@ void CPath::SetComponents(const char * lpszDrive, const char * lpszDirectory, co
char buff_fullname[MAX_PATH];
memset(buff_fullname, 0, sizeof(buff_fullname));
if (lpszDirectory == NULL || strlen(lpszDirectory) == 0)
if (lpszDirectory == nullptr || strlen(lpszDirectory) == 0)
{
static char empty_dir[] = { DIRECTORY_DELIMITER, '\0' };
lpszDirectory = empty_dir;
@ -597,7 +597,7 @@ void CPath::SetComponents(const char * lpszDirectory, const char * lpszName, con
char buff_fullname[260];
memset(buff_fullname, 0, sizeof(buff_fullname));
if (lpszDirectory != NULL && lpszDirectory[0] != '\0')
if (lpszDirectory != nullptr && lpszDirectory[0] != '\0')
{
if (lpszDirectory[0] != DIRECTORY_DELIMITER) { buff_fullname[0] = DIRECTORY_DELIMITER; }
strncat(buff_fullname,lpszDirectory,sizeof(buff_fullname) - 1);
@ -607,11 +607,11 @@ void CPath::SetComponents(const char * lpszDirectory, const char * lpszName, con
buff_fullname[nLength] = DIRECTORY_DELIMITER;
}
}
if (lpszName != NULL)
if (lpszName != nullptr)
{
strncat(buff_fullname,lpszName,sizeof(buff_fullname) - 1);
}
if (lpszExtension != NULL && lpszExtension[0] != '\0')
if (lpszExtension != nullptr && lpszExtension[0] != '\0')
{
if (lpszExtension[0] != '.')
{
@ -635,7 +635,7 @@ void CPath::SetDrive(char chDrive)
std::string Name;
std::string Extension;
GetComponents(NULL, &Directory, &Name, &Extension);
GetComponents(nullptr, &Directory, &Name, &Extension);
SetComponents(Drive.c_str(), Directory.c_str(), Name.c_str(), Extension.c_str());
}
#endif
@ -660,10 +660,10 @@ void CPath::SetDirectory(const char * lpszDirectory, bool bEnsureAbsolute /*= fa
#ifdef _WIN32
std::string Drive;
GetComponents(&Drive, NULL, &Name, &Extension);
GetComponents(&Drive, nullptr, &Name, &Extension);
SetComponents(Drive.c_str(), Directory.c_str(), Name.c_str(), Extension.c_str());
#else
GetComponents(NULL, &Name, &Extension);
GetComponents(nullptr, &Name, &Extension);
SetComponents(Directory.c_str(), Name.c_str(), Extension.c_str());
#endif
WriteTrace(TracePath, TraceDebug, "Done (m_strPath: \"%s\")", m_strPath.c_str());
@ -685,8 +685,8 @@ void CPath::SetDriveDirectory(const char * lpszDriveDirectory)
cleanPathString(DriveDirectory);
}
GetComponents(NULL, NULL, &Name, &Extension);
SetComponents(NULL, DriveDirectory.c_str(), Name.c_str(), Extension.c_str());
GetComponents(nullptr, nullptr, &Name, &Extension);
SetComponents(nullptr, DriveDirectory.c_str(), Name.c_str(), Extension.c_str());
}
#endif
@ -699,10 +699,10 @@ void CPath::SetName(const char * lpszName)
#ifdef _WIN32
std::string Drive;
GetComponents(&Drive, &Directory, NULL, &Extension);
GetComponents(&Drive, &Directory, nullptr, &Extension);
SetComponents(Drive.c_str(), Directory.c_str(), lpszName, Extension.c_str());
#else
GetComponents(&Directory, NULL, &Extension);
GetComponents(&Directory, nullptr, &Extension);
SetComponents(Directory.c_str(), lpszName, Extension.c_str());
#endif
}
@ -721,10 +721,10 @@ void CPath::SetName(int iName)
#ifdef _WIN32
std::string Drive;
GetComponents(&Drive, &Directory, NULL, &Extension);
GetComponents(&Drive, &Directory, nullptr, &Extension);
SetComponents(Drive.c_str(), Directory.c_str(), sName, Extension.c_str());
#else
GetComponents(&Directory, NULL, &Extension);
GetComponents(&Directory, nullptr, &Extension);
SetComponents(Directory.c_str(), sName, Extension.c_str());
#endif
}
@ -777,10 +777,10 @@ void CPath::SetNameExtension(const char * lpszNameExtension)
#ifdef _WIN32
std::string Drive;
GetComponents(&Drive, &Directory);
SetComponents(Drive.c_str(), Directory.c_str(), lpszNameExtension, NULL);
SetComponents(Drive.c_str(), Directory.c_str(), lpszNameExtension, nullptr);
#else
GetComponents(&Directory);
SetComponents(Directory.c_str(), lpszNameExtension, NULL);
SetComponents(Directory.c_str(), lpszNameExtension, nullptr);
#endif
}
@ -824,7 +824,7 @@ deepest directory (the one we're exiting) in it
Task: Remove deepest subdirectory from path
*/
void CPath::UpDirectory(std::string *pLastDirectory /*= NULL*/)
void CPath::UpDirectory(std::string *pLastDirectory /*= nullptr*/)
{
std::string Directory;
@ -835,7 +835,7 @@ void CPath::UpDirectory(std::string *pLastDirectory /*= NULL*/)
std::string::size_type nDelimiter = Directory.rfind(DIRECTORY_DELIMITER);
if (pLastDirectory != NULL)
if (pLastDirectory != nullptr)
{
*pLastDirectory = Directory.substr(nDelimiter);
StripLeadingBackslash(*pLastDirectory);
@ -940,7 +940,7 @@ bool CPath::DirectoryExists() const
HANDLE hFindFile = FindFirstFileA((const char *)TestPath, &FindData); // Find anything
bool res = (hFindFile != INVALID_HANDLE_VALUE);
if (hFindFile != NULL) // Make sure we close the search
if (hFindFile != nullptr) // Make sure we close the search
{
FindClose(hFindFile);
}
@ -968,7 +968,7 @@ bool CPath::Exists() const
HANDLE hFindFile = FindFirstFileA(m_strPath.c_str(), &FindData);
bool bSuccess = (hFindFile != INVALID_HANDLE_VALUE);
if (hFindFile != NULL) // Make sure we close the search
if (hFindFile != nullptr) // Make sure we close the search
{
FindClose(hFindFile);
}
@ -1049,7 +1049,7 @@ we will make sure the target file is writable first
bool CPath::CopyTo(const char * lpcszTargetFile, bool bOverwrite)
{
if (lpcszTargetFile == NULL)
if (lpcszTargetFile == nullptr)
{
return false;
}
@ -1081,7 +1081,7 @@ bool CPath::CopyTo(const char * lpcszTargetFile, bool bOverwrite)
bool res = true;
WriteTrace(TracePath, TraceDebug, "Opening \"%s\" for reading",m_strPath.c_str());
FILE * infile = fopen(m_strPath.c_str(), "rb");
if(infile == NULL)
if(infile == nullptr)
{
WriteTrace(TracePath, TraceWarning, "Failed to open m_strPath = %s",m_strPath.c_str());
res = false;
@ -1091,12 +1091,12 @@ bool CPath::CopyTo(const char * lpcszTargetFile, bool bOverwrite)
WriteTrace(TracePath, TraceDebug, "Opened \"%s\"",m_strPath.c_str());
}
FILE * outfile = NULL;
FILE * outfile = nullptr;
if (res)
{
WriteTrace(TracePath, TraceDebug, "Opening \"%s\" for writing",lpcszTargetFile);
outfile = fopen(lpcszTargetFile, "wb");
if (outfile == NULL)
if (outfile == nullptr)
{
WriteTrace(TracePath, TraceWarning, "Failed to open m_strPath = %s errno=%d",lpcszTargetFile, errno);
res = false;
@ -1150,11 +1150,11 @@ bool CPath::CopyTo(const char * lpcszTargetFile, bool bOverwrite)
res = false;
}
}
if (infile != NULL)
if (infile != nullptr)
{
fclose(infile);
}
if (outfile != NULL)
if (outfile != nullptr)
{
fclose(outfile);
}
@ -1281,7 +1281,7 @@ bool CPath::FindFirst(uint32_t dwAttributes /*= FIND_ATTRIBUTE_FILES*/)
}
m_OpenedDir = opendir(Directory.c_str());
if (m_OpenedDir == NULL) return false;
if (m_OpenedDir == nullptr) return false;
return FindNext();
#endif
return false;
@ -1293,7 +1293,7 @@ bool CPath::FindFirst(uint32_t dwAttributes /*= FIND_ATTRIBUTE_FILES*/)
bool CPath::FindNext()
{
#ifdef _WIN32
if (m_hFindFile == NULL)
if (m_hFindFile == nullptr)
{
return false;
}
@ -1471,7 +1471,7 @@ bool CPath::DirectoryCreate(bool bCreateIntermediates /*= TRUE*/)
GetDriveDirectory(PathText);
StripTrailingBackslash(PathText);
WriteTrace(TracePath, TraceDebug, "Create %s",PathText.c_str());
bSuccess = ::CreateDirectoryA(PathText.c_str(), NULL) != 0;
bSuccess = ::CreateDirectoryA(PathText.c_str(), nullptr) != 0;
#else
GetDirectory(PathText);
StripTrailingBackslash(PathText);
@ -1608,7 +1608,7 @@ void CPath::EnsureLeadingBackslash(std::string & Directory) const
#ifndef _WIN32
bool CPath::wildcmp(const char *wild, const char *string)
{
const char *cp = NULL, *mp = NULL;
const char *cp = nullptr, *mp = nullptr;
while ((*string) && (*wild != '*'))
{

View File

@ -44,9 +44,9 @@ public:
CPath(const std::string& strPath, const char * NameExten);
CPath(const std::string& strPath, const std::string& NameExten);
CPath(DIR_CURRENT_DIRECTORY sdt, const char * NameExten = NULL);
CPath(DIR_CURRENT_DIRECTORY sdt, const char * NameExten = nullptr);
#ifdef _WIN32
CPath(DIR_MODULE_DIRECTORY sdt, const char * NameExten = NULL);
CPath(DIR_MODULE_DIRECTORY sdt, const char * NameExten = nullptr);
CPath(DIR_MODULE_FILE sdt);
#endif
virtual ~CPath();
@ -77,9 +77,9 @@ public:
std::string GetLastDirectory(void) const;
void GetFullyQualified(std::string& rFullyQualified) const;
#ifdef _WIN32
void GetComponents(std::string* pDrive = NULL, std::string* pDirectory = NULL, std::string* pName = NULL, std::string* pExtension = NULL) const;
void GetComponents(std::string* pDrive = nullptr, std::string* pDirectory = nullptr, std::string* pName = nullptr, std::string* pExtension = nullptr) const;
#else
void GetComponents(std::string* pDirectory = NULL, std::string* pName = NULL, std::string* pExtension = NULL) const;
void GetComponents(std::string* pDirectory = nullptr, std::string* pName = nullptr, std::string* pExtension = nullptr) const;
#endif
// Get other state
bool IsEmpty() const { return m_strPath.empty(); }
@ -97,7 +97,7 @@ public:
void SetExtension(const char * lpszExtension);
void SetExtension(int iExtension);
void AppendDirectory(const char * lpszSubDirectory);
void UpDirectory(std::string* pLastDirectory = NULL);
void UpDirectory(std::string* pLastDirectory = nullptr);
#ifdef _WIN32
void SetComponents(const char * lpszDrive, const char * lpszDirectory, const char * lpszName, const char * lpszExtension);
#else

View File

@ -140,7 +140,7 @@ void RegionSection(CFile &TargetIniFile, Files &files, const char * Region, cons
{
const char * Section = SectionItr->c_str();
const char * pos = strstr(Section, searchStr.c_str());
if (pos == NULL)
if (pos == nullptr)
{
continue;
}
@ -341,14 +341,14 @@ bool ConvertCheatOptions(const char * OptionValue, std::string& Options)
{
NewOptions += NewOptions.empty() ? "$" : ",$";
const char* End = strchr(ReadPos, ',');
std::string Item = End != NULL ? std::string(ReadPos, End - ReadPos) : ReadPos;
std::string Item = End != nullptr ? std::string(ReadPos, End - ReadPos) : ReadPos;
ReadPos = strchr(ReadPos, '$');
if (ReadPos != NULL)
if (ReadPos != nullptr)
{
ReadPos += 1;
}
const char* Name = strchr(Item.c_str(), ' ');
if (Name == NULL)
if (Name == nullptr)
{
return false;
}
@ -404,7 +404,7 @@ bool ConvertCheatEntry(std::string& CheatEntry, std::string& CheatOptions)
{
uint32_t CodeCommand = strtoul(ReadPos, 0, 16);
ReadPos = strchr(ReadPos, ' ');
if (ReadPos == NULL)
if (ReadPos == nullptr)
{
break;
}
@ -412,7 +412,7 @@ bool ConvertCheatEntry(std::string& CheatEntry, std::string& CheatOptions)
std::string ValueStr = ReadPos;
const char* ValuePos = ReadPos;
ReadPos = strchr(ReadPos, ',');
if (ReadPos != NULL)
if (ReadPos != nullptr)
{
ValueStr.resize(ReadPos - ValuePos);
ReadPos++;
@ -422,7 +422,7 @@ bool ConvertCheatEntry(std::string& CheatEntry, std::string& CheatOptions)
{
case 0xE8000000:
CodeCommand = (ConvertXP64Address(CodeCommand) & 0xFFFFFF) | 0x80000000;
if (strchr(ValueStr.c_str(), '?') != NULL)
if (strchr(ValueStr.c_str(), '?') != nullptr)
{
if (strncmp(ValueStr.c_str(), "????", 4) == 0)
{
@ -455,7 +455,7 @@ bool ConvertCheatEntry(std::string& CheatEntry, std::string& CheatOptions)
break;
case 0xE9000000:
CodeCommand = (ConvertXP64Address(CodeCommand) & 0xFFFFFF) | 0x81000000;
if (strchr(ValueStr.c_str(), '?') != NULL)
if (strchr(ValueStr.c_str(), '?') != nullptr)
{
if (strncmp(ValueStr.c_str(), "????", 4) == 0)
{
@ -497,7 +497,7 @@ bool ConvertCheatEntry(std::string& CheatEntry, std::string& CheatOptions)
break;
case 0x10000000:
Entries.push_back(stdstr_f("%08X %s", (CodeCommand & 0xFFFFFF) | 0x80000000, ValueStr.c_str()));
if (strchr(ValueStr.c_str(), '?') != NULL)
if (strchr(ValueStr.c_str(), '?') != nullptr)
{
if (strncmp(ValueStr.c_str(), "????", 4) == 0)
{
@ -532,7 +532,7 @@ bool ConvertCheatEntry(std::string& CheatEntry, std::string& CheatOptions)
break;
case 0x11000000:
Entries.push_back(stdstr_f("%08X %s", (CodeCommand & 0xFFFFFF) | 0x81000000, ValueStr.c_str()));
if (strchr(ValueStr.c_str(), '?') != NULL)
if (strchr(ValueStr.c_str(), '?') != nullptr)
{
if (strncmp(ValueStr.c_str(), "????", 4) == 0)
{
@ -666,7 +666,7 @@ bool ParseCheatEntry(const stdstr & CheatEntry, const stdstr& CheatOptions, CEnh
{
uint32_t CodeCommand = strtoul(ReadPos, 0, 16);
ReadPos = strchr(ReadPos, ' ');
if (ReadPos == NULL)
if (ReadPos == nullptr)
{
break;
}
@ -674,7 +674,7 @@ bool ParseCheatEntry(const stdstr & CheatEntry, const stdstr& CheatOptions, CEnh
std::string ValueStr = ReadPos;
const char * ValuePos = ReadPos;
ReadPos = strchr(ReadPos, ',');
if (ReadPos != NULL)
if (ReadPos != nullptr)
{
ValueStr.resize(ReadPos - ValuePos);
ReadPos++;
@ -697,14 +697,14 @@ bool ParseCheatEntry(const stdstr & CheatEntry, const stdstr& CheatOptions, CEnh
do
{
const char* End = strchr(ReadPos, ',');
std::string Item = End != NULL ? std::string(ReadPos, End - ReadPos) : ReadPos;
std::string Item = End != nullptr ? std::string(ReadPos, End - ReadPos) : ReadPos;
ReadPos = strchr(ReadPos, '$');
if (ReadPos != NULL)
if (ReadPos != nullptr)
{
ReadPos += 1;
}
const char* Name = strchr(Item.c_str(), ' ');
if (Name == NULL)
if (Name == nullptr)
{
return false;
}

View File

@ -38,9 +38,9 @@ bool g_romopen = false;
uint32_t g_Dacrate = 0, hack = 0;
#ifdef _WIN32
DirectSoundDriver * g_SoundDriver = NULL;
DirectSoundDriver * g_SoundDriver = nullptr;
#else
OpenSLESDriver * g_SoundDriver = NULL;
OpenSLESDriver * g_SoundDriver = nullptr;
#endif
void PluginInit(void)
@ -60,7 +60,7 @@ EXPORT void CALL PluginLoaded(void)
{
PluginInit();
WriteTrace(TraceAudioInterface, TraceDebug, "Called");
if (g_settings != NULL)
if (g_settings != nullptr)
{
g_settings->SetSyncViaAudioEnabled(true);
}
@ -138,7 +138,7 @@ EXPORT uint32_t CALL AiReadLength(void)
{
WriteTrace(TraceAudioInterface, TraceDebug, "Start");
uint32_t len = 0;
if (g_SoundDriver != NULL)
if (g_SoundDriver != nullptr)
{
*g_AudioInfo.AI_LEN_REG = g_SoundDriver->AI_ReadLength();
len = *g_AudioInfo.AI_LEN_REG;
@ -164,11 +164,11 @@ EXPORT void CALL AiUpdate(int32_t Wait)
EXPORT void CALL CloseDLL(void)
{
WriteTrace(TraceAudioInterface, TraceDebug, "Called");
if (g_SoundDriver != NULL)
if (g_SoundDriver != nullptr)
{
g_SoundDriver->AI_Shutdown();
delete g_SoundDriver;
g_SoundDriver = NULL;
g_SoundDriver = nullptr;
}
CleanupAudioSettings();
StopTrace();
@ -211,7 +211,7 @@ EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo)
EXPORT int32_t CALL InitiateAudio(AUDIO_INFO Audio_Info)
{
WriteTrace(TraceAudioInterface, TraceDebug, "Start");
if (g_SoundDriver != NULL)
if (g_SoundDriver != nullptr)
{
g_SoundDriver->AI_Shutdown();
delete g_SoundDriver;
@ -279,7 +279,7 @@ extern "C" void UseUnregisteredSetting(int /*SettingID*/)
void SetTimerResolution(void)
{
HMODULE hMod = GetModuleHandle(L"ntdll.dll");
if (hMod != NULL)
if (hMod != nullptr)
{
typedef LONG(NTAPI* tNtSetTimerResolution)(IN ULONG DesiredResolution, IN BOOLEAN SetResolution, OUT PULONG CurrentResolution);
tNtSetTimerResolution NtSetTimerResolution = (tNtSetTimerResolution)GetProcAddress(hMod, "NtSetTimerResolution");

View File

@ -3,7 +3,7 @@
#include "SettingsID.h"
#include "AudioSettings.h"
CSettings * g_settings = NULL;
CSettings * g_settings = nullptr;
CSettings::CSettings() :
m_Set_SyncViaAudioEnabled(0),
@ -80,14 +80,14 @@ void CSettings::RegisterSettings(void)
m_Set_log_dir = FindSystemSettingId("Dir:Log");
SetModuleName("Audio");
RegisterSetting(Set_Volume, Data_DWORD_General, "Volume", "Settings", 100, NULL);
RegisterSetting(Set_Logging_MD5, Data_DWORD_General, "MD5", "Logging", g_ModuleLogLevel[TraceMD5], NULL);
RegisterSetting(Set_Logging_Thread, Data_DWORD_General, "Thread", "Logging", g_ModuleLogLevel[TraceThread], NULL);
RegisterSetting(Set_Logging_Path, Data_DWORD_General, "Path", "Logging", g_ModuleLogLevel[TracePath], NULL);
RegisterSetting(Set_Logging_InitShutdown, Data_DWORD_General, "InitShutdown", "Logging", g_ModuleLogLevel[TraceAudioInitShutdown], NULL);
RegisterSetting(Set_Logging_Interface, Data_DWORD_General, "Interface", "Logging", g_ModuleLogLevel[TraceAudioInterface], NULL);
RegisterSetting(Set_Logging_Driver, Data_DWORD_General, "Driver", "Logging", g_ModuleLogLevel[TraceAudioDriver], NULL);
RegisterSetting(Set_Buffer, Data_DWORD_Game, "Buffer", "", 4, NULL);
RegisterSetting(Set_Volume, Data_DWORD_General, "Volume", "Settings", 100, nullptr);
RegisterSetting(Set_Logging_MD5, Data_DWORD_General, "MD5", "Logging", g_ModuleLogLevel[TraceMD5], nullptr);
RegisterSetting(Set_Logging_Thread, Data_DWORD_General, "Thread", "Logging", g_ModuleLogLevel[TraceThread], nullptr);
RegisterSetting(Set_Logging_Path, Data_DWORD_General, "Path", "Logging", g_ModuleLogLevel[TracePath], nullptr);
RegisterSetting(Set_Logging_InitShutdown, Data_DWORD_General, "InitShutdown", "Logging", g_ModuleLogLevel[TraceAudioInitShutdown], nullptr);
RegisterSetting(Set_Logging_Interface, Data_DWORD_General, "Interface", "Logging", g_ModuleLogLevel[TraceAudioInterface], nullptr);
RegisterSetting(Set_Logging_Driver, Data_DWORD_General, "Driver", "Logging", g_ModuleLogLevel[TraceAudioDriver], nullptr);
RegisterSetting(Set_Buffer, Data_DWORD_Game, "Buffer", "", 4, nullptr);
LogLevelChanged();
}
@ -150,7 +150,7 @@ void CSettings::ReadSettings(void)
void SetupAudioSettings(void)
{
if (g_settings == NULL)
if (g_settings == nullptr)
{
g_settings = new CSettings;
}
@ -161,6 +161,6 @@ void CleanupAudioSettings(void)
if (g_settings)
{
delete g_settings;
g_settings = NULL;
g_settings = nullptr;
}
}

View File

@ -14,10 +14,10 @@
DirectSoundDriver::DirectSoundDriver() :
m_AudioIsDone(true),
m_LOCK_SIZE(0),
m_lpds(NULL),
m_lpdsb(NULL),
m_lpdsbuf(NULL),
m_handleAudioThread(NULL),
m_lpds(nullptr),
m_lpdsb(nullptr),
m_lpdsbuf(nullptr),
m_handleAudioThread(nullptr),
m_dwAudioThreadId(0)
{
}
@ -33,7 +33,7 @@ bool DirectSoundDriver::Initialize()
CGuard guard(m_CS);
LPDIRECTSOUND8 & lpds = (LPDIRECTSOUND8 &)m_lpds;
HRESULT hr = DirectSoundCreate8(NULL, &lpds, NULL);
HRESULT hr = DirectSoundCreate8(nullptr, &lpds, nullptr);
if (FAILED(hr))
{
WriteTrace(TraceAudioDriver, TraceWarning, "Unable to DirectSoundCreate (hr: 0x%08X)", hr);
@ -53,13 +53,13 @@ bool DirectSoundDriver::Initialize()
if (lpdsbuf)
{
IDirectSoundBuffer_Release(lpdsbuf);
lpdsbuf = NULL;
lpdsbuf = nullptr;
}
DSBUFFERDESC dsPrimaryBuff = { 0 };
dsPrimaryBuff.dwSize = sizeof(DSBUFFERDESC);
dsPrimaryBuff.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRLVOLUME;
dsPrimaryBuff.dwBufferBytes = 0;
dsPrimaryBuff.lpwfxFormat = NULL;
dsPrimaryBuff.lpwfxFormat = nullptr;
WAVEFORMATEX wfm = { 0 };
wfm.wFormatTag = WAVE_FORMAT_PCM;
@ -70,7 +70,7 @@ bool DirectSoundDriver::Initialize()
wfm.nAvgBytesPerSec = wfm.nSamplesPerSec * wfm.nBlockAlign;
LPDIRECTSOUNDBUFFER & lpdsb = (LPDIRECTSOUNDBUFFER &)m_lpdsb;
hr = lpds->CreateSoundBuffer(&dsPrimaryBuff, &lpdsb, NULL);
hr = lpds->CreateSoundBuffer(&dsPrimaryBuff, &lpdsb, nullptr);
if (SUCCEEDED(hr))
{
lpdsb->SetFormat(&wfm);
@ -82,7 +82,7 @@ bool DirectSoundDriver::Initialize()
void DirectSoundDriver::StopAudio()
{
if (m_handleAudioThread != NULL)
if (m_handleAudioThread != nullptr)
{
m_AudioIsDone = true;
if (WaitForSingleObject((HANDLE)m_handleAudioThread, 5000) == WAIT_TIMEOUT)
@ -92,20 +92,20 @@ void DirectSoundDriver::StopAudio()
TerminateThread((HANDLE)m_handleAudioThread, 1);
}
CloseHandle((HANDLE)m_handleAudioThread);
m_handleAudioThread = NULL;
m_handleAudioThread = nullptr;
}
}
void DirectSoundDriver::StartAudio()
{
WriteTrace(TraceAudioDriver, TraceDebug, "Start");
if (m_handleAudioThread == NULL)
if (m_handleAudioThread == nullptr)
{
m_AudioIsDone = false;
m_handleAudioThread = CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)stAudioThreadProc, this, 0, (LPDWORD)&m_dwAudioThreadId);
m_handleAudioThread = CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)stAudioThreadProc, this, 0, (LPDWORD)&m_dwAudioThreadId);
LPDIRECTSOUNDBUFFER & lpdsbuf = (LPDIRECTSOUNDBUFFER &)m_lpdsbuf;
if (lpdsbuf != NULL)
if (lpdsbuf != nullptr)
{
lpdsbuf->Play(0, 0, DSBPLAY_LOOPING);
}
@ -132,7 +132,7 @@ void DirectSoundDriver::SetVolume(uint32_t Volume)
{
dsVolume = DSBVOLUME_MIN;
}
if (lpdsb != NULL)
if (lpdsb != nullptr)
{
lpdsb->SetVolume(dsVolume);
}
@ -159,16 +159,16 @@ void DirectSoundDriver::SetSegmentSize(uint32_t length, uint32_t SampleRate)
LPDIRECTSOUND8 & lpds = (LPDIRECTSOUND8 &)m_lpds;
LPDIRECTSOUNDBUFFER & lpdsbuf = (LPDIRECTSOUNDBUFFER &)m_lpdsbuf;
if (lpds != NULL)
if (lpds != nullptr)
{
HRESULT hr = lpds->CreateSoundBuffer(&dsbdesc, &lpdsbuf, NULL);
HRESULT hr = lpds->CreateSoundBuffer(&dsbdesc, &lpdsbuf, nullptr);
if (FAILED(hr))
{
WriteTrace(TraceAudioDriver, TraceWarning, "CreateSoundBuffer failed (hr: 0x%08X)", hr);
}
}
if (lpdsbuf != NULL)
if (lpdsbuf != nullptr)
{
lpdsbuf->Play(0, 0, DSBPLAY_LOOPING);
}
@ -177,7 +177,7 @@ void DirectSoundDriver::SetSegmentSize(uint32_t length, uint32_t SampleRate)
void DirectSoundDriver::AudioThreadProc()
{
LPDIRECTSOUNDBUFFER & lpdsbuff = (LPDIRECTSOUNDBUFFER &)m_lpdsbuf;
while (lpdsbuff == NULL && !m_AudioIsDone)
while (lpdsbuff == nullptr && !m_AudioIsDone)
{
Sleep(10);
}
@ -196,17 +196,17 @@ void DirectSoundDriver::AudioThreadProc()
}
uint32_t next_pos = 0, write_pos = 0, last_pos = 0;
while (lpdsbuff != NULL && !m_AudioIsDone)
while (lpdsbuff != nullptr && !m_AudioIsDone)
{
WriteTrace(TraceAudioDriver, TraceVerbose, "last_pos: 0x%08X write_pos: 0x%08X next_pos: 0x%08X", last_pos, write_pos, next_pos);
while (last_pos == write_pos)
{ // Cycle around until a new buffer position is available
if (lpdsbuff == NULL)
if (lpdsbuff == nullptr)
{
break;
}
uint32_t play_pos = 0;
if (lpdsbuff == NULL || FAILED(lpdsbuff->GetCurrentPosition((unsigned long*)&play_pos, NULL)))
if (lpdsbuff == nullptr || FAILED(lpdsbuff->GetCurrentPosition((unsigned long*)&play_pos, nullptr)))
{
WriteTrace(TraceAudioDriver, TraceDebug, "Error getting audio position...");
m_AudioIsDone = true;

View File

@ -52,13 +52,13 @@ enum
};
/* Pointer to the primary audio buffer */
uint8_t * g_primaryBuffer = NULL;
uint8_t * g_primaryBuffer = nullptr;
/* Size of the primary buffer */
uint32_t g_primaryBufferBytes = 0;
/* Pointer to secondary buffers */
uint8_t ** g_secondaryBuffers = NULL;
uint8_t ** g_secondaryBuffers = nullptr;
/* Size of a single secondary buffer */
uint32_t g_secondaryBufferBytes = 0;
@ -86,18 +86,18 @@ bool g_critical_failure = false;
threadLock g_lock;
/* Engine interfaces */
SLObjectItf g_engineObject = NULL;
SLEngineItf g_engineEngine = NULL;
SLObjectItf g_engineObject = nullptr;
SLEngineItf g_engineEngine = nullptr;
/* Output mix interfaces */
SLObjectItf g_outputMixObject = NULL;
SLObjectItf g_outputMixObject = nullptr;
/* Player interfaces */
SLObjectItf g_playerObject = NULL;
SLPlayItf g_playerPlay = NULL;
SLObjectItf g_playerObject = nullptr;
SLPlayItf g_playerPlay = nullptr;
/* Buffer queue interfaces */
SLAndroidSimpleBufferQueueItf g_bufferQueue = NULL;
SLAndroidSimpleBufferQueueItf g_bufferQueue = nullptr;
#endif
static bool CreatePrimaryBuffer(void)
@ -109,9 +109,9 @@ static bool CreatePrimaryBuffer(void)
g_primaryBuffer = new uint8_t[primaryBytes];
if (g_primaryBuffer == NULL)
if (g_primaryBuffer == nullptr)
{
WriteTrace(TraceAudioInitShutdown, TraceError, "g_primaryBuffer == NULL");
WriteTrace(TraceAudioInitShutdown, TraceError, "g_primaryBuffer == nullptr");
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Done (res: false)");
return false;
}
@ -129,34 +129,34 @@ static void CloseAudio(void)
g_secondaryBufferIndex = 0;
/* Delete Primary buffer */
if (g_primaryBuffer != NULL)
if (g_primaryBuffer != nullptr)
{
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Delete g_primaryBuffer (%p)", g_primaryBuffer);
g_primaryBufferBytes = 0;
delete[] g_primaryBuffer;
g_primaryBuffer = NULL;
g_primaryBuffer = nullptr;
}
/* Delete Secondary buffers */
if (g_secondaryBuffers != NULL)
if (g_secondaryBuffers != nullptr)
{
for (uint32_t i = 0; i < SECONDARY_BUFFER_NBR; i++)
{
if (g_secondaryBuffers[i] != NULL)
if (g_secondaryBuffers[i] != nullptr)
{
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Delete g_secondaryBuffers[%d] (%p)", i, g_secondaryBuffers[i]);
delete[] g_secondaryBuffers[i];
g_secondaryBuffers[i] = NULL;
g_secondaryBuffers[i] = nullptr;
}
}
g_secondaryBufferBytes = 0;
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Delete g_secondaryBuffers (%p)", g_secondaryBuffers);
delete[] g_secondaryBuffers;
g_secondaryBuffers = NULL;
g_secondaryBuffers = nullptr;
}
#ifdef ANDROID
/* Destroy buffer queue audio player object, and invalidate all associated interfaces */
if (g_playerObject != NULL)
if (g_playerObject != nullptr)
{
SLuint32 state = SL_PLAYSTATE_PLAYING;
(*g_playerPlay)->SetPlayState(g_playerPlay, SL_PLAYSTATE_STOPPED);
@ -167,24 +167,24 @@ static void CloseAudio(void)
}
(*g_playerObject)->Destroy(g_playerObject);
g_playerObject = NULL;
g_playerPlay = NULL;
g_bufferQueue = NULL;
g_playerObject = nullptr;
g_playerPlay = nullptr;
g_bufferQueue = nullptr;
}
/* Destroy output mix object, and invalidate all associated interfaces */
if (g_outputMixObject != NULL)
if (g_outputMixObject != nullptr)
{
(*g_outputMixObject)->Destroy(g_outputMixObject);
g_outputMixObject = NULL;
g_outputMixObject = nullptr;
}
/* Destroy engine object, and invalidate all associated interfaces */
if (g_engineObject != NULL)
if (g_engineObject != nullptr)
{
(*g_engineObject)->Destroy(g_engineObject);
g_engineObject = NULL;
g_engineEngine = NULL;
g_engineObject = nullptr;
g_engineEngine = nullptr;
}
/* Destroy thread Locks */
@ -207,9 +207,9 @@ static bool CreateSecondaryBuffers(void)
/* Allocate number of secondary buffers */
g_secondaryBuffers = new uint8_t *[SECONDARY_BUFFER_NBR];
if (g_secondaryBuffers == NULL)
if (g_secondaryBuffers == nullptr)
{
WriteTrace(TraceAudioInitShutdown, TraceError, "g_secondaryBuffers == NULL");
WriteTrace(TraceAudioInitShutdown, TraceError, "g_secondaryBuffers == nullptr");
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Done (res: false)");
return false;
}
@ -219,7 +219,7 @@ static bool CreateSecondaryBuffers(void)
{
g_secondaryBuffers[i] = new uint8_t[secondaryBytes];
if (g_secondaryBuffers[i] == NULL)
if (g_secondaryBuffers[i] == nullptr)
{
status = false;
break;
@ -243,10 +243,10 @@ static int resample(unsigned char *input, int /*input_avail*/, int oldsamplerate
spx_uint32_t in_len, out_len;
if (Resample == RESAMPLER_SPEEX)
{
if (spx_state == NULL)
if (spx_state == nullptr)
{
spx_state = speex_resampler_init(2, oldsamplerate, newsamplerate, ResampleQuality, &error);
if (spx_state == NULL)
if (spx_state == nullptr)
{
memset(output, 0, output_needed);
return 0;
@ -284,10 +284,10 @@ static int resample(unsigned char *input, int /*input_avail*/, int oldsamplerate
}
memset(_src, 0, _src_len);
memset(_dest, 0, _dest_len);
if (src_state == NULL)
if (src_state == nullptr)
{
src_state = src_new(ResampleQuality, 2, &error);
if (src_state == NULL)
if (src_state == nullptr)
{
memset(output, 0, output_needed);
return 0;
@ -365,7 +365,7 @@ void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize)
return;
}
if (g_GameFreq == freq && g_primaryBuffer != NULL)
if (g_GameFreq == freq && g_primaryBuffer != nullptr)
{
WriteTrace(TraceAudioInitShutdown, TraceInfo, "we are already using this frequency, so ignore it (freq: %d)", freq);
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Done");
@ -433,7 +433,7 @@ void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize)
#ifdef ANDROID
/* Create thread Locks to ensure synchronization between callback and processing code */
if (pthread_mutex_init(&(g_lock.mutex), (pthread_mutexattr_t*)NULL) != 0)
if (pthread_mutex_init(&(g_lock.mutex), (pthread_mutexattr_t*)nullptr) != 0)
{
WriteTrace(TraceAudioInitShutdown, TraceError, "pthread_mutex_init failed");
CloseAudio();
@ -441,7 +441,7 @@ void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize)
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Done");
return;
}
if (pthread_cond_init(&(g_lock.cond), (pthread_condattr_t*)NULL) != 0)
if (pthread_cond_init(&(g_lock.cond), (pthread_condattr_t*)nullptr) != 0)
{
WriteTrace(TraceAudioInitShutdown, TraceError, "pthread_cond_init failed");
CloseAudio();
@ -454,7 +454,7 @@ void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize)
pthread_mutex_unlock(&(g_lock.mutex));
/* Engine object */
SLresult result = slCreateEngine(&g_engineObject, 0, NULL, 0, NULL, NULL);
SLresult result = slCreateEngine(&g_engineObject, 0, nullptr, 0, nullptr, nullptr);
if (result != SL_RESULT_SUCCESS)
{
WriteTrace(TraceAudioInitShutdown, TraceError, "slCreateEngine failed (result: %d)", result);
@ -481,7 +481,7 @@ void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize)
if (result == SL_RESULT_SUCCESS)
{
/* Output mix object */
result = (*g_engineEngine)->CreateOutputMix(g_engineEngine, &g_outputMixObject, 0, NULL, NULL);
result = (*g_engineEngine)->CreateOutputMix(g_engineEngine, &g_outputMixObject, 0, nullptr, nullptr);
if (result != SL_RESULT_SUCCESS)
{
WriteTrace(TraceAudioInitShutdown, TraceError, "slCreateEngine->CreateOutputMix failed (result: %d)", result);
@ -508,7 +508,7 @@ void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize)
/* Configure audio sink */
SLDataLocator_OutputMix loc_outmix = { SL_DATALOCATOR_OUTPUTMIX, g_outputMixObject };
SLDataSink audioSnk = { &loc_outmix, NULL };
SLDataSink audioSnk = { &loc_outmix, nullptr };
/* Create audio player */
const SLInterfaceID ids1[] = { SL_IID_ANDROIDSIMPLEBUFFERQUEUE };

View File

@ -12,8 +12,8 @@
SoundDriverBase::SoundDriverBase() :
m_MaxBufferSize(MAX_SIZE),
m_AI_DMAPrimaryBuffer(NULL),
m_AI_DMASecondaryBuffer(NULL),
m_AI_DMAPrimaryBuffer(nullptr),
m_AI_DMASecondaryBuffer(nullptr),
m_AI_DMAPrimaryBytes(0),
m_AI_DMASecondaryBytes(0),
m_CurrentReadLoc(0),
@ -51,7 +51,7 @@ void SoundDriverBase::AI_LenChanged(uint8_t *start, uint32_t length)
CGuard guard(m_CS);
BufferAudio();
if (m_AI_DMASecondaryBuffer != NULL)
if (m_AI_DMASecondaryBuffer != nullptr)
{
WriteTrace(TraceAudioDriver, TraceDebug, "Discarding previous secondary buffer");
}
@ -60,7 +60,7 @@ void SoundDriverBase::AI_LenChanged(uint8_t *start, uint32_t length)
if (m_AI_DMAPrimaryBytes == 0)
{
m_AI_DMAPrimaryBuffer = m_AI_DMASecondaryBuffer;
m_AI_DMASecondaryBuffer = NULL;
m_AI_DMASecondaryBuffer = nullptr;
m_AI_DMAPrimaryBytes = m_AI_DMASecondaryBytes;
m_AI_DMASecondaryBytes = 0;
}
@ -78,7 +78,7 @@ void SoundDriverBase::AI_Startup()
{
WriteTrace(TraceAudioDriver, TraceDebug, "Start");
m_AI_DMAPrimaryBytes = m_AI_DMASecondaryBytes = 0;
m_AI_DMAPrimaryBuffer = m_AI_DMASecondaryBuffer = NULL;
m_AI_DMAPrimaryBuffer = m_AI_DMASecondaryBuffer = nullptr;
m_MaxBufferSize = MAX_SIZE;
m_CurrentReadLoc = m_CurrentWriteLoc = m_BufferRemaining = 0;
if (Initialize())
@ -107,7 +107,7 @@ uint32_t SoundDriverBase::AI_ReadLength()
void SoundDriverBase::LoadAiBuffer(uint8_t *start, uint32_t length)
{
static uint8_t nullBuff[MAX_SIZE];
uint8_t *ptrStart = start != NULL ? start : nullBuff;
uint8_t *ptrStart = start != nullptr ? start : nullBuff;
uint32_t writePtr = 0, bytesToMove = length;
if (bytesToMove > m_MaxBufferSize)
@ -166,7 +166,7 @@ void SoundDriverBase::BufferAudio()
{
WriteTrace(TraceAudioDriver, TraceVerbose, "Emptied Primary Buffer");
m_AI_DMAPrimaryBytes = m_AI_DMASecondaryBytes; m_AI_DMAPrimaryBuffer = m_AI_DMASecondaryBuffer; // Switch
m_AI_DMASecondaryBytes = 0; m_AI_DMASecondaryBuffer = NULL;
m_AI_DMASecondaryBytes = 0; m_AI_DMASecondaryBuffer = nullptr;
*g_AudioInfo.AI_STATUS_REG = AI_STATUS_DMA_BUSY;
*g_AudioInfo.AI_STATUS_REG &= ~AI_STATUS_FIFO_FULL;
*g_AudioInfo.MI_INTR_REG |= MI_INTR_AI;

View File

@ -26,19 +26,19 @@ class AndroidLogger : public CTraceModule
{
}
};
static AndroidLogger * g_AndroidLogger = NULL;
static AndroidLogger * g_AndroidLogger = nullptr;
#endif
static CTraceFileLog * g_LogFile = NULL;
static CTraceFileLog * g_LogFile = nullptr;
void SetupTrace(void)
{
if (g_LogFile != NULL)
if (g_LogFile != nullptr)
{
return;
}
#ifdef ANDROID
if (g_AndroidLogger == NULL)
if (g_AndroidLogger == nullptr)
{
g_AndroidLogger = new AndroidLogger();
}
@ -56,8 +56,8 @@ void SetupTrace(void)
void StartTrace(void)
{
const char * log_dir = g_settings ? g_settings->log_dir() : NULL;
if (log_dir == NULL || log_dir[0] == '\0')
const char * log_dir = g_settings ? g_settings->log_dir() : nullptr;
if (log_dir == nullptr || log_dir[0] == '\0')
{
return;
}
@ -77,6 +77,6 @@ void StopTrace(void)
{
TraceRemoveModule(g_LogFile);
delete g_LogFile;
g_LogFile = NULL;
g_LogFile = nullptr;
}
}

View File

@ -14,8 +14,8 @@ m_blockIndex(0xFFFFFFFF),
m_outBuffer(0),
m_outBufferSize(0),
m_NotfyCallback(NotfyCallbackDefault),
m_NotfyCallbackInfo(NULL),
m_db(NULL),
m_NotfyCallbackInfo(nullptr),
m_db(nullptr),
m_Opened(false)
{
memset(&m_FileName, 0, sizeof(m_FileName));
@ -39,7 +39,7 @@ m_Opened(false)
//PrintError("can not open input file");
return;
}
m_FileSize = GetFileSize(m_archiveStream.file.handle, NULL);
m_FileSize = GetFileSize(m_archiveStream.file.handle, nullptr);
char drive[_MAX_DRIVE], dir[_MAX_DIR], ext[_MAX_EXT];
_splitpath(FileName, drive, dir, m_FileName, ext);
@ -59,7 +59,7 @@ m_Opened(false)
else
{
//SzArEx_Open will delete the passed db if it fails
m_db = NULL;
m_db = nullptr;
}
}
@ -68,10 +68,10 @@ C7zip::~C7zip(void)
if (m_db)
{
delete m_db;
m_db = NULL;
m_db = nullptr;
}
#ifdef legacycode
SetNotificationCallback(NULL,NULL);
SetNotificationCallback(nullptr,nullptr);
SzArDbExFree(&m_db, m_allocImp.Free);
if (m_archiveStream.File)
@ -94,7 +94,7 @@ void C7zip::SetNotificationCallback(LP7ZNOTIFICATION NotfyFnc, void * CBInfo)
#ifdef legacycode
void C7zip::StatusUpdate(_7Z_STATUS status, int Value1, int Value2, C7zip * _this )
{
CFileItem * File = _this->m_CurrentFile >= 0 ? _this->FileItem(_this->m_CurrentFile) : NULL;
CFileItem * File = _this->m_CurrentFile >= 0 ? _this->FileItem(_this->m_CurrentFile) : nullptr;
switch (status)
{
@ -114,7 +114,7 @@ void C7zip::StatusUpdate(_7Z_STATUS status, int Value1, int Value2, C7zip * _thi
bool C7zip::GetFile(int index, Byte * Data, size_t DataLen)
{
m_CurrentFile = -1;
if (Data == NULL || DataLen == 0)
if (Data == nullptr || DataLen == 0)
{
return false;
}
@ -160,7 +160,7 @@ void * C7zip::AllocAllocImp(void * /*p*/, size_t size)
void C7zip::AllocFreeImp(void * /*p*/, void *address)
{
if (address != NULL)
if (address != nullptr)
{
free(address);
}
@ -170,7 +170,7 @@ SRes C7zip::SzFileReadImp(void *object, void *buffer, size_t *processedSize)
{
CFileInStream *p = (CFileInStream *)object;
DWORD dwRead;
if (!ReadFile(p->file.handle, buffer, *processedSize, &dwRead, NULL))
if (!ReadFile(p->file.handle, buffer, *processedSize, &dwRead, nullptr))
{
return SZ_ERROR_FAIL;
}
@ -198,7 +198,7 @@ SRes C7zip::SzFileSeekImp(void *p, Int64 *pos, ESzSeek origin)
default:
return SZ_ERROR_FAIL;
}
*pos = SetFilePointer(s->file.handle, (LONG)*pos, NULL, dwMoveMethod);
*pos = SetFilePointer(s->file.handle, (LONG)*pos, nullptr, dwMoveMethod);
if (*pos == INVALID_SET_FILE_POINTER)
{
return SZ_ERROR_FAIL;
@ -208,9 +208,9 @@ SRes C7zip::SzFileSeekImp(void *p, Int64 *pos, ESzSeek origin)
const char * C7zip::FileName(char * FileName, int SizeOfFileName) const
{
if (FileName == NULL)
if (FileName == nullptr)
{
return NULL;
return nullptr;
}
int Len = strlen(m_FileName);
if (Len > (SizeOfFileName - 1))
@ -225,12 +225,12 @@ const char * C7zip::FileName(char * FileName, int SizeOfFileName) const
std::wstring C7zip::FileNameIndex(int index)
{
std::wstring filename;
if (m_db == NULL || m_db->FileNameOffsets == 0)
if (m_db == nullptr || m_db->FileNameOffsets == 0)
{
/* no filename */
return filename;
}
int namelen = SzArEx_GetFileNameUtf16(m_db, index, NULL);
int namelen = SzArEx_GetFileNameUtf16(m_db, index, nullptr);
if (namelen <= 0)
{
/* no filename */

View File

@ -24,7 +24,7 @@ public:
typedef void (*LP7ZNOTIFICATION)(const char * Status, void * CBInfo);
inline int NumFiles(void) const { return m_db ? m_db->db.NumFiles : 0; }
inline CSzFileItem * FileItem(int index) const { return m_db ? &m_db->db.Files[index] : NULL; }
inline CSzFileItem * FileItem(int index) const { return m_db ? &m_db->db.Files[index] : nullptr; }
inline int FileSize(void) const { return m_FileSize; }
inline bool OpenSuccess(void) const { return m_Opened; }

View File

@ -19,7 +19,7 @@ void SetTraceModuleNames(void);
static void IncreaseThreadPriority(void);
#endif
static CTraceFileLog * g_LogFile = NULL;
static CTraceFileLog * g_LogFile = nullptr;
void LogFlushChanged(CTraceFileLog * LogFile)
{
@ -104,30 +104,30 @@ void SetupTrace(void)
{
AddLogModule();
g_Settings->RegisterChangeCB(Debugger_TraceMD5, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceThread, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TracePath, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceSettings, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceUnknown, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceAppInit, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceAppCleanup, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceN64System, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TracePlugins, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceGFXPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceAudioPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceControllerPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRSPPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRSP, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceAudio, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRegisterCache, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRecompiler, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceTLB, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceProtectedMEM, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceUserInterface, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRomList, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceExceptionHandler, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceMD5, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceThread, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TracePath, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceSettings, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceUnknown, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceAppInit, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceAppCleanup, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceN64System, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TracePlugins, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceGFXPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceAudioPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceControllerPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRSPPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRSP, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceAudio, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRegisterCache, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRecompiler, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceTLB, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceProtectedMEM, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceUserInterface, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRomList, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceExceptionHandler, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
UpdateTraceLevel(NULL);
UpdateTraceLevel(nullptr);
WriteTrace(TraceAppInit, TraceInfo, "Application Starting %s", VER_FILE_VERSION_STR);
}
@ -136,35 +136,35 @@ void CleanupTrace(void)
{
WriteTrace(TraceAppCleanup, TraceDebug, "Done");
g_Settings->UnregisterChangeCB(Debugger_TraceMD5, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceThread, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TracePath, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceSettings, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceUnknown, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceAppInit, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceAppCleanup, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceN64System, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TracePlugins, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceGFXPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceAudioPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceControllerPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRSPPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRSP, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceAudio, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRegisterCache, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRecompiler, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceTLB, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceProtectedMEM, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceUserInterface, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRomList, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceExceptionHandler, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceMD5, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceThread, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TracePath, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceSettings, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceUnknown, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceAppInit, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceAppCleanup, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceN64System, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TracePlugins, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceGFXPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceAudioPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceControllerPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRSPPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRSP, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceAudio, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRegisterCache, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRecompiler, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceTLB, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceProtectedMEM, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceUserInterface, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRomList, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceExceptionHandler, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
}
void TraceDone(void)
{
CloseTrace();
if (g_LogFile) { delete g_LogFile; g_LogFile = NULL; }
if (g_LogFile) { delete g_LogFile; g_LogFile = nullptr; }
}
const char * AppName(void)
@ -220,7 +220,7 @@ bool AppInit(CNotification * Notify, const char * BaseDirectory, int argc, char
g_Notify = Notify;
InitializeLog();
WriteTrace(TraceAppInit, TraceDebug, "Starting (BaseDirectory: %s)", BaseDirectory ? BaseDirectory : "null");
if (Notify == NULL)
if (Notify == nullptr)
{
WriteTrace(TraceAppInit, TraceError, "No Notification class passed");
return false;
@ -283,13 +283,13 @@ void AppCleanup(void)
WriteTrace(TraceAppCleanup, TraceDebug, "cleaning up global objects");
CleanupTrace();
if (g_Enhancements) { delete g_Enhancements; g_Enhancements = NULL; }
if (g_Rom) { delete g_Rom; g_Rom = NULL; }
if (g_DDRom) { delete g_DDRom; g_DDRom = NULL; }
if (g_Disk) { delete g_Disk; g_Disk = NULL; }
if (g_Plugins) { delete g_Plugins; g_Plugins = NULL; }
if (g_Settings) { delete g_Settings; g_Settings = NULL; }
if (g_Lang) { delete g_Lang; g_Lang = NULL; }
if (g_Enhancements) { delete g_Enhancements; g_Enhancements = nullptr; }
if (g_Rom) { delete g_Rom; g_Rom = nullptr; }
if (g_DDRom) { delete g_DDRom; g_DDRom = nullptr; }
if (g_Disk) { delete g_Disk; g_Disk = nullptr; }
if (g_Plugins) { delete g_Plugins; g_Plugins = nullptr; }
if (g_Settings) { delete g_Settings; g_Settings = nullptr; }
if (g_Lang) { delete g_Lang; g_Lang = nullptr; }
CMipsMemoryVM::FreeReservedMemory();
TraceDone();

View File

@ -9,7 +9,7 @@
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
#include <Project64-core/N64System/N64RomClass.h>
CFile * CLogging::m_hLogFile = NULL;
CFile * CLogging::m_hLogFile = nullptr;
void CLogging::Log_LW(uint32_t PC, uint32_t VAddr)
{
@ -578,7 +578,7 @@ void CLogging::LogMessage(const char * Message, ...)
{
return;
}
if (m_hLogFile == NULL)
if (m_hLogFile == nullptr)
{
return;
}
@ -599,7 +599,7 @@ void CLogging::StartLog(void)
StopLog();
return;
}
if (m_hLogFile != NULL)
if (m_hLogFile != nullptr)
{
return;
}
@ -613,6 +613,6 @@ void CLogging::StopLog(void)
if (m_hLogFile)
{
delete m_hLogFile;
m_hLogFile = NULL;
m_hLogFile = nullptr;
}
}

View File

@ -18,9 +18,9 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
WriteTrace(TraceExceptionHandler, TraceVerbose, "MemAddress: %X", MemAddress);
uint32_t * Reg;
if (g_MMU == NULL)
if (g_MMU == nullptr)
{
WriteTrace(TraceExceptionHandler, TraceError, "g_MMU == NULL");
WriteTrace(TraceExceptionHandler, TraceError, "g_MMU == nullptr");
g_Notify->BreakPoint(__FILE__, __LINE__);
return false;
}
@ -38,7 +38,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
uint8_t * TypePos = (uint8_t *)*(context.Eip);
WriteTrace(TraceExceptionHandler, TraceVerbose, "TypePos[0] = %02X TypePos[1] = %02X", TypePos[0], TypePos[2]);
Reg = NULL;
Reg = nullptr;
if (*TypePos == 0xF3 && (*(TypePos + 1) == 0xA4 || *(TypePos + 1) == 0xA5))
{
uint32_t Start = (*context.Edi - (uint32_t)g_MMU->m_RDRAM);
@ -169,7 +169,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
return false;
}
if (Reg == NULL)
if (Reg == nullptr)
{
if (HaveDebugger())
{
@ -764,7 +764,7 @@ bool CMipsMemoryVM::SetupSegvHandler(void)
struct sigaction sig_act;
sig_act.sa_flags = SA_SIGINFO | SA_RESTART;
sig_act.sa_sigaction = segv_handler;
return sigaction(SIGSEGV, &sig_act, NULL) == 0;
return sigaction(SIGSEGV, &sig_act, nullptr) == 0;
}
void CMipsMemoryVM::segv_handler(int signal, siginfo_t *siginfo, void *sigcontext)
@ -826,7 +826,7 @@ void CMipsMemoryVM::segv_handler(int signal, siginfo_t *siginfo, void *sigcontex
int32_t CMipsMemoryVM::MemoryFilter(uint32_t dwExptCode, void * lpExceptionPointer)
{
#if defined(_M_IX86) && defined(_WIN32)
if (dwExptCode != EXCEPTION_ACCESS_VIOLATION || g_MMU == NULL)
if (dwExptCode != EXCEPTION_ACCESS_VIOLATION || g_MMU == nullptr)
{
if (HaveDebugger())
{

View File

@ -3,7 +3,7 @@
#include <stdint.h>
#include <Common/path.h>
CLanguage * g_Lang = NULL;
CLanguage * g_Lang = nullptr;
void CLanguage::LoadDefaultStrings(void)
{
@ -646,7 +646,7 @@ bool CLanguage::LoadCurrentStrings(void)
//Process the file
FILE *file = fopen(Filename.c_str(), "rb");
if (file == NULL)
if (file == nullptr)
{
return false;
}
@ -732,7 +732,7 @@ const std::string & CLanguage::GetString(LanguageStringID StringID)
std::string CLanguage::GetLangString(const char * FileName, LanguageStringID ID)
{
FILE *file = fopen(FileName, "rb");
if (file == NULL)
if (file == nullptr)
{
return "";
}

View File

@ -21,7 +21,7 @@ void CN64System::StartEmulationThread(CThread * thread)
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
}
CoInitialize(NULL);
CoInitialize(nullptr);
EmulationStarting(thread);
@ -35,7 +35,7 @@ void CN64System::StartEmulationThread(CThread * thread)
void CN64System::CloseCpu()
{
WriteTrace(TraceN64System, TraceDebug, "Start");
if (m_thread == NULL)
if (m_thread == nullptr)
{
return;
}
@ -56,10 +56,10 @@ void CN64System::CloseCpu()
}
CThread * hThread = m_thread;
m_thread = NULL;
m_thread = nullptr;
for (int count = 0; count < 200; count++)
{
if (hThread == NULL || !hThread->isRunning())
if (hThread == nullptr || !hThread->isRunning())
{
WriteTrace(TraceN64System, TraceDebug, "Thread no longer running");
break;

View File

@ -268,14 +268,14 @@ CEnhancement::CEnhancement(const char * Ident, const char * Entry) :
void CEnhancement::SetName(const char * Name)
{
std::string NewName = stdstr(Name != NULL ? Name : "").Trim("\t ,");
std::string NewName = stdstr(Name != nullptr ? Name : "").Trim("\t ,");
if (NewName == m_Name)
{
return;
}
CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str(), m_OnByDefault).Delete();
CSettingEnhancementSelectedOption(m_Name.c_str(), m_Ident.c_str()).Delete();
m_Name = stdstr(Name != NULL ? Name : "").Trim("\t ,");
m_Name = stdstr(Name != nullptr ? Name : "").Trim("\t ,");
m_NameAndExtension = m_Name;
if (m_Active != m_OnByDefault) { CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str(), m_OnByDefault).SetActive(m_OnByDefault); }
if (OptionSelected()) { CSettingEnhancementSelectedOption(m_Name.c_str(), m_Ident.c_str()).SetOption(SelectedOption()); }
@ -284,7 +284,7 @@ void CEnhancement::SetName(const char * Name)
void CEnhancement::SetNote(const char * Note)
{
m_Note = Note != NULL ? Note : "";
m_Note = Note != nullptr ? Note : "";
}
void CEnhancement::SetEntries(const CodeEntries & Entries)
@ -372,7 +372,7 @@ void CEnhancement::CheckValid(void)
case 0xD1000000:
case 0xD2000000:
case 0xD3000000:
if (strchr(itr->Value.c_str(), '?') != NULL)
if (strchr(itr->Value.c_str(), '?') != nullptr)
{
if (strncmp(itr->Value.c_str(), "????", 4) == 0)
{
@ -408,7 +408,7 @@ void CEnhancement::CheckValid(void)
}
break;
case 0x50000000:
if (strchr(itr->Value.c_str(), '?') != NULL)
if (strchr(itr->Value.c_str(), '?') != nullptr)
{
return;
}

View File

@ -164,7 +164,7 @@ bool CEnhancmentFile::MoveToSection(const char * Section, bool ChangeCurrentSect
}
std::unique_ptr<char> Data;
char *Input = NULL;
char *Input = nullptr;
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
FILELOC_ITR iter = m_SectionsPos.find(std::string(Section));
@ -385,7 +385,7 @@ void CEnhancmentFile::SaveCurrentSection(void)
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
std::unique_ptr<char> Data;
char *Input = NULL;
char *Input = nullptr;
//Skip first line as it is the section name
int StartPos = m_CurrentSectionFilePos;
@ -460,7 +460,7 @@ int CEnhancmentFile::GetStringFromFile(char * & String, std::unique_ptr<char> &
//Increase buffer size
int NewMaxDataSize = MaxDataSize + BufferIncrease;
char * NewBuffer = new char[NewMaxDataSize];
if (NewBuffer == NULL)
if (NewBuffer == nullptr)
{
return -1;
}
@ -492,10 +492,10 @@ const char * CEnhancmentFile::CleanLine(char * Line)
char * Pos = Line;
//Remove any comment from the line
while (Pos != NULL)
while (Pos != nullptr)
{
Pos = strchr(Pos, '/');
if (Pos != NULL)
if (Pos != nullptr)
{
if (Pos[1] == '/')
{

View File

@ -322,22 +322,22 @@ void CEnhancements::LoadActive(CEnhancementList & List, CPlugins * Plugins)
for (size_t i = 0, n = PluginList.size(); i < n; i++)
{
std::string PluginName = stdstr(PluginList[i]).Trim();
if (Plugins->Gfx() != NULL && strstr(Plugins->Gfx()->PluginName(), PluginName.c_str()) != nullptr)
if (Plugins->Gfx() != nullptr && strstr(Plugins->Gfx()->PluginName(), PluginName.c_str()) != nullptr)
{
LoadEntry = true;
break;
}
if (Plugins->Audio() != NULL && strstr(Plugins->Audio()->PluginName(), PluginName.c_str()) != nullptr)
if (Plugins->Audio() != nullptr && strstr(Plugins->Audio()->PluginName(), PluginName.c_str()) != nullptr)
{
LoadEntry = true;
break;
}
if (Plugins->RSP() != NULL && strstr(Plugins->RSP()->PluginName(), PluginName.c_str()) != nullptr)
if (Plugins->RSP() != nullptr && strstr(Plugins->RSP()->PluginName(), PluginName.c_str()) != nullptr)
{
LoadEntry = true;
break;
}
if (Plugins->Control() != NULL && strstr(Plugins->Control()->PluginName(), PluginName.c_str()) != nullptr)
if (Plugins->Control() != nullptr && strstr(Plugins->Control()->PluginName(), PluginName.c_str()) != nullptr)
{
LoadEntry = true;
break;

View File

@ -11,7 +11,7 @@
#include <Project64-core/ExceptionHandler.h>
#include <Project64-core/Debugger.h>
R4300iOp::Func * CInterpreterCPU::m_R4300i_Opcode = NULL;
R4300iOp::Func * CInterpreterCPU::m_R4300i_Opcode = nullptr;
void ExecuteInterpreterOps(uint32_t /*Cycles*/)
{
@ -242,7 +242,7 @@ void CInterpreterCPU::InPermLoop()
(g_Reg->STATUS_REGISTER & STATUS_ERL) != 0 ||
(g_Reg->STATUS_REGISTER & 0xFF00) == 0)
{
if (g_Plugins->Gfx()->UpdateScreen != NULL)
if (g_Plugins->Gfx()->UpdateScreen != nullptr)
{
g_Plugins->Gfx()->UpdateScreen();
}

View File

@ -3042,7 +3042,7 @@ void R4300iOp::UnknownOpcode()
strcat(Message, "\n\nDo you wish to enter the debugger ?");
response = MessageBox(NULL, Message, GS(MSG_MSGBOX_ERROR_TITLE), MB_YESNO | MB_ICONERROR);
response = MessageBox(nullptr, Message, GS(MSG_MSGBOX_ERROR_TITLE), MB_YESNO | MB_ICONERROR);
if (response == IDYES)
{
Enter_R4300i_Commands_Window();

View File

@ -82,7 +82,7 @@ void CAudio::LenChanged()
m_Status = 0;
}
if (g_Plugins->Audio()->AiLenChanged != NULL)
if (g_Plugins->Audio()->AiLenChanged != nullptr)
{
WriteTrace(TraceAudio, TraceDebug, "Calling plugin AiLenChanged");
g_Plugins->Audio()->AiLenChanged();

View File

@ -79,7 +79,7 @@ void DiskCommand()
g_Reg->ASIC_STATUS &= ~DD_STATUS_DISK_CHNG;
//F-Zero X + Expansion Kit fix so it doesn't enable "swapping" at boot
dd_swapdelay = 0;
if (g_Disk != NULL)
if (g_Disk != nullptr)
g_Reg->ASIC_STATUS |= DD_STATUS_DISK_PRES;
break;
case 0x00120000:
@ -181,7 +181,7 @@ void DiskReset(void)
WriteTrace(TraceN64System, TraceDebug, "DD RESET");
g_Reg->ASIC_STATUS |= DD_STATUS_RST_STATE;
dd_swapdelay = 0;
if (g_Disk != NULL)
if (g_Disk != nullptr)
g_Reg->ASIC_STATUS |= DD_STATUS_DISK_PRES;
}
@ -246,7 +246,7 @@ void DiskGapSectorCheck()
}
//Delay Disk Swapping by removing the disk for a certain amount of time, then insert the newly loaded disk (after 50 Status Register reads, here).
if (!(g_Reg->ASIC_STATUS & DD_STATUS_DISK_PRES) && g_Disk != NULL && g_Settings->LoadBool(GameRunning_LoadingInProgress) == false)
if (!(g_Reg->ASIC_STATUS & DD_STATUS_DISK_PRES) && g_Disk != nullptr && g_Settings->LoadBool(GameRunning_LoadingInProgress) == false)
{
dd_swapdelay++;
if (dd_swapdelay >= 50)

View File

@ -5,7 +5,7 @@
#include <Common/path.h>
CFlashram::CFlashram(bool ReadOnly) :
m_FlashRamPointer(NULL),
m_FlashRamPointer(nullptr),
m_FlashFlag(FLASHRAM_MODE_NOPES),
m_FlashStatus(0),
m_FlashRAM_Offset(0),

View File

@ -26,7 +26,7 @@ static void read_gb_cart_normal(struct gb_cart* gb_cart, uint16_t address, uint8
else if ((address >= 0xA000) && (address <= 0xBFFF))
{
//Read from RAM
if (gb_cart->ram == NULL)
if (gb_cart->ram == nullptr)
{
//No RAM to write to
return;
@ -50,7 +50,7 @@ static void write_gb_cart_normal(struct gb_cart* gb_cart, uint16_t address, cons
if ((address >= 0xA000) && (address <= 0xBFFF))
{
//Write to RAM
if (gb_cart->ram == NULL)
if (gb_cart->ram == nullptr)
{
//No RAM to write to
return;
@ -85,7 +85,7 @@ static void read_gb_cart_mbc1(struct gb_cart* gb_cart, uint16_t address, uint8_t
}
else if ((address >= 0xA000) && (address <= 0xBFFF)) //Read from RAM
{
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
{
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
if (offset < gb_cart->ram_size)
@ -151,7 +151,7 @@ static void write_gb_cart_mbc1(struct gb_cart* gb_cart, uint16_t address, const
}
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
{
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
{
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
if (offset < gb_cart->ram_size)
@ -180,7 +180,7 @@ static void read_gb_cart_mbc2(struct gb_cart* gb_cart, uint16_t address, uint8_t
}
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper Bounds of memory map
{
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
{
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
if (offset < gb_cart->ram_size)
@ -209,14 +209,14 @@ static void write_gb_cart_mbc2(struct gb_cart* gb_cart, uint16_t address, const
}
else if ((address >= 0x4000) && (address <= 0x5FFF)) // RAM bank select
{
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
{
gb_cart->ram_bank = data[0] & 0x07;
}
}
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
{
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
{
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
if (offset < gb_cart->ram_size)
@ -229,7 +229,7 @@ static void write_gb_cart_mbc2(struct gb_cart* gb_cart, uint16_t address, const
void memoryUpdateMBC3Clock(struct gb_cart* gb_cart)
{
time_t now = time(NULL);
time_t now = time(nullptr);
time_t diff = now - gb_cart->rtc_last_time;
if (diff > 0) {
// update the clock according to the last update time
@ -284,7 +284,7 @@ static void read_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, uint8_t
}
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper Bounds of memory map
{
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
{
if (gb_cart->ram_bank <= 0x03)
{
@ -333,7 +333,7 @@ static void write_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, const
}
else if ((address >= 0x4000) && (address <= 0x5FFF)) // RAM/Clock bank select
{
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
{
bank = data[0];
if (gb_cart->has_rtc && (bank >= 0x8 && bank <= 0xc))
@ -363,7 +363,7 @@ static void write_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, const
}
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
{
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
{
if (gb_cart->ram_bank <= 0x03)
{
@ -410,7 +410,7 @@ static void read_gb_cart_mbc5(struct gb_cart * gb_cart, uint16_t address, uint8_
}
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper bounds of memory map
{
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
{
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
if (offset < gb_cart->ram_size)
@ -442,14 +442,14 @@ static void write_gb_cart_mbc5(struct gb_cart* gb_cart, uint16_t address, const
}
else if ((address >= 0x4000) && (address <= 0x5FFF)) // RAM bank select
{
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
{
gb_cart->ram_bank = data[0] & 0x0f;
}
}
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
{
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
{
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
if (offset < gb_cart->ram_size)
@ -489,7 +489,7 @@ static void read_gb_cart_pocket_cam(struct gb_cart * gb_cart, uint16_t address,
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper bounds of memory map
{
//Check to see if where currently in register mode
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
{
if (gb_cart->ram_bank & 0x10)
{
@ -526,7 +526,7 @@ static void write_gb_cart_pocket_cam(struct gb_cart* gb_cart, uint16_t address,
}
else if ((address >= 0x4000) && (address <= 0x4FFF)) // Camera Register & RAM bank select
{
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
{
if (data[0] & 0x10)
{
@ -542,7 +542,7 @@ static void write_gb_cart_pocket_cam(struct gb_cart* gb_cart, uint16_t address,
}
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
{
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
{
if (gb_cart->ram_bank & 0x10)
{
@ -675,7 +675,7 @@ static const struct parsed_cart_type* parse_cart_type(uint8_t cart_type)
case 0xFD: return &GB_CART_TYPES[26];
case 0xFE: return &GB_CART_TYPES[27];
case 0xFF: return &GB_CART_TYPES[28];
default: return NULL;
default: return nullptr;
}
}
@ -709,7 +709,7 @@ bool GBCart::init_gb_cart(struct gb_cart* gb_cart, const char* gb_file)
/* get and parse cart type */
uint8_t cart_type = rom.get()[0x147];
type = parse_cart_type(cart_type);
if (type == NULL)
if (type == nullptr)
{
return false;
}
@ -730,7 +730,7 @@ bool GBCart::init_gb_cart(struct gb_cart* gb_cart, const char* gb_file)
if (ram_size != 0)
{
ram.reset(new uint8_t[ram_size]);
if (ram.get() == NULL)
if (ram.get() == nullptr)
{
return false;
}
@ -802,10 +802,10 @@ void GBCart::save_gb_cart(struct gb_cart* gb_cart)
void GBCart::release_gb_cart(struct gb_cart* gb_cart)
{
if (gb_cart->rom != NULL)
if (gb_cart->rom != nullptr)
delete gb_cart->rom;
if (gb_cart->ram != NULL)
if (gb_cart->ram != nullptr)
delete gb_cart->ram;
memset(gb_cart, 0, sizeof(*gb_cart));

View File

@ -12,8 +12,8 @@
#include <stdio.h>
#include <Common/MemoryManagement.h>
uint8_t * CMipsMemoryVM::m_Reserve1 = NULL;
uint8_t * CMipsMemoryVM::m_Reserve2 = NULL;
uint8_t * CMipsMemoryVM::m_Reserve1 = nullptr;
uint8_t * CMipsMemoryVM::m_Reserve2 = nullptr;
uint32_t CMipsMemoryVM::m_MemLookupAddress = 0;
MIPS_DWORD CMipsMemoryVM::m_MemLookupValue;
bool CMipsMemoryVM::m_MemLookupValid = true;
@ -27,20 +27,20 @@ CMipsMemoryVM::CMipsMemoryVM(bool SavesReadOnly) :
CSram(SavesReadOnly),
CDMA(*this, *this),
m_RomMapped(false),
m_Rom(NULL),
m_Rom(nullptr),
m_RomSize(0),
m_RomWrittenTo(false),
m_RomWroteValue(0),
m_HalfLine(0),
m_HalfLineCheck(false),
m_FieldSerration(0),
m_TLB_ReadMap(NULL),
m_TLB_WriteMap(NULL),
m_RDRAM(NULL),
m_DMEM(NULL),
m_IMEM(NULL),
m_TLB_ReadMap(nullptr),
m_TLB_WriteMap(nullptr),
m_RDRAM(nullptr),
m_DMEM(nullptr),
m_IMEM(nullptr),
m_DDRomMapped(false),
m_DDRom(NULL),
m_DDRom(nullptr),
m_DDRomSize(0)
{
g_Settings->RegisterChangeCB(Game_RDRamSize, this, (CSettings::SettingChangedFunc)RdramChanged);
@ -109,37 +109,37 @@ void CMipsMemoryVM::FreeReservedMemory()
if (m_Reserve1)
{
FreeAddressSpace(m_Reserve1, 0x20000000);
m_Reserve1 = NULL;
m_Reserve1 = nullptr;
}
if (m_Reserve2)
{
FreeAddressSpace(m_Reserve2, 0x20000000);
m_Reserve2 = NULL;
m_Reserve2 = nullptr;
}
}
bool CMipsMemoryVM::Initialize(bool SyncSystem)
{
if (m_RDRAM != NULL)
if (m_RDRAM != nullptr)
{
return true;
}
if (!SyncSystem && m_RDRAM == NULL && m_Reserve1 != NULL)
if (!SyncSystem && m_RDRAM == nullptr && m_Reserve1 != nullptr)
{
m_RDRAM = m_Reserve1;
m_Reserve1 = NULL;
m_Reserve1 = nullptr;
}
if (SyncSystem && m_RDRAM == NULL && m_Reserve2 != NULL)
if (SyncSystem && m_RDRAM == nullptr && m_Reserve2 != nullptr)
{
m_RDRAM = m_Reserve2;
m_Reserve2 = NULL;
m_Reserve2 = nullptr;
}
if (m_RDRAM == NULL)
if (m_RDRAM == nullptr)
{
m_RDRAM = (uint8_t *)AllocateAddressSpace(0x20000000);
}
if (m_RDRAM == NULL)
if (m_RDRAM == nullptr)
{
WriteTrace(TraceN64System, TraceError, "Failed to Reserve RDRAM (Size: 0x%X)", 0x20000000);
FreeMemory();
@ -147,14 +147,14 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
}
m_AllocatedRdramSize = g_Settings->LoadDword(Game_RDRamSize);
if (CommitMemory(m_RDRAM, m_AllocatedRdramSize, MEM_READWRITE) == NULL)
if (CommitMemory(m_RDRAM, m_AllocatedRdramSize, MEM_READWRITE) == nullptr)
{
WriteTrace(TraceN64System, TraceError, "Failed to Allocate RDRAM (Size: 0x%X)", m_AllocatedRdramSize);
FreeMemory();
return false;
}
if (CommitMemory(m_RDRAM + 0x04000000, 0x2000, MEM_READWRITE) == NULL)
if (CommitMemory(m_RDRAM + 0x04000000, 0x2000, MEM_READWRITE) == nullptr)
{
WriteTrace(TraceN64System, TraceError, "Failed to Allocate DMEM/IMEM (Size: 0x%X)", 0x2000);
FreeMemory();
@ -169,7 +169,7 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
m_RomMapped = true;
m_Rom = m_RDRAM + 0x10000000;
m_RomSize = g_Rom->GetRomSize();
if (CommitMemory(m_Rom, g_Rom->GetRomSize(), MEM_READWRITE) == NULL)
if (CommitMemory(m_Rom, g_Rom->GetRomSize(), MEM_READWRITE) == nullptr)
{
WriteTrace(TraceN64System, TraceError, "Failed to Allocate Rom (Size: 0x%X)", g_Rom->GetRomSize());
FreeMemory();
@ -187,14 +187,14 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
}
//64DD IPL
if (g_DDRom != NULL)
if (g_DDRom != nullptr)
{
if (g_Settings->LoadBool(Game_LoadRomToMemory))
{
m_DDRomMapped = true;
m_DDRom = m_RDRAM + 0x06000000;
m_DDRomSize = g_DDRom->GetRomSize();
if (CommitMemory(m_DDRom, g_DDRom->GetRomSize(), MEM_READWRITE) == NULL)
if (CommitMemory(m_DDRom, g_DDRom->GetRomSize(), MEM_READWRITE) == nullptr)
{
WriteTrace(TraceN64System, TraceError, "Failed to Allocate Rom (Size: 0x%X)", g_DDRom->GetRomSize());
FreeMemory();
@ -215,7 +215,7 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
CPifRam::Reset();
m_TLB_ReadMap = new size_t[0x100000];
if (m_TLB_ReadMap == NULL)
if (m_TLB_ReadMap == nullptr)
{
WriteTrace(TraceN64System, TraceError, "Failed to Allocate m_TLB_ReadMap (Size: 0x%X)", 0x100000 * sizeof(size_t));
FreeMemory();
@ -223,7 +223,7 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
}
m_TLB_WriteMap = new size_t[0x100000];
if (m_TLB_WriteMap == NULL)
if (m_TLB_WriteMap == nullptr)
{
WriteTrace(TraceN64System, TraceError, "Failed to Allocate m_TLB_WriteMap (Size: 0x%X)", 0xFFFFF * sizeof(size_t));
FreeMemory();
@ -239,11 +239,11 @@ void CMipsMemoryVM::FreeMemory()
{
if (DecommitMemory(m_RDRAM, 0x20000000))
{
if (m_Reserve1 == NULL)
if (m_Reserve1 == nullptr)
{
m_Reserve1 = m_RDRAM;
}
else if (m_Reserve2 == NULL)
else if (m_Reserve2 == nullptr)
{
m_Reserve2 = m_RDRAM;
}
@ -256,19 +256,19 @@ void CMipsMemoryVM::FreeMemory()
{
FreeAddressSpace(m_RDRAM, 0x20000000);
}
m_RDRAM = NULL;
m_IMEM = NULL;
m_DMEM = NULL;
m_RDRAM = nullptr;
m_IMEM = nullptr;
m_DMEM = nullptr;
}
if (m_TLB_ReadMap)
{
delete[] m_TLB_ReadMap;
m_TLB_ReadMap = NULL;
m_TLB_ReadMap = nullptr;
}
if (m_TLB_WriteMap)
{
delete[] m_TLB_WriteMap;
m_TLB_WriteMap = NULL;
m_TLB_WriteMap = nullptr;
}
CPifRam::Reset();
}
@ -343,7 +343,7 @@ bool CMipsMemoryVM::LW_VAddr(uint32_t VAddr, uint32_t& Value)
}
uint8_t* BaseAddress = (uint8_t*)m_TLB_ReadMap[VAddr >> 12];
if (BaseAddress == NULL)
if (BaseAddress == nullptr)
{
return false;
}
@ -1026,7 +1026,7 @@ void CMipsMemoryVM::RdramChanged(CMipsMemoryVM * _this)
else
{
void * result = CommitMemory(_this->m_RDRAM + old_size, new_size - old_size, MEM_READWRITE);
if (result == NULL)
if (result == nullptr)
{
WriteTrace(TraceN64System, TraceError, "failed to allocate extended memory");
g_Notify->FatalError(GS(MSG_MEM_ALLOC_ERROR));
@ -1340,7 +1340,7 @@ void CMipsMemoryVM::Load32AudioInterface(void)
}
else
{
if (g_Plugins->Audio()->AiReadLength != NULL)
if (g_Plugins->Audio()->AiReadLength != nullptr)
{
m_MemLookupValue.UW[0] = g_Plugins->Audio()->AiReadLength();
}
@ -1433,7 +1433,7 @@ void CMipsMemoryVM::Load32SerialInterface(void)
void CMipsMemoryVM::Load32CartridgeDomain1Address1(void)
{
//64DD IPL ROM
if (g_DDRom != NULL && (m_MemLookupAddress & 0xFFFFFF) < g_MMU->m_DDRomSize)
if (g_DDRom != nullptr && (m_MemLookupAddress & 0xFFFFFF) < g_MMU->m_DDRomSize)
{
m_MemLookupValue.UW[0] = *(uint32_t *)&g_MMU->m_DDRom[(m_MemLookupAddress & 0xFFFFFF)];
}
@ -1949,7 +1949,7 @@ void CMipsMemoryVM::Write32VideoInterface(void)
if (g_Reg->VI_STATUS_REG != m_MemLookupValue.UW[0])
{
g_Reg->VI_STATUS_REG = m_MemLookupValue.UW[0];
if (g_Plugins->Gfx()->ViStatusChanged != NULL)
if (g_Plugins->Gfx()->ViStatusChanged != nullptr)
{
g_Plugins->Gfx()->ViStatusChanged();
}
@ -1963,7 +1963,7 @@ void CMipsMemoryVM::Write32VideoInterface(void)
}
#endif
g_Reg->VI_ORIGIN_REG = (m_MemLookupValue.UW[0] & 0xFFFFFF);
//if (UpdateScreen != NULL )
//if (UpdateScreen != nullptr )
//{
// UpdateScreen();
//}
@ -1972,7 +1972,7 @@ void CMipsMemoryVM::Write32VideoInterface(void)
if (g_Reg->VI_WIDTH_REG != m_MemLookupValue.UW[0])
{
g_Reg->VI_WIDTH_REG = m_MemLookupValue.UW[0];
if (g_Plugins->Gfx()->ViWidthChanged != NULL)
if (g_Plugins->Gfx()->ViWidthChanged != nullptr)
{
g_Plugins->Gfx()->ViWidthChanged();
}
@ -2013,7 +2013,7 @@ void CMipsMemoryVM::Write32AudioInterface(void)
}
else
{
if (g_Plugins->Audio()->AiLenChanged != NULL)
if (g_Plugins->Audio()->AiLenChanged != nullptr)
{
g_Plugins->Audio()->AiLenChanged();
}

View File

@ -118,7 +118,7 @@ void CPifRam::PifRamRead()
}
if (g_Plugins->Control()->ReadController)
{
g_Plugins->Control()->ReadController(-1, NULL);
g_Plugins->Control()->ReadController(-1, nullptr);
}
}
@ -240,7 +240,7 @@ void CPifRam::PifRamWrite()
m_PifRam[0x3F] = 0;
if (g_Plugins->Control()->ControllerCommand)
{
g_Plugins->Control()->ControllerCommand(-1, NULL);
g_Plugins->Control()->ControllerCommand(-1, nullptr);
}
}

View File

@ -40,17 +40,17 @@ const char * CRegName::FPR_Ctrl[32] = { "Revision", "Unknown", "Unknown", "Unkno
"Unknown", "Unknown", "Unknown", "Unknown", "Unknown", "Unknown",
"Unknown", "Unknown", "FCSR" };
uint32_t * CSystemRegisters::_PROGRAM_COUNTER = NULL;
MIPS_DWORD * CSystemRegisters::_GPR = NULL;
MIPS_DWORD * CSystemRegisters::_FPR = NULL;
uint32_t * CSystemRegisters::_CP0 = NULL;
MIPS_DWORD * CSystemRegisters::_RegHI = NULL;
MIPS_DWORD * CSystemRegisters::_RegLO = NULL;
uint32_t * CSystemRegisters::_PROGRAM_COUNTER = nullptr;
MIPS_DWORD * CSystemRegisters::_GPR = nullptr;
MIPS_DWORD * CSystemRegisters::_FPR = nullptr;
uint32_t * CSystemRegisters::_CP0 = nullptr;
MIPS_DWORD * CSystemRegisters::_RegHI = nullptr;
MIPS_DWORD * CSystemRegisters::_RegLO = nullptr;
float ** CSystemRegisters::_FPR_S;
double ** CSystemRegisters::_FPR_D;
uint32_t * CSystemRegisters::_FPCR = NULL;
uint32_t * CSystemRegisters::_LLBit = NULL;
int32_t * CSystemRegisters::_RoundingModel = NULL;
uint32_t * CSystemRegisters::_FPCR = nullptr;
uint32_t * CSystemRegisters::_LLBit = nullptr;
int32_t * CSystemRegisters::_RoundingModel = nullptr;
CP0registers::CP0registers(uint32_t * _CP0) :
INDEX_REGISTER(_CP0[0]),

View File

@ -21,7 +21,7 @@ void Rumblepak::WriteTo(int32_t Control, uint32_t address, uint8_t * data)
{
if ((address) == 0xC000)
{
if (g_Plugins->Control()->RumbleCommand != NULL)
if (g_Plugins->Control()->RumbleCommand != nullptr)
{
g_Plugins->Control()->RumbleCommand(Control, *(int *)data);
}

View File

@ -82,7 +82,7 @@ void CSram::DmaToSram(uint8_t * Source, int32_t StartOffset, uint32_t len)
// Fix Dezaemon 3D saves
StartOffset = ((StartOffset >> 3) & 0xFFFF8000) | (StartOffset & 0x7FFF);
if (((StartOffset & 3) == 0) && ((((uint32_t)Source) & 3) == 0) && NULL != NULL)
if (((StartOffset & 3) == 0) && ((((uint32_t)Source) & 3) == 0) && nullptr != nullptr)
{
m_File.Seek(StartOffset, CFile::begin);
m_File.Write(Source, len);

View File

@ -18,7 +18,7 @@ uint16_t gb_cart_address(unsigned int bank, uint16_t address)
void Transferpak::Init()
{
//Quick check to ensure we dont have a ROM already
if (tpak.gb_cart.rom == NULL)
if (tpak.gb_cart.rom == nullptr)
{
memset(&tpak, 0, sizeof(tpak));
tpak.access_mode = (!GBCart::init_gb_cart(&tpak.gb_cart, g_Settings->LoadStringVal(Game_Transferpak_ROM).c_str())) ? CART_NOT_INSERTED : CART_ACCESS_MODE_0;
@ -28,7 +28,7 @@ void Transferpak::Init()
void Transferpak::Release()
{
if (tpak.gb_cart.rom != NULL)
if (tpak.gb_cart.rom != nullptr)
{
GBCart::release_gb_cart(&tpak.gb_cart);
}
@ -39,7 +39,7 @@ void Transferpak::ReadFrom(uint16_t address, uint8_t * data)
if ((address >= 0x8000) && (address <= 0x8FFF))
{
//Ensure we actually have a ROM loaded in first.
if (tpak.gb_cart.rom == NULL)
if (tpak.gb_cart.rom == nullptr)
{
Init();
}
@ -80,7 +80,7 @@ void Transferpak::WriteTo(uint16_t address, uint8_t * data)
if ((address >= 0x8000) && (address <= 0x8FFF))
{
//Ensure we actually have a ROM loaded in first.
if (tpak.gb_cart.rom == NULL)
if (tpak.gb_cart.rom == nullptr)
{
Init();
}

View File

@ -28,13 +28,13 @@ CN64System::CN64System(CPlugins * Plugins, uint32_t randomizer_seed, bool SavesR
m_EndEmulation(false),
m_SaveUsing((SAVE_CHIP_TYPE)g_Settings->LoadDword(Game_SaveChip)),
m_Plugins(Plugins),
m_SyncCPU(NULL),
m_SyncPlugins(NULL),
m_SyncCPU(nullptr),
m_SyncPlugins(nullptr),
m_MMU_VM(SavesReadOnly),
//m_Cheats(m_MMU_VM),
m_TLB(this),
m_Reg(this, this),
m_Recomp(NULL),
m_Recomp(nullptr),
m_InReset(false),
m_NextTimer(0),
m_SystemTimer(m_Reg, m_NextTimer),
@ -47,7 +47,7 @@ CN64System::CN64System(CPlugins * Plugins, uint32_t randomizer_seed, bool SavesR
m_TLBLoadAddress(0),
m_TLBStoreAddress(0),
m_SyncCount(0),
m_thread(NULL),
m_thread(nullptr),
m_hPauseEvent(true),
m_SyncSystem(SyncSystem),
m_Random(randomizer_seed)
@ -94,14 +94,14 @@ CN64System::CN64System(CPlugins * Plugins, uint32_t randomizer_seed, bool SavesR
}
if (CpuType == CPU_SyncCores)
{
if (g_Plugins->SyncWindow() == NULL)
if (g_Plugins->SyncWindow() == nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
g_Notify->DisplayMessage(5, "Copy Plugins");
g_Plugins->CopyPlugins(g_Settings->LoadStringVal(Directory_PluginSync));
m_SyncPlugins = new CPlugins(Directory_PluginSync, true);
m_SyncPlugins->SetRenderWindows(g_Plugins->SyncWindow(), NULL);
m_SyncPlugins->SetRenderWindows(g_Plugins->SyncWindow(), nullptr);
m_SyncCPU = new CN64System(m_SyncPlugins, randomizer_seed, true, true);
}
@ -132,23 +132,23 @@ CN64System::~CN64System()
{
m_SyncCPU->CpuStopped();
delete m_SyncCPU;
m_SyncCPU = NULL;
m_SyncCPU = nullptr;
}
if (m_Recomp)
{
delete m_Recomp;
m_Recomp = NULL;
m_Recomp = nullptr;
}
if (m_SyncPlugins)
{
delete m_SyncPlugins;
m_SyncPlugins = NULL;
m_SyncPlugins = nullptr;
}
if (m_thread != NULL)
if (m_thread != nullptr)
{
WriteTrace(TraceN64System, TraceDebug, "Deleting thread object");
delete m_thread;
m_thread = NULL;
m_thread = nullptr;
}
}
@ -158,7 +158,7 @@ void CN64System::ExternalEvent(SystemEvent action)
if (action == SysEvent_LoadMachineState &&
!g_Settings->LoadBool(GameRunning_CPU_Running) &&
g_BaseSystem != NULL &&
g_BaseSystem != nullptr &&
g_BaseSystem->LoadState())
{
WriteTrace(TraceN64System, TraceDebug, "ignore event, manualy loaded save");
@ -167,7 +167,7 @@ void CN64System::ExternalEvent(SystemEvent action)
if (action == SysEvent_SaveMachineState &&
!g_Settings->LoadBool(GameRunning_CPU_Running) &&
g_BaseSystem != NULL &&
g_BaseSystem != nullptr &&
g_BaseSystem->SaveState())
{
WriteTrace(TraceN64System, TraceDebug, "ignore event, manualy saved event");
@ -315,7 +315,7 @@ bool CN64System::LoadFileImage(const char * FileLoc)
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
//Try to load the passed N64 rom
if (g_Rom == NULL)
if (g_Rom == nullptr)
{
WriteTrace(TraceN64System, TraceDebug, "Allocating global rom object");
g_Rom = new CN64Rom();
@ -331,7 +331,7 @@ bool CN64System::LoadFileImage(const char * FileLoc)
if (g_Rom->IsLoadedRomDDIPL())
{
//64DD IPL
if (g_DDRom == NULL)
if (g_DDRom == nullptr)
{
g_DDRom = new CN64Rom();
}
@ -346,7 +346,7 @@ bool CN64System::LoadFileImage(const char * FileLoc)
g_System->RefreshGameSettings();
if (g_Disk == NULL || !g_Rom->IsLoadedRomDDIPL())
if (g_Disk == nullptr || !g_Rom->IsLoadedRomDDIPL())
{
g_Settings->SaveString(Game_File, FileLoc);
}
@ -358,7 +358,7 @@ bool CN64System::LoadFileImage(const char * FileLoc)
WriteTrace(TraceN64System, TraceError, "LoadN64Image failed (\"%s\")", FileLoc);
g_Notify->DisplayError(g_Rom->GetError());
delete g_Rom;
g_Rom = NULL;
g_Rom = nullptr;
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
WriteTrace(TraceN64System, TraceDebug, "Done (res: false)");
return false;
@ -381,7 +381,7 @@ bool CN64System::LoadFileImageIPL(const char * FileLoc)
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
//Try to load the passed N64 DDrom
if (g_DDRom == NULL)
if (g_DDRom == nullptr)
{
WriteTrace(TraceN64System, TraceDebug, "Allocating global DDrom object");
g_DDRom = new CN64Rom();
@ -400,7 +400,7 @@ bool CN64System::LoadFileImageIPL(const char * FileLoc)
WriteTrace(TraceN64System, TraceError, "LoadN64ImageIPL failed (\"%s\")", FileLoc);
g_Notify->DisplayError(g_DDRom->GetError());
delete g_DDRom;
g_DDRom = NULL;
g_DDRom = nullptr;
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
return false;
}
@ -422,7 +422,7 @@ bool CN64System::LoadFileImageIPL(const char * FileLoc)
WriteTrace(TraceN64System, TraceError, "LoadN64ImageIPL failed (\"%s\")", FileLoc);
g_Notify->DisplayError(g_DDRom->GetError());
delete g_DDRom;
g_DDRom = NULL;
g_DDRom = nullptr;
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
return false;
}
@ -443,7 +443,7 @@ bool CN64System::LoadDiskImage(const char * FileLoc, const bool Expansion)
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
//Try to load the passed N64 Disk
if (g_Disk == NULL)
if (g_Disk == nullptr)
{
WriteTrace(TraceN64System, TraceDebug, "Allocating global Disk object");
g_Disk = new CN64Disk();
@ -469,7 +469,7 @@ bool CN64System::LoadDiskImage(const char * FileLoc, const bool Expansion)
WriteTrace(TraceN64System, TraceError, "LoadDiskImage failed (\"%s\")", FileLoc);
g_Notify->DisplayError(g_Disk->GetError());
delete g_Disk;
g_Disk = NULL;
g_Disk = nullptr;
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
return false;
}
@ -479,17 +479,17 @@ bool CN64System::LoadDiskImage(const char * FileLoc, const bool Expansion)
bool CN64System::RunFileImage(const char * FileLoc)
{
//Uninitialize g_Disk and g_DDRom to prevent exception when ending emulation of a regular ROM after playing 64DD content previously.
if (g_Disk != NULL)
if (g_Disk != nullptr)
{
g_Disk->UnallocateDiskImage();
delete g_Disk;
g_Disk = NULL;
g_Disk = nullptr;
}
if (g_DDRom != NULL)
if (g_DDRom != nullptr)
{
g_DDRom->UnallocateRomImage();
delete g_DDRom;
g_DDRom = NULL;
g_DDRom = nullptr;
}
if (!LoadFileImage(FileLoc))
{
@ -553,7 +553,7 @@ bool CN64System::RunDiskComboImage(const char * FileLoc, const char * FileLocDis
void CN64System::RunLoadedImage(void)
{
WriteTrace(TraceN64System, TraceDebug, "Start");
g_BaseSystem = new CN64System(g_Plugins, (uint32_t)time(NULL), false, false);
g_BaseSystem = new CN64System(g_Plugins, (uint32_t)time(nullptr), false, false);
if (g_BaseSystem)
{
if (g_Settings->LoadBool(Setting_AutoStart) != 0)
@ -577,7 +577,7 @@ void CN64System::CloseSystem()
{
g_BaseSystem->CloseCpu();
delete g_BaseSystem;
g_BaseSystem = NULL;
g_BaseSystem = nullptr;
}
WriteTrace(TraceN64System, TraceDebug, "Done");
}
@ -585,7 +585,7 @@ void CN64System::CloseSystem()
bool CN64System::SelectAndLoadFileImageIPL(Country country, bool combo)
{
delete g_DDRom;
g_DDRom = NULL;
g_DDRom = nullptr;
SettingID IPLROMPathSetting;
LanguageStringID IPLROMError;
@ -668,7 +668,7 @@ bool CN64System::EmulationStarting(CThread * thread)
g_BaseSystem->StartEmulation2(false);
WriteTrace(TraceN64System, TraceDebug, "Game Done");
//PLACE TO ADD 64DD SAVING CODE
if (g_Disk != NULL)
if (g_Disk != nullptr)
{
g_Disk->SaveDiskImage();
//g_Notify->DisplayError(g_Disk->GetError());
@ -886,7 +886,7 @@ void CN64System::Reset(bool bInitReg, bool ClearMenory)
m_Plugins->RomClosed();
m_Plugins->RomOpened();
}
if (m_SyncCPU && m_SyncCPU->m_MMU_VM.Rdram() != NULL)
if (m_SyncCPU && m_SyncCPU->m_MMU_VM.Rdram() != nullptr)
{
m_SyncCPU->Reset(bInitReg, ClearMenory);
}
@ -934,7 +934,7 @@ bool CN64System::SetActiveSystem(bool bActive)
g_Plugins = m_Plugins;
g_TLBLoadAddress = &m_TLBLoadAddress;
g_TLBStoreAddress = &m_TLBStoreAddress;
g_RecompPos = m_Recomp ? m_Recomp->RecompPos() : NULL;
g_RecompPos = m_Recomp ? m_Recomp->RecompPos() : nullptr;
R4300iOp::m_TestTimer = m_TestTimer;
R4300iOp::m_NextInstruction = m_NextInstruction;
R4300iOp::m_JumpToLocation = m_JumpToLocation;
@ -944,21 +944,21 @@ bool CN64System::SetActiveSystem(bool bActive)
{
if (this == g_BaseSystem)
{
g_System = NULL;
g_SyncSystem = NULL;
g_Recompiler = NULL;
g_MMU = NULL;
g_TLB = NULL;
g_Reg = NULL;
g_Audio = NULL;
g_SystemTimer = NULL;
g_TransVaddr = NULL;
g_SystemEvents = NULL;
g_NextTimer = NULL;
g_System = nullptr;
g_SyncSystem = nullptr;
g_Recompiler = nullptr;
g_MMU = nullptr;
g_TLB = nullptr;
g_Reg = nullptr;
g_Audio = nullptr;
g_SystemTimer = nullptr;
g_TransVaddr = nullptr;
g_SystemEvents = nullptr;
g_NextTimer = nullptr;
g_Plugins = m_Plugins;
g_TLBLoadAddress = NULL;
g_TLBStoreAddress = NULL;
g_Random = NULL;
g_TLBLoadAddress = nullptr;
g_TLBStoreAddress = nullptr;
g_Random = nullptr;
}
}
@ -1737,7 +1737,7 @@ bool CN64System::SaveState()
{
ZipFile.Delete();
zipFile file = zipOpen(ZipFile, 0);
zipOpenNewFileInZip(file, SaveFile.GetNameExtension().c_str(), NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
zipOpenNewFileInZip(file, SaveFile.GetNameExtension().c_str(), nullptr, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
zipWriteInFileInZip(file, &SaveID_0, sizeof(SaveID_0));
zipWriteInFileInZip(file, &RdramSize, sizeof(uint32_t));
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
@ -1774,7 +1774,7 @@ bool CN64System::SaveState()
zipWriteInFileInZip(file, m_MMU_VM.Imem(), 0x1000);
zipCloseFileInZip(file);
zipOpenNewFileInZip(file, ExtraInfo.GetNameExtension().c_str(), NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
zipOpenNewFileInZip(file, ExtraInfo.GetNameExtension().c_str(), nullptr, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
//Extra Info v2
zipWriteInFileInZip(file, &SaveID_2, sizeof(SaveID_2));
@ -1789,7 +1789,7 @@ bool CN64System::SaveState()
zipClose(file, "");
#if defined(ANDROID)
utimes((const char *)ZipFile, NULL);
utimes((const char *)ZipFile, nullptr);
#endif
}
else
@ -1860,7 +1860,7 @@ bool CN64System::SaveState()
}
m_Reg.MI_INTR_REG = MiInterReg;
g_Settings->SaveString(GameRunning_InstantSaveFile, "");
g_Settings->SaveDword(Game_LastSaveTime, (uint32_t)time(NULL));
g_Settings->SaveDword(Game_LastSaveTime, (uint32_t)time(nullptr));
if (g_Settings->LoadDword(Setting_AutoZipInstantSave))
{
SaveFile = ZipFile;
@ -1961,7 +1961,7 @@ bool CN64System::LoadState(const char * FileName)
}
unzFile file = unzOpen(SaveFile);
int port = -1;
if (file != NULL)
if (file != nullptr)
{
port = unzGoToFirstFile(file);
}
@ -1970,7 +1970,7 @@ bool CN64System::LoadState(const char * FileName)
unz_file_info info;
char zname[132];
unzGetCurrentFileInfo(file, &info, zname, 128, NULL, 0, NULL, 0);
unzGetCurrentFileInfo(file, &info, zname, 128, nullptr, 0, nullptr, 0);
if (unzLocateFile(file, zname, 1) != UNZ_OK)
{
unzClose(file);
@ -2383,7 +2383,7 @@ void CN64System::RefreshScreen()
{
WriteTrace(TraceGFXPlugin, TraceDebug, "UpdateScreen Starting");
g_Plugins->Gfx()->UpdateScreen();
if (g_Debugger != NULL && HaveDebugger())
if (g_Debugger != nullptr && HaveDebugger())
{
g_Debugger->FrameDrawn();
}

View File

@ -8,10 +8,10 @@
#include <memory>
CN64Disk::CN64Disk() :
m_DiskImage(NULL),
m_DiskImageBase(NULL),
m_DiskHeader(NULL),
m_DiskHeaderBase(NULL),
m_DiskImage(nullptr),
m_DiskImageBase(nullptr),
m_DiskHeader(nullptr),
m_DiskHeaderBase(nullptr),
m_ErrorMsg(EMPTY_STRING),
m_DiskBufAddress(0),
m_DiskSysAddress(0),
@ -236,7 +236,7 @@ bool CN64Disk::AllocateDiskImage(uint32_t DiskFileSize)
{
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for disk");
std::unique_ptr<uint8_t> ImageBase(new uint8_t[DiskFileSize + 0x1000]);
if (ImageBase.get() == NULL)
if (ImageBase.get() == nullptr)
{
SetError(MSG_MEM_ALLOC_ERROR);
WriteTrace(TraceN64System, TraceError, "Failed to allocate memory for disk (size: 0x%X)", DiskFileSize);
@ -256,7 +256,7 @@ bool CN64Disk::AllocateDiskHeader()
{
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for disk header forge");
std::unique_ptr<uint8_t> HeaderBase(new uint8_t[0x40 + 0x1000]);
if (HeaderBase.get() == NULL)
if (HeaderBase.get() == nullptr)
{
SetError(MSG_MEM_ALLOC_ERROR);
WriteTrace(TraceN64System, TraceError, "Failed to allocate memory for disk header forge (size: 0x40)");
@ -556,17 +556,17 @@ void CN64Disk::UnallocateDiskImage()
{
ProtectMemory(m_DiskHeader, 0x40, MEM_READWRITE);
delete[] m_DiskHeaderBase;
m_DiskHeaderBase = NULL;
m_DiskHeaderBase = nullptr;
}
m_DiskHeader = NULL;
m_DiskHeader = nullptr;
if (m_DiskImageBase)
{
ProtectMemory(m_DiskImage, m_DiskFileSize, MEM_READWRITE);
delete[] m_DiskImageBase;
m_DiskImageBase = NULL;
m_DiskImageBase = nullptr;
}
m_DiskImage = NULL;
m_DiskImage = nullptr;
}
uint32_t CN64Disk::CalculateCrc()

View File

@ -13,8 +13,8 @@
#endif
CN64Rom::CN64Rom() :
m_ROMImage(NULL),
m_ROMImageBase(NULL),
m_ROMImage(nullptr),
m_ROMImageBase(nullptr),
m_RomFileSize(0),
m_ErrorMsg(EMPTY_STRING),
m_Country(Country_Unknown),
@ -31,7 +31,7 @@ bool CN64Rom::AllocateRomImage(uint32_t RomFileSize)
{
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for rom");
std::unique_ptr<uint8_t> ImageBase(new uint8_t[RomFileSize + 0x2000]);
if (ImageBase.get() == NULL)
if (ImageBase.get() == nullptr)
{
SetError(MSG_MEM_ALLOC_ERROR);
WriteTrace(TraceN64System, TraceError, "Failed to allocate memory for rom (size: 0x%X)", RomFileSize);
@ -129,7 +129,7 @@ bool CN64Rom::AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnl
bool CN64Rom::AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnly)
{
unzFile file = unzOpen(FileLoc);
if (file == NULL)
if (file == nullptr)
{
return false;
}
@ -143,7 +143,7 @@ bool CN64Rom::AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnl
unz_file_info info;
char zname[260];
unzGetCurrentFileInfo(file, &info, zname, sizeof(zname), NULL, 0, NULL, 0);
unzGetCurrentFileInfo(file, &info, zname, sizeof(zname), nullptr, 0, nullptr, 0);
if (unzLocateFile(file, zname, 1) != UNZ_OK)
{
SetError(MSG_FAIL_ZIP);
@ -268,7 +268,7 @@ CICChip CN64Rom::GetCicChipID(uint8_t * RomData, uint64_t * CRC)
{
crc += *(uint32_t *)(RomData + count);
}
if (CRC != NULL) { *CRC = crc; }
if (CRC != nullptr) { *CRC = crc; }
switch (crc)
{
@ -291,7 +291,7 @@ void CN64Rom::CalculateCicChip()
{
uint64_t CRC = 0;
if (m_ROMImage == NULL)
if (m_ROMImage == nullptr)
{
m_CicChip = CIC_UNKNOWN;
return;
@ -503,13 +503,13 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
bool Loaded7zFile = false;
#ifdef _WIN32
if (strstr(FileLoc, "?") != NULL || _stricmp(ext.c_str(), "7z") == 0)
if (strstr(FileLoc, "?") != nullptr || _stricmp(ext.c_str(), "7z") == 0)
{
stdstr FullPath = FileLoc;
//this should be a 7zip file
char * SubFile = strstr(const_cast<char*>(FullPath.c_str()), "?");
if (SubFile != NULL)
if (SubFile != nullptr)
{
*SubFile = '\0';
SubFile += 1;
@ -532,7 +532,7 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
stdstr ZipFileName;
ZipFileName.FromUTF16(ZipFile.FileNameIndex(i).c_str());
if (SubFile != NULL)
if (SubFile != nullptr)
{
if (_stricmp(ZipFileName.c_str(), SubFile) != 0)
{
@ -699,13 +699,13 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
stdstr ext = CPath(FileLoc).GetExtension();
bool Loaded7zFile = false;
#ifdef _WIN32
if (strstr(FileLoc, "?") != NULL || _stricmp(ext.c_str(), "7z") == 0)
if (strstr(FileLoc, "?") != nullptr || _stricmp(ext.c_str(), "7z") == 0)
{
stdstr FullPath = FileLoc;
//this should be a 7zip file
char * SubFile = strstr(const_cast<char*>(FullPath.c_str()), "?");
if (SubFile != NULL)
if (SubFile != nullptr)
{
*SubFile = '\0';
SubFile += 1;
@ -728,7 +728,7 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
stdstr ZipFileName;
ZipFileName.FromUTF16(ZipFile.FileNameIndex(i).c_str());
if (SubFile != NULL)
if (SubFile != nullptr)
{
if (_stricmp(ZipFileName.c_str(), SubFile) != 0)
{
@ -908,7 +908,7 @@ void CN64Rom::UnallocateRomImage()
{
ProtectMemory(m_ROMImage, m_RomFileSize, MEM_READWRITE);
delete[] m_ROMImageBase;
m_ROMImageBase = NULL;
m_ROMImageBase = nullptr;
}
m_ROMImage = NULL;
m_ROMImage = nullptr;
}

View File

@ -29,7 +29,7 @@ public:
//Get a message id for the reason that you failed to load the rom
LanguageStringID GetError() const { return m_ErrorMsg; }
static CICChip GetCicChipID(uint8_t * RomData, uint64_t * CRC = NULL);
static CICChip GetCicChipID(uint8_t * RomData, uint64_t * CRC = nullptr);
static void CleanRomName(char * RomName, bool byteswap = true);
private:

View File

@ -318,7 +318,7 @@ void CArmOps::MoveConstToArmReg(ArmReg Reg, uint16_t value, const char * comment
PreOpCheck(Arm_Unknown, true, __FILE__, __LINE__);
if ((value & 0xFF00) == 0 && Reg <= 7)
{
CPU_Message(" mov%s\t%s, #0x%X\t; %s", m_InItBlock ? ArmCurrentItCondition() : "s", ArmRegName(Reg), (uint32_t)value, comment != NULL ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
CPU_Message(" mov%s\t%s, #0x%X\t; %s", m_InItBlock ? ArmCurrentItCondition() : "s", ArmRegName(Reg), (uint32_t)value, comment != nullptr ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
ArmThumbOpcode op = { 0 };
op.Imm8.imm8 = value;
op.Imm8.rdn = Reg;
@ -327,7 +327,7 @@ void CArmOps::MoveConstToArmReg(ArmReg Reg, uint16_t value, const char * comment
}
else if (CanThumbCompressConst(value))
{
CPU_Message(" mov%s.w\t%s, #0x%X\t; %s", m_InItBlock ? ArmCurrentItCondition() : "", ArmRegName(Reg), (uint32_t)value, comment != NULL ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
CPU_Message(" mov%s.w\t%s, #0x%X\t; %s", m_InItBlock ? ArmCurrentItCondition() : "", ArmRegName(Reg), (uint32_t)value, comment != nullptr ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
uint16_t CompressedValue = ThumbCompressConst(value);
Arm32Opcode op = { 0 };
op.imm8_3_1.rn = 0xF;
@ -344,7 +344,7 @@ void CArmOps::MoveConstToArmReg(ArmReg Reg, uint16_t value, const char * comment
}
else
{
CPU_Message(" movw%s\t%s, #0x%X\t; %s", m_InItBlock ? ArmCurrentItCondition() : "", ArmRegName(Reg), (uint32_t)value, comment != NULL ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
CPU_Message(" movw%s\t%s, #0x%X\t; %s", m_InItBlock ? ArmCurrentItCondition() : "", ArmRegName(Reg), (uint32_t)value, comment != nullptr ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
Arm32Opcode op = { 0 };
op.imm16.opcode = ArmMOV_IMM16;
@ -368,7 +368,7 @@ void CArmOps::MoveConstToArmRegTop(ArmReg DestReg, uint16_t Const, const char *
{
PreOpCheck(DestReg, false, __FILE__, __LINE__);
CPU_Message(" movt\t%s, %s", ArmRegName(DestReg), comment != NULL ? stdstr_f("#0x%X\t; %s", (uint32_t)Const, comment).c_str() : stdstr_f("#%d\t; 0x%X", (uint32_t)Const, (uint32_t)Const).c_str());
CPU_Message(" movt\t%s, %s", ArmRegName(DestReg), comment != nullptr ? stdstr_f("#0x%X\t; %s", (uint32_t)Const, comment).c_str() : stdstr_f("#%d\t; 0x%X", (uint32_t)Const, (uint32_t)Const).c_str());
Arm32Opcode op = { 0 };
op.imm16.opcode = ArmMOV_IMM16;
@ -559,7 +559,7 @@ void CArmOps::LoadArmRegPointerToArmReg(ArmReg DestReg, ArmReg RegPointer, uint8
g_Notify->BreakPoint(__FILE__, __LINE__);
return;
}
CPU_Message(" ldr.w\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != NULL ? "\t; " : "", comment != NULL ? comment : "");
CPU_Message(" ldr.w\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != nullptr ? "\t; " : "", comment != nullptr ? comment : "");
Arm32Opcode op = { 0 };
op.imm12.rt = DestReg;
op.imm12.rn = RegPointer;
@ -569,7 +569,7 @@ void CArmOps::LoadArmRegPointerToArmReg(ArmReg DestReg, ArmReg RegPointer, uint8
}
else
{
CPU_Message(" ldr\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != NULL ? "\t; " : "", comment != NULL ? comment : "");
CPU_Message(" ldr\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != nullptr ? "\t; " : "", comment != nullptr ? comment : "");
ArmThumbOpcode op = { 0 };
op.Imm5.rt = DestReg;
op.Imm5.rn = RegPointer;
@ -663,7 +663,7 @@ void CArmOps::MoveConstToArmReg(ArmReg DestReg, uint32_t value, const char * com
{
PreOpCheck(DestReg, false, __FILE__, __LINE__);
CPU_Message(" mov.w\t%s, #0x%X\t; %s", ArmRegName(DestReg), (uint32_t)value, comment != NULL ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
CPU_Message(" mov.w\t%s, #0x%X\t; %s", ArmRegName(DestReg), (uint32_t)value, comment != nullptr ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
uint16_t CompressedValue = ThumbCompressConst(value);
Arm32Opcode op = { 0 };
op.imm8_3_1.rn = 0xF;
@ -684,7 +684,7 @@ void CArmOps::MoveConstToArmReg(ArmReg DestReg, uint32_t value, const char * com
uint16_t TopValue = (uint16_t)((value >> 16) & 0xFFFF);
if (TopValue != 0)
{
MoveConstToArmRegTop(DestReg, TopValue, comment != NULL ? "" : NULL);
MoveConstToArmRegTop(DestReg, TopValue, comment != nullptr ? "" : nullptr);
}
}
}
@ -1138,7 +1138,7 @@ void CArmOps::StoreArmRegToArmRegPointer(ArmReg DestReg, ArmReg RegPointer, uint
{
if ((Offset & (~0xFFF)) != 0) { g_Notify->BreakPoint(__FILE__, __LINE__); return; }
CPU_Message(" str\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != NULL ? "\t; " : "", comment != NULL ? comment : "");
CPU_Message(" str\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != nullptr ? "\t; " : "", comment != nullptr ? comment : "");
Arm32Opcode op = { 0 };
op.imm12.rt = DestReg;
op.imm12.rn = RegPointer;
@ -1148,7 +1148,7 @@ void CArmOps::StoreArmRegToArmRegPointer(ArmReg DestReg, ArmReg RegPointer, uint
}
else
{
CPU_Message(" str\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != NULL ? "\t; " : "", comment != NULL ? comment : "");
CPU_Message(" str\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != nullptr ? "\t; " : "", comment != nullptr ? comment : "");
ArmThumbOpcode op = { 0 };
op.Imm5.rt = DestReg;
op.Imm5.rn = RegPointer;
@ -1478,7 +1478,7 @@ void CArmOps::SetJump8(uint8_t * Loc, uint8_t * JumpLoc)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
if (Loc == NULL || JumpLoc == NULL)
if (Loc == nullptr || JumpLoc == nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
return;
@ -1516,7 +1516,7 @@ void CArmOps::SetJump20(uint32_t * Loc, uint32_t * JumpLoc)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
if (Loc == NULL || JumpLoc == NULL)
if (Loc == nullptr || JumpLoc == nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
return;

View File

@ -164,15 +164,15 @@ protected:
static void IfBlock(ArmItMask mask, ArmCompareType CompareType);
static void LoadArmRegPointerByteToArmReg(ArmReg DestReg, ArmReg RegPointer, uint16_t offset);
static void LoadArmRegPointerByteToArmReg(ArmReg DestReg, ArmReg RegPointer, ArmReg RegPointer2, uint8_t shift);
static void LoadArmRegPointerToArmReg(ArmReg DestReg, ArmReg RegPointer, uint8_t Offset, const char * comment = NULL);
static void LoadArmRegPointerToArmReg(ArmReg DestReg, ArmReg RegPointer, uint8_t Offset, const char * comment = nullptr);
static void LoadArmRegPointerToArmReg(ArmReg DestReg, ArmReg RegPointer, ArmReg RegPointer2, uint8_t shift);
static void LoadArmRegPointerToFloatReg(ArmReg RegPointer, ArmFpuSingle Reg, uint8_t Offset);
static void LoadFloatingPointControlReg(ArmReg DestReg);
static void MoveArmRegArmReg(ArmReg DestReg, ArmReg SourceReg);
static void MoveArmRegToVariable(ArmReg Reg, void * Variable, const char * VariableName);
static void MoveConstToArmReg(ArmReg DestReg, uint16_t Const, const char * comment = NULL);
static void MoveConstToArmRegTop(ArmReg DestReg, uint16_t Const, const char * comment = NULL);
static void MoveConstToArmReg(ArmReg DestReg, uint32_t Const, const char * comment = NULL);
static void MoveConstToArmReg(ArmReg DestReg, uint16_t Const, const char * comment = nullptr);
static void MoveConstToArmRegTop(ArmReg DestReg, uint16_t Const, const char * comment = nullptr);
static void MoveConstToArmReg(ArmReg DestReg, uint32_t Const, const char * comment = nullptr);
static void MoveConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
static void MoveFloatRegToVariable(ArmFpuSingle reg, void * Variable, const char * VariableName);
static void MoveVariableToArmReg(void * Variable, const char * VariableName, ArmReg reg);
@ -187,7 +187,7 @@ protected:
static void ShiftRightUnsignImmed(ArmReg DestReg, ArmReg SourceReg, uint32_t shift);
static void ShiftLeftImmed(ArmReg DestReg, ArmReg SourceReg, uint32_t shift);
static void SignExtendByte(ArmReg Reg);
static void StoreArmRegToArmRegPointer(ArmReg DestReg, ArmReg RegPointer, uint8_t Offset, const char * comment = NULL);
static void StoreArmRegToArmRegPointer(ArmReg DestReg, ArmReg RegPointer, uint8_t Offset, const char * comment = nullptr);
static void StoreArmRegToArmRegPointer(ArmReg DestReg, ArmReg RegPointer, ArmReg RegPointer2, uint8_t shift);
static void StoreFloatingPointControlReg(ArmReg SourceReg);
static void StoreFloatRegToArmRegPointer(ArmFpuSingle Reg, ArmReg RegPointer, uint8_t Offset);

View File

@ -97,8 +97,8 @@ bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2);
void CArmRecompilerOps::Compile_TrapCompare(TRAP_COMPARE CompareType)
{
void *FunctAddress = NULL;
const char *FunctName = NULL;
void *FunctAddress = nullptr;
const char *FunctName = nullptr;
switch (CompareType)
{
case CompareTypeTEQ:
@ -153,7 +153,7 @@ void CArmRecompilerOps::Compile_TrapCompare(TRAP_COMPARE CompareType)
g_Notify->BreakPoint(__FILE__, __LINE__);
}
if (FunctName != NULL && FunctAddress != NULL)
if (FunctName != nullptr && FunctAddress != nullptr)
{
if (m_Opcode.rs != 0) { WriteBack_GPR(m_Opcode.rs, false); }
if (m_Opcode.rt != 0) { WriteBack_GPR(m_Opcode.rt, false); }
@ -234,7 +234,7 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
}
m_Section->m_Jump.JumpPC = m_CompilePC;
m_Section->m_Jump.TargetPC = m_CompilePC + ((int16_t)m_Opcode.offset << 2) + 4;
if (m_Section->m_JumpSection != NULL)
if (m_Section->m_JumpSection != nullptr)
{
m_Section->m_Jump.BranchLabel.Format("Section_%d", m_Section->m_JumpSection->m_SectionID);
}
@ -242,12 +242,12 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
{
m_Section->m_Jump.BranchLabel.Format("Exit_%X_jump_%X", m_Section->m_EnterPC, m_Section->m_Jump.TargetPC);
}
m_Section->m_Jump.LinkLocation = NULL;
m_Section->m_Jump.LinkLocation2 = NULL;
m_Section->m_Jump.LinkLocation = nullptr;
m_Section->m_Jump.LinkLocation2 = nullptr;
m_Section->m_Jump.DoneDelaySlot = false;
m_Section->m_Cont.JumpPC = m_CompilePC;
m_Section->m_Cont.TargetPC = m_CompilePC + 8;
if (m_Section->m_ContinueSection != NULL)
if (m_Section->m_ContinueSection != nullptr)
{
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
}
@ -255,8 +255,8 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
{
m_Section->m_Cont.BranchLabel.Format("Exit_%X_continue_%X", m_Section->m_EnterPC, m_Section->m_Cont.TargetPC);
}
m_Section->m_Cont.LinkLocation = NULL;
m_Section->m_Cont.LinkLocation2 = NULL;
m_Section->m_Cont.LinkLocation = nullptr;
m_Section->m_Cont.LinkLocation2 = nullptr;
m_Section->m_Cont.DoneDelaySlot = false;
if (m_Section->m_Jump.TargetPC < m_Section->m_Cont.TargetPC)
{
@ -282,8 +282,8 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
{
if ((m_CompilePC & 0xFFC) != 0xFFC)
{
m_Section->m_Cont.BranchLabel = m_Section->m_ContinueSection != NULL ? "Continue" : "ContinueExitBlock";
m_Section->m_Jump.BranchLabel = m_Section->m_JumpSection != NULL ? "Jump" : "JumpExitBlock";
m_Section->m_Cont.BranchLabel = m_Section->m_ContinueSection != nullptr ? "Continue" : "ContinueExitBlock";
m_Section->m_Jump.BranchLabel = m_Section->m_JumpSection != nullptr ? "Jump" : "JumpExitBlock";
}
else
{
@ -296,14 +296,14 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
}
if (!m_Section->m_Jump.FallThrough && !m_Section->m_Cont.FallThrough)
{
if (m_Section->m_Jump.LinkLocation != NULL)
if (m_Section->m_Jump.LinkLocation != nullptr)
{
CPU_Message("");
CPU_Message(" %s:", m_Section->m_Jump.BranchLabel.c_str());
LinkJump(m_Section->m_Jump);
m_Section->m_Jump.FallThrough = true;
}
else if (m_Section->m_Cont.LinkLocation != NULL)
else if (m_Section->m_Cont.LinkLocation != nullptr)
{
CPU_Message("");
CPU_Message(" %s:", m_Section->m_Cont.BranchLabel.c_str());
@ -313,10 +313,10 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
}
if ((m_CompilePC & 0xFFC) == 0xFFC)
{
uint8_t * DelayLinkLocation = NULL;
uint8_t * DelayLinkLocation = nullptr;
if (m_Section->m_Jump.FallThrough)
{
if (m_Section->m_Jump.LinkLocation != NULL || m_Section->m_Jump.LinkLocation2 != NULL)
if (m_Section->m_Jump.LinkLocation != nullptr || m_Section->m_Jump.LinkLocation2 != nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
@ -324,16 +324,16 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
}
else if (m_Section->m_Cont.FallThrough)
{
if (m_Section->m_Cont.LinkLocation != NULL || m_Section->m_Cont.LinkLocation2 != NULL)
if (m_Section->m_Cont.LinkLocation != nullptr || m_Section->m_Cont.LinkLocation2 != nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
MoveConstToVariable(m_Section->m_Cont.TargetPC, &R4300iOp::m_JumpToLocation, "R4300iOp::m_JumpToLocation");
}
if (m_Section->m_Jump.LinkLocation != NULL || m_Section->m_Jump.LinkLocation2 != NULL)
if (m_Section->m_Jump.LinkLocation != nullptr || m_Section->m_Jump.LinkLocation2 != nullptr)
{
if (DelayLinkLocation != NULL) { g_Notify->BreakPoint(__FILE__, __LINE__); }
if (DelayLinkLocation != nullptr) { g_Notify->BreakPoint(__FILE__, __LINE__); }
DelayLinkLocation = *g_RecompPos;
BranchLabel8(ArmBranch_Always, "DoDelaySlot");
@ -342,9 +342,9 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
LinkJump(m_Section->m_Jump);
MoveConstToVariable(m_Section->m_Jump.TargetPC, &R4300iOp::m_JumpToLocation, "R4300iOp::m_JumpToLocation");
}
if (m_Section->m_Cont.LinkLocation != NULL || m_Section->m_Cont.LinkLocation2 != NULL)
if (m_Section->m_Cont.LinkLocation != nullptr || m_Section->m_Cont.LinkLocation2 != nullptr)
{
if (DelayLinkLocation != NULL) { g_Notify->BreakPoint(__FILE__, __LINE__); }
if (DelayLinkLocation != nullptr) { g_Notify->BreakPoint(__FILE__, __LINE__); }
DelayLinkLocation = *g_RecompPos;
BranchLabel8(ArmBranch_Always, "DoDelaySlot");
@ -381,7 +381,7 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
FallInfo->RegSet = m_RegWorkingSet;
if (FallInfo == &m_Section->m_Jump)
{
if (m_Section->m_JumpSection != NULL)
if (m_Section->m_JumpSection != nullptr)
{
m_Section->m_Jump.BranchLabel.Format("Section_%d", m_Section->m_JumpSection->m_SectionID);
}
@ -401,7 +401,7 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
}
else
{
if (m_Section->m_ContinueSection != NULL)
if (m_Section->m_ContinueSection != nullptr)
{
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
}
@ -417,7 +417,7 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
BranchLabel20(ArmBranch_Always, FallInfo->BranchLabel.c_str());
FallInfo->LinkLocation = (uint32_t *)(*g_RecompPos - 4);
if (JumpInfo->LinkLocation != NULL)
if (JumpInfo->LinkLocation != nullptr)
{
CPU_Message(" %s:", JumpInfo->BranchLabel.c_str());
LinkJump(*JumpInfo);
@ -443,12 +443,12 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
m_Section->m_Jump.FallThrough = false;
m_Section->m_Cont.FallThrough = true;
m_Section->m_Cont.RegSet = m_RegWorkingSet;
if (m_Section->m_ContinueSection == NULL && m_Section->m_JumpSection != NULL)
if (m_Section->m_ContinueSection == nullptr && m_Section->m_JumpSection != nullptr)
{
m_Section->m_ContinueSection = m_Section->m_JumpSection;
m_Section->m_JumpSection = NULL;
m_Section->m_JumpSection = nullptr;
}
if (m_Section->m_ContinueSection != NULL)
if (m_Section->m_ContinueSection != nullptr)
{
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
}
@ -501,7 +501,7 @@ void CArmRecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
}
}
if (m_Section->m_JumpSection != NULL)
if (m_Section->m_JumpSection != nullptr)
{
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
}
@ -510,7 +510,7 @@ void CArmRecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
m_Section->m_Jump.BranchLabel = "ExitBlock";
}
if (m_Section->m_ContinueSection != NULL)
if (m_Section->m_ContinueSection != nullptr)
{
m_Section->m_Cont.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_ContinueSection)->m_SectionID);
}
@ -520,11 +520,11 @@ void CArmRecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
}
m_Section->m_Jump.FallThrough = true;
m_Section->m_Jump.LinkLocation = NULL;
m_Section->m_Jump.LinkLocation2 = NULL;
m_Section->m_Jump.LinkLocation = nullptr;
m_Section->m_Jump.LinkLocation2 = nullptr;
m_Section->m_Cont.FallThrough = false;
m_Section->m_Cont.LinkLocation = NULL;
m_Section->m_Cont.LinkLocation2 = NULL;
m_Section->m_Cont.LinkLocation = nullptr;
m_Section->m_Cont.LinkLocation2 = nullptr;
if (Link)
{
@ -544,13 +544,13 @@ void CArmRecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
{
if (m_Section->m_Cont.FallThrough)
{
if (m_Section->m_Jump.LinkLocation != NULL)
if (m_Section->m_Jump.LinkLocation != nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
}
if (m_Section->m_Jump.LinkLocation != NULL || m_Section->m_Jump.FallThrough)
if (m_Section->m_Jump.LinkLocation != nullptr || m_Section->m_Jump.FallThrough)
{
LinkJump(m_Section->m_Jump);
@ -583,7 +583,7 @@ void CArmRecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
{
if (m_Section->m_Cont.FallThrough)
{
if (m_Section->m_Jump.LinkLocation != NULL)
if (m_Section->m_Jump.LinkLocation != nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
@ -607,7 +607,7 @@ void CArmRecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
void CArmRecompilerOps::BNE_Compare()
{
uint8_t * Jump = NULL;
uint8_t * Jump = nullptr;
if (IsKnown(m_Opcode.rs) && IsKnown(m_Opcode.rt))
{
@ -945,7 +945,7 @@ void CArmRecompilerOps::BNE_Compare()
void CArmRecompilerOps::BEQ_Compare()
{
uint8_t *Jump = NULL;
uint8_t *Jump = nullptr;
if (IsKnown(m_Opcode.rs) && IsKnown(m_Opcode.rt))
{
@ -1311,7 +1311,7 @@ void CArmRecompilerOps::BGTZ_Compare()
}
else
{
uint8_t *Jump = NULL;
uint8_t *Jump = nullptr;
if (IsMapped(m_Opcode.rs))
{
@ -1446,7 +1446,7 @@ void CArmRecompilerOps::BLEZ_Compare()
}
else
{
uint8_t *Jump = NULL;
uint8_t *Jump = nullptr;
ArmReg TempRegRs = Arm_Any;
if (IsMapped(m_Opcode.rs))
@ -1516,7 +1516,7 @@ void CArmRecompilerOps::BLEZ_Compare()
}
else
{
uint8_t *Jump = NULL;
uint8_t *Jump = nullptr;
if (!g_System->b32BitCore())
{
@ -1843,7 +1843,7 @@ void CArmRecompilerOps::J()
m_Section->m_Jump.TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);;
m_Section->m_Jump.JumpPC = m_CompilePC;
if (m_Section->m_JumpSection != NULL)
if (m_Section->m_JumpSection != nullptr)
{
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
}
@ -1852,8 +1852,8 @@ void CArmRecompilerOps::J()
m_Section->m_Jump.BranchLabel = "ExitBlock";
}
m_Section->m_Jump.FallThrough = true;
m_Section->m_Jump.LinkLocation = NULL;
m_Section->m_Jump.LinkLocation2 = NULL;
m_Section->m_Jump.LinkLocation = nullptr;
m_Section->m_Jump.LinkLocation2 = nullptr;
m_NextInstruction = DO_DELAY_SLOT;
}
else if (m_NextInstruction == DELAY_SLOT_DONE)
@ -1889,7 +1889,7 @@ void CArmRecompilerOps::JAL()
}
m_Section->m_Jump.TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);
m_Section->m_Jump.JumpPC = m_CompilePC;
if (m_Section->m_JumpSection != NULL)
if (m_Section->m_JumpSection != nullptr)
{
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
}
@ -1898,8 +1898,8 @@ void CArmRecompilerOps::JAL()
m_Section->m_Jump.BranchLabel = "ExitBlock";
}
m_Section->m_Jump.FallThrough = true;
m_Section->m_Jump.LinkLocation = NULL;
m_Section->m_Jump.LinkLocation2 = NULL;
m_Section->m_Jump.LinkLocation = nullptr;
m_Section->m_Jump.LinkLocation2 = nullptr;
m_NextInstruction = DO_DELAY_SLOT;
}
else if (m_NextInstruction == DELAY_SLOT_DONE)
@ -2894,11 +2894,11 @@ void CArmRecompilerOps::SPECIAL_JR()
}
m_Section->m_Jump.FallThrough = false;
m_Section->m_Jump.LinkLocation = NULL;
m_Section->m_Jump.LinkLocation2 = NULL;
m_Section->m_Jump.LinkLocation = nullptr;
m_Section->m_Jump.LinkLocation2 = nullptr;
m_Section->m_Cont.FallThrough = false;
m_Section->m_Cont.LinkLocation = NULL;
m_Section->m_Cont.LinkLocation2 = NULL;
m_Section->m_Cont.LinkLocation = nullptr;
m_Section->m_Cont.LinkLocation2 = nullptr;
if (DelaySlotEffectsCompare(m_CompilePC, m_Opcode.rs, 0))
{
@ -3006,11 +3006,11 @@ void CArmRecompilerOps::SPECIAL_JALR()
}
m_Section->m_Jump.FallThrough = false;
m_Section->m_Jump.LinkLocation = NULL;
m_Section->m_Jump.LinkLocation2 = NULL;
m_Section->m_Jump.LinkLocation = nullptr;
m_Section->m_Jump.LinkLocation2 = nullptr;
m_Section->m_Cont.FallThrough = false;
m_Section->m_Cont.LinkLocation = NULL;
m_Section->m_Cont.LinkLocation2 = NULL;
m_Section->m_Cont.LinkLocation = nullptr;
m_Section->m_Cont.LinkLocation2 = nullptr;
m_NextInstruction = DO_DELAY_SLOT;
}
@ -5471,11 +5471,11 @@ void CArmRecompilerOps::SetRegWorkingSet(const CRegInfo & RegInfo)
bool CArmRecompilerOps::InheritParentInfo()
{
if (m_Section->m_CompiledLocation == NULL)
if (m_Section->m_CompiledLocation == nullptr)
{
m_Section->m_CompiledLocation = *g_RecompPos;
m_Section->DisplaySectionInformation();
m_Section->m_CompiledLocation = NULL;
m_Section->m_CompiledLocation = nullptr;
}
else
{
@ -5491,7 +5491,7 @@ bool CArmRecompilerOps::InheritParentInfo()
if (m_Section->m_ParentSection.size() == 1)
{
CCodeSection * Parent = *(m_Section->m_ParentSection.begin());
if (Parent->m_CompiledLocation == NULL)
if (Parent->m_CompiledLocation == nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
@ -5511,7 +5511,7 @@ bool CArmRecompilerOps::InheritParentInfo()
CCodeSection * Parent = *iter;
BLOCK_PARENT BlockParent;
if (Parent->m_CompiledLocation == NULL) { continue; }
if (Parent->m_CompiledLocation == nullptr) { continue; }
if (Parent->m_JumpSection != Parent->m_ContinueSection)
{
BlockParent.Parent = Parent;
@ -5541,7 +5541,7 @@ bool CArmRecompilerOps::InheritParentInfo()
CCodeSection * Parent = *iter;
BLOCK_PARENT BlockParent;
if (Parent->m_CompiledLocation != NULL) { continue; }
if (Parent->m_CompiledLocation != nullptr) { continue; }
if (Parent->m_JumpSection != Parent->m_ContinueSection)
{
BlockParent.Parent = Parent;
@ -5624,7 +5624,7 @@ bool CArmRecompilerOps::InheritParentInfo()
if (i == (size_t)FirstParent) { continue; }
Parent = ParentList[i].Parent;
if (Parent->m_CompiledLocation == NULL)
if (Parent->m_CompiledLocation == nullptr)
{
continue;
}
@ -5837,20 +5837,20 @@ bool CArmRecompilerOps::InheritParentInfo()
JumpInfo = ParentList[CurrentParent].JumpInfo;
BranchLabel20(ArmBranch_Always, Label.c_str());
JumpInfo->LinkLocation = (uint32_t *)(*g_RecompPos - 4);
JumpInfo->LinkLocation2 = NULL;
JumpInfo->LinkLocation2 = nullptr;
CurrentParent = i;
Parent = ParentList[CurrentParent].Parent;
JumpInfo = ParentList[CurrentParent].JumpInfo;
CPU_Message(" Section_%d (from %d):", m_Section->m_SectionID, Parent->m_SectionID);
if (JumpInfo->LinkLocation != NULL)
if (JumpInfo->LinkLocation != nullptr)
{
SetJump20(JumpInfo->LinkLocation, (uint32_t *)*g_RecompPos);
JumpInfo->LinkLocation = NULL;
if (JumpInfo->LinkLocation2 != NULL)
JumpInfo->LinkLocation = nullptr;
if (JumpInfo->LinkLocation2 != nullptr)
{
SetJump20(JumpInfo->LinkLocation2, (uint32_t *)*g_RecompPos);
JumpInfo->LinkLocation2 = NULL;
JumpInfo->LinkLocation2 = nullptr;
}
}
@ -5883,7 +5883,7 @@ bool CArmRecompilerOps::InheritParentInfo()
void CArmRecompilerOps::LinkJump(CJumpInfo & JumpInfo, uint32_t SectionID, uint32_t FromSectionID)
{
if (JumpInfo.LinkLocation != NULL)
if (JumpInfo.LinkLocation != nullptr)
{
if (SectionID != -1)
{
@ -5897,11 +5897,11 @@ void CArmRecompilerOps::LinkJump(CJumpInfo & JumpInfo, uint32_t SectionID, uint3
}
}
SetJump20(JumpInfo.LinkLocation, (uint32_t *)*g_RecompPos);
JumpInfo.LinkLocation = NULL;
if (JumpInfo.LinkLocation2 != NULL)
JumpInfo.LinkLocation = nullptr;
if (JumpInfo.LinkLocation2 != nullptr)
{
SetJump20(JumpInfo.LinkLocation2, (uint32_t *)*g_RecompPos);
JumpInfo.LinkLocation2 = NULL;
JumpInfo.LinkLocation2 = nullptr;
}
}
}
@ -6315,7 +6315,7 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
switch (PAddr)
{
case 0x04400000:
if (g_Plugins->Gfx()->ViStatusChanged != NULL)
if (g_Plugins->Gfx()->ViStatusChanged != nullptr)
{
ArmReg TempReg = Map_TempReg(Arm_Any, -1, false);
MoveVariableToArmReg(&g_Reg->VI_STATUS_REG, "VI_STATUS_REG", TempReg);
@ -6340,7 +6340,7 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
break;
case 0x04400004: MoveConstToVariable((Value & 0xFFFFFF), &g_Reg->VI_ORIGIN_REG, "VI_ORIGIN_REG"); break;
case 0x04400008:
if (g_Plugins->Gfx()->ViWidthChanged != NULL)
if (g_Plugins->Gfx()->ViWidthChanged != nullptr)
{
ArmReg TempReg = Map_TempReg(Arm_Any, -1, false);
MoveVariableToArmReg(&g_Reg->VI_WIDTH_REG, "VI_WIDTH_REG", TempReg);
@ -6743,7 +6743,7 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
case 0x04400000:
switch (PAddr) {
case 0x04400000:
if (g_Plugins->Gfx()->ViStatusChanged != NULL)
if (g_Plugins->Gfx()->ViStatusChanged != nullptr)
{
ArmReg TempReg = Map_TempReg(Arm_Any, -1, false);
MoveVariableToArmReg(&g_Reg->VI_STATUS_REG, "VI_STATUS_REG", TempReg);
@ -6767,7 +6767,7 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
AndConstToVariable(&g_Reg->VI_ORIGIN_REG, "VI_ORIGIN_REG", 0xFFFFFF);
break;
case 0x04400008:
if (g_Plugins->Gfx()->ViWidthChanged != NULL)
if (g_Plugins->Gfx()->ViWidthChanged != nullptr)
{
ArmReg TempReg = Map_TempReg(Arm_Any, -1, false);
MoveVariableToArmReg(&g_Reg->VI_WIDTH_REG, "VI_WIDTH_REG", TempReg);
@ -7223,7 +7223,7 @@ void CArmRecompilerOps::LW_KnownAddress(ArmReg Reg, uint32_t VAddr)
}
else
{
if (g_Plugins->Audio()->AiReadLength != NULL)
if (g_Plugins->Audio()->AiReadLength != nullptr)
{
m_RegWorkingSet.BeforeCallDirect();
CallFunction((void *)g_Plugins->Audio()->AiReadLength, "AiReadLength");

View File

@ -21,8 +21,8 @@ m_VAddrEnter(VAddrEnter),
m_VAddrFirst(VAddrEnter),
m_VAddrLast(VAddrEnter),
m_CompiledLocation(CompiledLocation),
m_EnterSection(NULL),
m_RecompilerOps(NULL),
m_EnterSection(nullptr),
m_RecompilerOps(nullptr),
m_Test(1)
{
#if defined(__arm__) || defined(_M_ARM)
@ -37,26 +37,26 @@ m_Test(1)
#elif defined(__arm__) || defined(_M_ARM)
m_RecompilerOps = new CArmRecompilerOps;
#endif
if (m_RecompilerOps == NULL)
if (m_RecompilerOps == nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
return;
}
CCodeSection * baseSection = new CCodeSection(this, VAddrEnter, 0, false);
if (baseSection == NULL)
if (baseSection == nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
m_Sections.push_back(baseSection);
baseSection->AddParent(NULL);
baseSection->AddParent(nullptr);
baseSection->m_CompiledLocation = (uint8_t *)-1;
baseSection->m_Cont.JumpPC = VAddrEnter;
baseSection->m_Cont.FallThrough = true;
baseSection->m_Cont.RegSet = baseSection->m_RegEnter;
m_EnterSection = new CCodeSection(this, VAddrEnter, 1, true);
if (m_EnterSection == NULL)
if (m_EnterSection == nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
@ -89,18 +89,18 @@ CCodeBlock::~CCodeBlock()
}
m_Sections.clear();
if (m_RecompilerOps != NULL)
if (m_RecompilerOps != nullptr)
{
#if defined(__i386__) || defined(_M_IX86)
delete (CX86RecompilerOps *)m_RecompilerOps;
#endif
m_RecompilerOps = NULL;
m_RecompilerOps = nullptr;
}
}
bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSection, uint32_t TargetPC, bool LinkAllowed, uint32_t CurrentPC)
{
if (Section != NULL)
if (Section != nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
@ -117,7 +117,7 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
if (LinkAllowed)
{
if (Section != NULL)
if (Section != nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
@ -129,10 +129,10 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
}
}
if (Section == NULL)
if (Section == nullptr)
{
Section = new CCodeSection(this, TargetPC, m_Sections.size(), LinkAllowed);
if (Section == NULL)
if (Section == nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
return false;
@ -145,7 +145,7 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
Section->AddParent(CurrentSection);
if (TargetPC <= CurrentPC && TargetPC != m_VAddrEnter)
{
CCodeSection * SplitSection = NULL;
CCodeSection * SplitSection = nullptr;
for (SectionMap::const_iterator itr = m_SectionMap.begin(); itr != m_SectionMap.end(); itr++)
{
if (itr->first >= TargetPC)
@ -154,7 +154,7 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
}
SplitSection = itr->second;
}
if (SplitSection == NULL)
if (SplitSection == nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
@ -182,7 +182,7 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
BaseSection->AddParent(SplitSection);
SplitSection->m_EndPC = TargetPC - 4;
SplitSection->m_JumpSection = NULL;
SplitSection->m_JumpSection = nullptr;
SplitSection->m_ContinueSection = BaseSection;
SplitSection->SetContinueAddress(TargetPC - 4, TargetPC);
SplitSection->SetJumpAddress((uint32_t)-1, (uint32_t)-1, false);
@ -204,12 +204,12 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
SectionMap::const_iterator itr = m_SectionMap.find(TestPC);
if (itr != m_SectionMap.end() && CurrentSection != itr->second)
{
if (CurrentSection->m_ContinueSection != NULL &&
if (CurrentSection->m_ContinueSection != nullptr &&
CurrentSection->m_ContinueSection != itr->second)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
if (CurrentSection->m_ContinueSection == NULL)
if (CurrentSection->m_ContinueSection == nullptr)
{
SetSection(CurrentSection->m_ContinueSection, CurrentSection, TestPC, true, TestPC);
CurrentSection->SetContinueAddress(TestPC - 4, TestPC);
@ -220,8 +220,8 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
CPU_Message("Section %d", CurrentSection->m_SectionID);
if (EnterSection != m_EnterSection)
{
if (CurrentSection->m_JumpSection != NULL ||
CurrentSection->m_ContinueSection != NULL ||
if (CurrentSection->m_JumpSection != nullptr ||
CurrentSection->m_ContinueSection != nullptr ||
CurrentSection->m_EndSection)
{
break;
@ -335,11 +335,11 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
TestPC += IncludeDelaySlot ? 8 : 4;
//Find the next section
CCodeSection * NewSection = NULL;
CCodeSection * NewSection = nullptr;
for (SectionMap::const_iterator itr = m_SectionMap.begin(); itr != m_SectionMap.end(); itr++)
{
if (CurrentSection->m_JumpSection != NULL ||
CurrentSection->m_ContinueSection != NULL ||
if (CurrentSection->m_JumpSection != nullptr ||
CurrentSection->m_ContinueSection != nullptr ||
CurrentSection->m_EndSection)
{
continue;
@ -347,7 +347,7 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
NewSection = itr->second;
break;
}
if (NewSection == NULL)
if (NewSection == nullptr)
{
break;
}
@ -356,8 +356,8 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
g_Notify->BreakPoint(__FILE__, __LINE__);
}
CurrentSection = NewSection;
if (CurrentSection->m_JumpSection != NULL ||
CurrentSection->m_ContinueSection != NULL ||
if (CurrentSection->m_JumpSection != nullptr ||
CurrentSection->m_ContinueSection != nullptr ||
CurrentSection->m_EndSection)
{
break;
@ -370,8 +370,8 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
for (SectionMap::iterator itr = m_SectionMap.begin(); itr != m_SectionMap.end(); itr++)
{
CCodeSection * Section = itr->second;
if (Section->m_JumpSection != NULL ||
Section->m_ContinueSection != NULL ||
if (Section->m_JumpSection != nullptr ||
Section->m_ContinueSection != nullptr ||
Section->m_EndSection)
{
continue;
@ -754,11 +754,11 @@ bool CCodeBlock::Compile()
m_RecompilerOps->EnterCodeBlock();
if (g_System->bLinkBlocks())
{
while (m_EnterSection !=NULL && m_EnterSection->GenerateNativeCode(NextTest()));
while (m_EnterSection !=nullptr && m_EnterSection->GenerateNativeCode(NextTest()));
}
else
{
if (m_EnterSection == NULL || !m_EnterSection->GenerateNativeCode(NextTest()))
if (m_EnterSection == nullptr || !m_EnterSection->GenerateNativeCode(NextTest()))
{
return false;
}

View File

@ -149,13 +149,13 @@ CCodeSection::CCodeSection(CCodeBlock * CodeBlock, uint32_t EnterPC, uint32_t ID
m_SectionID(ID),
m_EnterPC(EnterPC),
m_EndPC((uint32_t)-1),
m_ContinueSection(NULL),
m_JumpSection(NULL),
m_ContinueSection(nullptr),
m_JumpSection(nullptr),
m_EndSection(false),
m_LinkAllowed(LinkAllowed),
m_Test(0),
m_Test2(0),
m_CompiledLocation(NULL),
m_CompiledLocation(nullptr),
m_InLoop(false),
m_DelaySlot(false),
m_RecompilerOps(CodeBlock->RecompilerOps())
@ -176,7 +176,7 @@ void CCodeSection::GenerateSectionLinkage()
for (i = 0; i < 2; i++)
{
if (JumpInfo[i]->LinkLocation == NULL &&
if (JumpInfo[i]->LinkLocation == nullptr &&
JumpInfo[i]->FallThrough == false)
{
JumpInfo[i]->TargetPC = (uint32_t)-1;
@ -188,46 +188,46 @@ void CCodeSection::GenerateSectionLinkage()
g_Notify->BreakPoint(__FILE__, __LINE__);
#ifdef legacycode
//Handle Fall througth
uint8_t * Jump = NULL;
uint8_t * Jump = nullptr;
for (i = 0; i < 2; i ++)
{
if (!JumpInfo[i]->FallThrough) { continue; }
JumpInfo[i]->FallThrough = false;
if (JumpInfo[i]->LinkLocation != NULL)
if (JumpInfo[i]->LinkLocation != nullptr)
{
SetJump32(JumpInfo[i]->LinkLocation,(uint32_t *)*g_RecompPos);
JumpInfo[i]->LinkLocation = NULL;
if (JumpInfo[i]->LinkLocation2 != NULL)
JumpInfo[i]->LinkLocation = nullptr;
if (JumpInfo[i]->LinkLocation2 != nullptr)
{
SetJump32(JumpInfo[i]->LinkLocation2,(uint32_t *)*g_RecompPos);
JumpInfo[i]->LinkLocation2 = NULL;
JumpInfo[i]->LinkLocation2 = nullptr;
}
}
PushImm32(stdstr_f("0x%08X",JumpInfo[i]->TargetPC).c_str(),JumpInfo[i]->TargetPC);
if (JumpInfo[(i + 1) & 1]->LinkLocation == NULL) { break; }
if (JumpInfo[(i + 1) & 1]->LinkLocation == nullptr) { break; }
JmpLabel8("FinishBlock",0);
Jump = *g_RecompPos - 1;
}
for (i = 0; i < 2; i ++)
{
if (JumpInfo[i]->LinkLocation == NULL) { continue; }
if (JumpInfo[i]->LinkLocation == nullptr) { continue; }
JumpInfo[i]->FallThrough = false;
if (JumpInfo[i]->LinkLocation != NULL)
if (JumpInfo[i]->LinkLocation != nullptr)
{
SetJump32(JumpInfo[i]->LinkLocation,(uint32_t *)*g_RecompPos);
JumpInfo[i]->LinkLocation = NULL;
if (JumpInfo[i]->LinkLocation2 != NULL)
JumpInfo[i]->LinkLocation = nullptr;
if (JumpInfo[i]->LinkLocation2 != nullptr)
{
SetJump32(JumpInfo[i]->LinkLocation2,(uint32_t *)*g_RecompPos);
JumpInfo[i]->LinkLocation2 = NULL;
JumpInfo[i]->LinkLocation2 = nullptr;
}
}
PushImm32(stdstr_f("0x%08X",JumpInfo[i]->TargetPC).c_str(),JumpInfo[i]->TargetPC);
if (JumpInfo[(i + 1) & 1]->LinkLocation == NULL) { break; }
if (JumpInfo[(i + 1) & 1]->LinkLocation == nullptr) { break; }
JmpLabel8("FinishBlock",0);
Jump = *g_RecompPos - 1;
}
if (Jump != NULL)
if (Jump != nullptr)
{
CPU_Message(" $FinishBlock:");
SetJump8(Jump,*g_RecompPos);
@ -261,25 +261,25 @@ void CCodeSection::GenerateSectionLinkage()
m_RecompilerOps->CompileInPermLoop(m_Jump.RegSet, m_RecompilerOps->GetCurrentPC());
}
}
if (TargetSection[0] != TargetSection[1] || TargetSection[0] == NULL)
if (TargetSection[0] != TargetSection[1] || TargetSection[0] == nullptr)
{
for (i = 0; i < 2; i++)
{
if (JumpInfo[i]->LinkLocation == NULL && JumpInfo[i]->FallThrough == false)
if (JumpInfo[i]->LinkLocation == nullptr && JumpInfo[i]->FallThrough == false)
{
if (TargetSection[i])
{
TargetSection[i]->UnlinkParent(this, i == 0);
TargetSection[i] = NULL;
TargetSection[i] = nullptr;
}
}
else if (TargetSection[i] == NULL && JumpInfo[i]->FallThrough)
else if (TargetSection[i] == nullptr && JumpInfo[i]->FallThrough)
{
m_RecompilerOps->LinkJump(*JumpInfo[i], (uint32_t)-1);
m_RecompilerOps->CompileExit(JumpInfo[i]->JumpPC, JumpInfo[i]->TargetPC, JumpInfo[i]->RegSet, JumpInfo[i]->ExitReason);
JumpInfo[i]->FallThrough = false;
}
else if (TargetSection[i] != NULL && JumpInfo[i] != NULL)
else if (TargetSection[i] != nullptr && JumpInfo[i] != nullptr)
{
if (!JumpInfo[i]->FallThrough) { continue; }
if (JumpInfo[i]->TargetPC == TargetSection[i]->m_EnterPC) { continue; }
@ -291,9 +291,9 @@ void CCodeSection::GenerateSectionLinkage()
}
else
{
if (m_Cont.LinkLocation == NULL && m_Cont.FallThrough == false) { m_ContinueSection = NULL; }
if (m_Jump.LinkLocation == NULL && m_Jump.FallThrough == false) { m_JumpSection = NULL; }
if (m_JumpSection == NULL && m_ContinueSection == NULL)
if (m_Cont.LinkLocation == nullptr && m_Cont.FallThrough == false) { m_ContinueSection = nullptr; }
if (m_Jump.LinkLocation == nullptr && m_Jump.FallThrough == false) { m_JumpSection = nullptr; }
if (m_JumpSection == nullptr && m_ContinueSection == nullptr)
{
//FreeSection(TargetSection[0],Section);
}
@ -303,10 +303,10 @@ void CCodeSection::GenerateSectionLinkage()
TargetSection[1] = m_JumpSection;
for (i = 0; i < 2; i++) {
if (TargetSection[i] == NULL) { continue; }
if (TargetSection[i] == nullptr) { continue; }
if (!JumpInfo[i]->FallThrough) { continue; }
if (TargetSection[i]->m_CompiledLocation != NULL)
if (TargetSection[i]->m_CompiledLocation != nullptr)
{
JumpInfo[i]->FallThrough = false;
m_RecompilerOps->LinkJump(*JumpInfo[i], TargetSection[i]->m_SectionID);
@ -338,13 +338,13 @@ void CCodeSection::GenerateSectionLinkage()
for (i = 0; i < 2; i++)
{
if (TargetSection[i] == NULL) { continue; }
if (TargetSection[i] == nullptr) { continue; }
if (TargetSection[i]->m_ParentSection.empty()) { continue; }
for (SECTION_LIST::iterator iter = TargetSection[i]->m_ParentSection.begin(); iter != TargetSection[i]->m_ParentSection.end(); iter++)
{
CCodeSection * Parent = *iter;
if (Parent->m_CompiledLocation != NULL) { continue; }
if (Parent->m_CompiledLocation != nullptr) { continue; }
if (Parent->m_InLoop) { continue; }
if (JumpInfo[i]->PermLoop)
{
@ -376,7 +376,7 @@ void CCodeSection::GenerateSectionLinkage()
for (i = 0; i < 2; i++)
{
if (JumpInfo[i]->FallThrough && (TargetSection[i] == NULL || !TargetSection[i]->GenerateNativeCode(m_BlockInfo->NextTest())))
if (JumpInfo[i]->FallThrough && (TargetSection[i] == nullptr || !TargetSection[i]->GenerateNativeCode(m_BlockInfo->NextTest())))
{
JumpInfo[i]->FallThrough = false;
m_RecompilerOps->JumpToUnknown(JumpInfo[i]);
@ -386,8 +386,8 @@ void CCodeSection::GenerateSectionLinkage()
//CPU_Message("Section %d",m_SectionID);
for (i = 0; i < 2; i++)
{
if (JumpInfo[i]->LinkLocation == NULL) { continue; }
if (TargetSection[i] == NULL)
if (JumpInfo[i]->LinkLocation == nullptr) { continue; }
if (TargetSection[i] == nullptr)
{
CPU_Message("ExitBlock (from %d):", m_SectionID);
m_RecompilerOps->LinkJump(*JumpInfo[i], (uint32_t)-1);
@ -398,7 +398,7 @@ void CCodeSection::GenerateSectionLinkage()
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
if (TargetSection[i]->m_CompiledLocation == NULL)
if (TargetSection[i]->m_CompiledLocation == nullptr)
{
TargetSection[i]->GenerateNativeCode(m_BlockInfo->NextTest());
}
@ -460,7 +460,7 @@ bool CCodeSection::ParentContinue()
for (SECTION_LIST::iterator iter = m_ParentSection.begin(); iter != m_ParentSection.end(); iter++)
{
CCodeSection * Parent = *iter;
if (Parent->m_CompiledLocation != NULL) { continue; }
if (Parent->m_CompiledLocation != nullptr) { continue; }
if (IsAllParentLoops(Parent, true, m_BlockInfo->NextTest())) { continue; }
return false;
}
@ -475,15 +475,15 @@ bool CCodeSection::ParentContinue()
bool CCodeSection::GenerateNativeCode(uint32_t Test)
{
if (m_CompiledLocation != NULL)
if (m_CompiledLocation != nullptr)
{
if (m_Test == Test)
{
return false;
}
m_Test = Test;
if (m_ContinueSection != NULL && m_ContinueSection->GenerateNativeCode(Test)) { return true; }
if (m_JumpSection != NULL && m_JumpSection->GenerateNativeCode(Test)) { return true; }
if (m_ContinueSection != nullptr && m_ContinueSection->GenerateNativeCode(Test)) { return true; }
if (m_JumpSection != nullptr && m_JumpSection->GenerateNativeCode(Test)) { return true; }
return false;
}
@ -868,7 +868,7 @@ bool CCodeSection::GenerateNativeCode(uint32_t Test)
void CCodeSection::AddParent(CCodeSection * Parent)
{
if (Parent == NULL)
if (Parent == nullptr)
{
m_RecompilerOps->SetRegWorkingSet(m_RegEnter);
return;
@ -981,11 +981,11 @@ void CCodeSection::DetermineLoop(uint32_t Test, uint32_t Test2, uint32_t TestID)
if (m_Test != Test)
{
m_Test = Test;
if (m_ContinueSection != NULL)
if (m_ContinueSection != nullptr)
{
m_ContinueSection->DetermineLoop(Test, m_BlockInfo->NextTest(), m_ContinueSection->m_SectionID);
}
if (m_JumpSection != NULL)
if (m_JumpSection != nullptr)
{
m_JumpSection->DetermineLoop(Test, m_BlockInfo->NextTest(), m_JumpSection->m_SectionID);
}
@ -1019,15 +1019,15 @@ CCodeSection * CCodeSection::ExistingSection(uint32_t Addr, uint32_t Test)
{
return this;
}
if (m_Test == Test) { return NULL; }
if (m_Test == Test) { return nullptr; }
m_Test = Test;
CCodeSection * Section = m_JumpSection ? m_JumpSection->ExistingSection(Addr, Test) : NULL;
if (Section != NULL) { return Section; }
Section = m_ContinueSection ? m_ContinueSection->ExistingSection(Addr, Test) : NULL;
if (Section != NULL) { return Section; }
CCodeSection * Section = m_JumpSection ? m_JumpSection->ExistingSection(Addr, Test) : nullptr;
if (Section != nullptr) { return Section; }
Section = m_ContinueSection ? m_ContinueSection->ExistingSection(Addr, Test) : nullptr;
if (Section != nullptr) { return Section; }
return NULL;
return nullptr;
}
bool CCodeSection::SectionAccessible(uint32_t SectionId, uint32_t Test)
@ -1071,12 +1071,12 @@ void CCodeSection::UnlinkParent(CCodeSection * Parent, bool ContinueSection)
if (ContinueSection && Parent->m_ContinueSection == this)
{
Parent->m_ContinueSection = NULL;
Parent->m_ContinueSection = nullptr;
}
if (!ContinueSection && Parent->m_JumpSection == this)
{
Parent->m_JumpSection = NULL;
Parent->m_JumpSection = nullptr;
}
bool bRemove = false;
@ -1093,7 +1093,7 @@ void CCodeSection::UnlinkParent(CCodeSection * Parent, bool ContinueSection)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
CodeSection->m_ContinueSection = NULL;
CodeSection->m_ContinueSection = nullptr;
}
if (CodeSection->m_JumpSection == this)
@ -1102,7 +1102,7 @@ void CCodeSection::UnlinkParent(CCodeSection * Parent, bool ContinueSection)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
CodeSection->m_JumpSection = NULL;
CodeSection->m_JumpSection = nullptr;
}
}
bRemove = true;
@ -1114,11 +1114,11 @@ void CCodeSection::UnlinkParent(CCodeSection * Parent, bool ContinueSection)
}
if (bRemove)
{
if (m_JumpSection != NULL)
if (m_JumpSection != nullptr)
{
m_JumpSection->UnlinkParent(this, false);
}
if (m_ContinueSection != NULL)
if (m_ContinueSection != nullptr)
{
m_ContinueSection->UnlinkParent(this, true);
}
@ -1127,7 +1127,7 @@ void CCodeSection::UnlinkParent(CCodeSection * Parent, bool ContinueSection)
bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test)
{
if (IgnoreIfCompiled && Parent->m_CompiledLocation != NULL) { return true; }
if (IgnoreIfCompiled && Parent->m_CompiledLocation != nullptr) { return true; }
if (!m_InLoop) { return false; }
if (!Parent->m_InLoop) { return false; }
if (Parent->m_ParentSection.empty()) { return false; }
@ -1153,8 +1153,8 @@ bool CCodeSection::DisplaySectionInformation(uint32_t ID, uint32_t Test)
m_Test = Test;
if (m_SectionID != ID)
{
if (m_ContinueSection != NULL && m_ContinueSection->DisplaySectionInformation(ID, Test)) { return true; }
if (m_JumpSection != NULL && m_JumpSection->DisplaySectionInformation(ID, Test)) { return true; }
if (m_ContinueSection != nullptr && m_ContinueSection->DisplaySectionInformation(ID, Test)) { return true; }
if (m_JumpSection != nullptr && m_JumpSection->DisplaySectionInformation(ID, Test)) { return true; }
return false;
}
DisplaySectionInformation();
@ -1194,7 +1194,7 @@ void CCodeSection::DisplaySectionInformation()
{
CPU_Message("Jump Address: 0x%08X", m_Jump.JumpPC);
CPU_Message("Jump Target Address: 0x%08X", m_Jump.TargetPC);
if (m_JumpSection != NULL)
if (m_JumpSection != nullptr)
{
CPU_Message("Jump Section: %d", m_JumpSection->m_SectionID);
}
@ -1204,7 +1204,7 @@ void CCodeSection::DisplaySectionInformation()
}
CPU_Message("Continue Address: 0x%08X", m_Cont.JumpPC);
CPU_Message("Continue Target Address: 0x%08X", m_Cont.TargetPC);
if (m_ContinueSection != NULL) {
if (m_ContinueSection != nullptr) {
CPU_Message("Continue Section: %d", m_ContinueSection->m_SectionID);
}
else

View File

@ -8,7 +8,7 @@ CCompiledFunc::CCompiledFunc( const CCodeBlock & CodeBlock ) :
m_Hash(CodeBlock.Hash()),
m_Function((Func)CodeBlock.CompiledLocation()),
m_FunctionEnd(CodeBlock.CompiledLocationEnd()),
m_Next(NULL)
m_Next(nullptr)
{
m_MemContents[0] = CodeBlock.MemContents(0);
m_MemContents[1] = CodeBlock.MemContents(1);

View File

@ -4,8 +4,8 @@
#include <Project64-core/N64System/N64Class.h>
CFunctionMap::CFunctionMap() :
m_JumpTable(NULL),
m_FunctionTable(NULL)
m_JumpTable(nullptr),
m_FunctionTable(nullptr)
{
}
@ -17,10 +17,10 @@ CFunctionMap::~CFunctionMap()
bool CFunctionMap::AllocateMemory()
{
WriteTrace(TraceRecompiler, TraceDebug, "start");
if (LookUpMode() == FuncFind_VirtualLookup && m_FunctionTable == NULL)
if (LookUpMode() == FuncFind_VirtualLookup && m_FunctionTable == nullptr)
{
m_FunctionTable = new PCCompiledFunc_TABLE[0x100000];
if (m_FunctionTable == NULL)
if (m_FunctionTable == nullptr)
{
WriteTrace(TraceRecompiler, TraceError, "failed to allocate function table");
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
@ -28,10 +28,10 @@ bool CFunctionMap::AllocateMemory()
}
memset(m_FunctionTable, 0, 0x100000 * sizeof(PCCompiledFunc_TABLE));
}
if (LookUpMode() == FuncFind_PhysicalLookup && m_JumpTable == NULL)
if (LookUpMode() == FuncFind_PhysicalLookup && m_JumpTable == nullptr)
{
m_JumpTable = new PCCompiledFunc[RdramSize() >> 2];
if (m_JumpTable == NULL)
if (m_JumpTable == nullptr)
{
WriteTrace(TraceRecompiler, TraceError, "failed to allocate jump table");
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
@ -49,18 +49,18 @@ void CFunctionMap::CleanBuffers()
{
for (int i = 0, n = 0x100000; i < n; i++)
{
if (m_FunctionTable[i] != NULL)
if (m_FunctionTable[i] != nullptr)
{
delete m_FunctionTable[i];
}
}
delete[] m_FunctionTable;
m_FunctionTable = NULL;
m_FunctionTable = nullptr;
}
if (m_JumpTable)
{
delete[] m_JumpTable;
m_JumpTable = NULL;
m_JumpTable = nullptr;
}
}

View File

@ -82,7 +82,7 @@ bool LoopAnalysis::SetupEnterSection(CCodeSection * Section, bool & bChanged, bo
CCodeSection * Parent = *iter;
CPU_Message("%s: Parent Section ID %d Test: %X Section Test: %X CompiledLocation: %X", __FUNCTION__, Parent->m_SectionID, m_Test, Parent->m_Test, Parent->m_CompiledLocation);
if (Parent->m_Test != m_Test && (m_EnterSection != Section || Parent->m_CompiledLocation == NULL) && Parent->m_InLoop)
if (Parent->m_Test != m_Test && (m_EnterSection != Section || Parent->m_CompiledLocation == nullptr) && Parent->m_InLoop)
{
CPU_Message("%s: Ignore Parent Section ID %d Test: %X Section Test: %X CompiledLocation: %X", __FUNCTION__, Parent->m_SectionID, m_Test, Parent->m_Test, Parent->m_CompiledLocation);
bSkipedSection = true;
@ -140,7 +140,7 @@ bool LoopAnalysis::SetupEnterSection(CCodeSection * Section, bool & bChanged, bo
bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
{
if (Section == NULL) { return true; }
if (Section == nullptr) { return true; }
if (!Section->m_InLoop) { return true; }
CPU_Message("%s: Section %d Block PC: 0x%X", __FUNCTION__, Section->m_SectionID, m_BlockInfo->VAddrEnter());
@ -253,13 +253,13 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
m_NextInstruction = DELAY_SLOT;
#ifdef CHECKED_BUILD
if (Section->m_Cont.TargetPC != m_PC + 8 &&
Section->m_ContinueSection != NULL &&
Section->m_ContinueSection != nullptr &&
Section->m_Cont.TargetPC != (uint32_t)-1)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
if (Section->m_Jump.TargetPC != m_PC + ((int16_t)m_Command.offset << 2) + 4 &&
Section->m_JumpSection != NULL &&
Section->m_JumpSection != nullptr &&
Section->m_Jump.TargetPC != (uint32_t)-1)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
@ -278,13 +278,13 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
m_NextInstruction = LIKELY_DELAY_SLOT;
#ifdef CHECKED_BUILD
if (Section->m_Cont.TargetPC != m_PC + 8 &&
Section->m_ContinueSection != NULL &&
Section->m_ContinueSection != nullptr &&
Section->m_Cont.TargetPC != (uint32_t)-1)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
if (Section->m_Jump.TargetPC != m_PC + 4 &&
Section->m_JumpSection != NULL &&
Section->m_JumpSection != nullptr &&
Section->m_Jump.TargetPC != (uint32_t)-1)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
@ -410,7 +410,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
if (m_Command.rs != 0 || m_Command.rt != 0)
{
if (Section->m_Cont.TargetPC != m_PC + 8 &&
Section->m_ContinueSection != NULL &&
Section->m_ContinueSection != nullptr &&
Section->m_Cont.TargetPC != (uint32_t)-1)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
@ -445,13 +445,13 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
m_NextInstruction = DELAY_SLOT;
#ifdef CHECKED_BUILD
if (Section->m_Cont.TargetPC != m_PC + 8 &&
Section->m_ContinueSection != NULL &&
Section->m_ContinueSection != nullptr &&
Section->m_Cont.TargetPC != (uint32_t)-1)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
if (Section->m_Jump.TargetPC != m_PC + ((int16_t)m_Command.offset << 2) + 4 &&
Section->m_JumpSection != NULL &&
Section->m_JumpSection != nullptr &&
Section->m_Jump.TargetPC != (uint32_t)-1)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
@ -572,7 +572,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
m_NextInstruction = LIKELY_DELAY_SLOT;
#ifdef CHECKED_BUILD
if (Section->m_Cont.TargetPC != m_PC + 8 &&
Section->m_ContinueSection != NULL &&
Section->m_ContinueSection != nullptr &&
Section->m_Cont.TargetPC != (uint32_t)-1)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
@ -597,7 +597,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
m_NextInstruction = DELAY_SLOT;
#ifdef CHECKED_BUILD
if (Section->m_Cont.TargetPC != m_PC + 8 &&
Section->m_ContinueSection != NULL &&
Section->m_ContinueSection != nullptr &&
Section->m_Cont.TargetPC != (uint32_t)-1)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
@ -639,7 +639,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
m_NextInstruction = LIKELY_DELAY_SLOT;
#ifdef CHECKED_BUILD
if (Section->m_Cont.TargetPC != m_PC + 8 &&
Section->m_ContinueSection != NULL &&
Section->m_ContinueSection != nullptr &&
Section->m_Cont.TargetPC != (uint32_t)-1)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
@ -953,12 +953,12 @@ void LoopAnalysis::SPECIAL_JALR()
void LoopAnalysis::SPECIAL_SYSCALL(CCodeSection * Section)
{
#ifdef CHECKED_BUILD
if (Section->m_ContinueSection != NULL &&
if (Section->m_ContinueSection != nullptr &&
Section->m_Cont.TargetPC != (uint32_t)-1)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
if (Section->m_JumpSection != NULL &&
if (Section->m_JumpSection != nullptr &&
Section->m_Jump.TargetPC != (uint32_t)-1)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
@ -973,12 +973,12 @@ void LoopAnalysis::SPECIAL_SYSCALL(CCodeSection * Section)
void LoopAnalysis::SPECIAL_BREAK(CCodeSection * Section)
{
#ifdef CHECKED_BUILD
if (Section->m_ContinueSection != NULL &&
if (Section->m_ContinueSection != nullptr &&
Section->m_Cont.TargetPC != (uint32_t)-1)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
if (Section->m_JumpSection != NULL &&
if (Section->m_JumpSection != nullptr &&
Section->m_Jump.TargetPC != (uint32_t)-1)
{
g_Notify->BreakPoint(__FILE__, __LINE__);

View File

@ -120,22 +120,22 @@ void CRecompiler::RecompilerMain_VirtualTable()
if (table)
{
CCompiledFunc * info = table[TableEntry];
if (info != NULL)
if (info != nullptr)
{
(info->Function())();
continue;
}
}
CCompiledFunc * info = CompileCode();
if (info == NULL || m_EndEmulation)
if (info == nullptr || m_EndEmulation)
{
break;
}
if (table == NULL)
if (table == nullptr)
{
table = new PCCompiledFunc[(0x1000 >> 2)];
if (table == NULL)
if (table == nullptr)
{
WriteTrace(TraceRecompiler, TraceError, "failed to allocate PCCompiledFunc");
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
@ -165,7 +165,7 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
{
CCompiledFunc * Info = m_FunctionsDelaySlot.FindFunction(PROGRAM_COUNTER);
//Find Block on hash table
if (Info == NULL)
if (Info == nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
#ifdef legacycode
@ -184,7 +184,7 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
//Find Block on hash table
Info = CompileDelaySlot(PROGRAM_COUNTER);
if (Info == NULL || EndEmulation())
if (Info == nullptr || EndEmulation())
{
break;
}
@ -195,7 +195,7 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
{
ClearRecompCode_Virt((Info->VStartPC() - 0x1000) & ~0xFFF, 0x2000, Remove_ValidateFunc);
NextInstruction = DELAY_SLOT;
Info = NULL;
Info = nullptr;
continue;
}
_asm {
@ -209,13 +209,13 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
if (table)
{
CCompiledFunc * info = table[(PROGRAM_COUNTER & 0xFFF) >> 2];
if (info != NULL)
if (info != nullptr)
{
if ((*info->MemLocation[0] != info->MemContents[0]) ||
(*info->MemLocation[1] != info->MemContents[1]))
{
ClearRecompCode_Virt((info->VStartPC() - 0x1000) & ~0xFFF, 0x3000, Remove_ValidateFunc);
info = NULL;
info = nullptr;
continue;
}
const uint8_t * Block = info->FunctionAddr();
@ -242,7 +242,7 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
#endif
CCompiledFunc * info = CompileCode();
if (info == NULL || EndEmulation())
if (info == nullptr || EndEmulation())
{
break;
}
@ -265,11 +265,11 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
CCompiledFunc * Info = m_FunctionsDelaySlot.FindFunction(PROGRAM_COUNTER);
//Find Block on hash table
if (Info == NULL)
if (Info == nullptr)
{
Info = CompileDelaySlot(PROGRAM_COUNTER);
if (Info == NULL || EndEmulation())
if (Info == nullptr || EndEmulation())
{
break;
}
@ -281,7 +281,7 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
{
ClearRecompCode_Virt((Info->StartPC() - 0x1000) & ~0xFFF, 0x2000, Remove_ValidateFunc);
NextInstruction = DELAY_SLOT;
Info = NULL;
Info = nullptr;
continue;
}
}
@ -297,11 +297,11 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
CCompiledFunc * Info = m_Functions.FindFunction(PROGRAM_COUNTER);
//Find Block on hash table
if (Info == NULL)
if (Info == nullptr)
{
Info = CompileCode();
if (Info == NULL || EndEmulation())
if (Info == nullptr || EndEmulation())
{
break;
}
@ -312,7 +312,7 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
(*Info->MemLocation[1] != Info->MemContents[1]))
{
ClearRecompCode_Virt((Info->StartPC() - 0x1000) & ~0xFFF, 0x3000, Remove_ValidateFunc);
Info = NULL;
Info = nullptr;
continue;
}
}
@ -334,10 +334,10 @@ void CRecompiler::RecompilerMain_Lookup()
if (PhysicalAddr < g_System->RdramSize())
{
CCompiledFunc * info = JumpTable()[PhysicalAddr >> 2];
if (info == NULL)
if (info == nullptr)
{
info = CompileCode();
if (info == NULL || m_EndEmulation)
if (info == nullptr || m_EndEmulation)
{
break;
}
@ -395,11 +395,11 @@ void CRecompiler::RecompilerMain_Lookup()
CCompiledFunc * Info = m_FunctionsDelaySlot.FindFunction(PROGRAM_COUNTER);
//Find Block on hash table
if (Info == NULL)
if (Info == nullptr)
{
Info = CompileDelaySlot(PROGRAM_COUNTER);
if (Info == NULL || EndEmulation())
if (Info == nullptr || EndEmulation())
{
break;
}
@ -411,7 +411,7 @@ void CRecompiler::RecompilerMain_Lookup()
{
ClearRecompCode_Virt((Info->VStartPC() - 0x1000) & ~0xFFF,0x2000,Remove_ValidateFunc);
NextInstruction = DELAY_SLOT;
Info = NULL;
Info = nullptr;
continue;
}
}
@ -464,11 +464,11 @@ void CRecompiler::RecompilerMain_Lookup()
}
}
if (Info == NULL)
if (Info == nullptr)
{
Info = CompileCode();
if (Info == NULL || EndEmulation())
if (Info == nullptr || EndEmulation())
{
break;
}
@ -484,7 +484,7 @@ void CRecompiler::RecompilerMain_Lookup()
(*Info->MemLocation[1] != Info->MemContents[1]))
{
ClearRecompCode_Virt((Info->VStartPC() - 0x1000) & ~0xFFF,0x3000,Remove_ValidateFunc);
Info = NULL;
Info = nullptr;
continue;
}
}
@ -538,10 +538,10 @@ void CRecompiler::RecompilerMain_Lookup_TLB()
{
CCompiledFunc * info = JumpTable()[PhysicalAddr >> 2];
if (info == NULL)
if (info == nullptr)
{
info = CompileCode();
if (info == NULL || m_EndEmulation)
if (info == nullptr || m_EndEmulation)
{
break;
}
@ -580,10 +580,10 @@ void CRecompiler::RecompilerMain_Lookup_validate()
if (PhysicalAddr < g_System->RdramSize())
{
CCompiledFunc * info = JumpTable()[PhysicalAddr >> 2];
if (info == NULL)
if (info == nullptr)
{
info = CompileCode();
if (info == NULL || m_EndEmulation)
if (info == nullptr || m_EndEmulation)
{
break;
}
@ -599,7 +599,7 @@ void CRecompiler::RecompilerMain_Lookup_validate()
*(info->MemLocation(1)) != info->MemContents(1))
{
ClearRecompCode_Virt((info->EnterPC() - 0x1000) & ~0xFFF, 0x3000, Remove_ValidateFunc);
info = NULL;
info = nullptr;
continue;
}
}
@ -648,10 +648,10 @@ void CRecompiler::RecompilerMain_Lookup_validate_TLB()
{
CCompiledFunc * info = JumpTable()[PhysicalAddr >> 2];
if (info == NULL)
if (info == nullptr)
{
info = CompileCode();
if (info == NULL || m_EndEmulation)
if (info == nullptr || m_EndEmulation)
{
break;
}
@ -675,10 +675,10 @@ void CRecompiler::RecompilerMain_Lookup_validate_TLB()
ClearRecompCode_Phys(0, 0x2000, Remove_ValidateFunc);
}
info = JumpTable()[PhysicalAddr >> 2];
if (info != NULL)
if (info != nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
info = NULL;
info = nullptr;
}
continue;
}
@ -754,7 +754,7 @@ void CRecompiler::ResetRecompCode(bool bAllocate)
for (CCompiledFuncList::iterator iter = m_Functions.begin(); iter != m_Functions.end(); iter++)
{
CCompiledFunc * Func = iter->second;
while (Func != NULL)
while (Func != nullptr)
{
CCompiledFunc * CurrentFunc = Func;
Func = Func->Next();
@ -808,15 +808,15 @@ void CRecompiler::RecompilerMain_ChangeMemory()
{
uint32_t Index = (Value & 0xFFFF);
Block = (uint8_t *)OrigMem[Index].CompiledLocation;
if (OrigMem[Index].PAddr != Addr) { Block = NULL; }
if (OrigMem[Index].VAddr != PROGRAM_COUNTER) { Block = NULL; }
if (Index >= TargetIndex) { Block = NULL; }
if (OrigMem[Index].PAddr != Addr) { Block = nullptr; }
if (OrigMem[Index].VAddr != PROGRAM_COUNTER) { Block = nullptr; }
if (Index >= TargetIndex) { Block = nullptr; }
}
else
{
Block = NULL;
Block = nullptr;
}
if (Block == NULL)
if (Block == nullptr)
{
uint32_t MemValue;
@ -852,13 +852,13 @@ void CRecompiler::RecompilerMain_ChangeMemory()
{
uint32_t Index = (Value & 0xFFFF);
Block = (uint8_t *)OrigMem[Index].CompiledLocation;
if (OrigMem[Index].PAddr != Addr) { Block = NULL; }
if (OrigMem[Index].VAddr != PROGRAM_COUNTER) { Block = NULL; }
if (Index >= TargetIndex) { Block = NULL; }
if (OrigMem[Index].PAddr != Addr) { Block = nullptr; }
if (OrigMem[Index].VAddr != PROGRAM_COUNTER) { Block = nullptr; }
if (Index >= TargetIndex) { Block = nullptr; }
}
else
{
Block = NULL;
Block = nullptr;
}
}
__except (EXCEPTION_EXECUTE_HANDLER)
@ -867,7 +867,7 @@ void CRecompiler::RecompilerMain_ChangeMemory()
ExitThread(0);
}
if (Block == NULL)
if (Block == nullptr)
{
uint32_t MemValue;
@ -943,14 +943,14 @@ CCompiledFunc * CRecompiler::CompileCode()
if (!m_MMU.TranslateVaddr(PROGRAM_COUNTER, pAddr))
{
WriteTrace(TraceRecompiler, TraceError, "Failed to translate %X", PROGRAM_COUNTER);
return NULL;
return nullptr;
}
CCompiledFuncList::iterator iter = m_Functions.find(PROGRAM_COUNTER);
if (iter != m_Functions.end())
{
WriteTrace(TraceRecompiler, TraceInfo, "exisiting functions for address (Program Counter: %X pAddr: %X)", PROGRAM_COUNTER, pAddr);
for (CCompiledFunc * Func = iter->second; Func != NULL; Func = Func->Next())
for (CCompiledFunc * Func = iter->second; Func != nullptr; Func = Func->Next())
{
uint32_t PAddr;
if (m_MMU.TranslateVaddr(Func->MinPC(), PAddr))
@ -974,7 +974,7 @@ CCompiledFunc * CRecompiler::CompileCode()
CCodeBlock CodeBlock(PROGRAM_COUNTER, *g_RecompPos);
if (!CodeBlock.Compile())
{
return NULL;
return nullptr;
}
if (bShowRecompMemSize())
@ -1081,7 +1081,7 @@ void CRecompiler::ClearRecompCode_Virt(uint32_t Address, int length, REMOVE_REAS
{
WriteTrace(TraceRecompiler, TraceError, "Delete Table (%X): Index = %d", table, AddressIndex);
delete table;
table = NULL;
table = nullptr;
m_MMU.UnProtectMemory(Address, Address + length);
}

View File

@ -7,7 +7,7 @@
#include <stdio.h>
#include <stdarg.h>
static CLog * g_CPULogFile = NULL;
static CLog * g_CPULogFile = nullptr;
void Recompiler_Log_Message(const char * strFormat, ...)
{
@ -15,7 +15,7 @@ void Recompiler_Log_Message(const char * strFormat, ...)
va_start(args, strFormat);
size_t nlen = _vscprintf(strFormat, args) + 1;
char * buffer = (char *)alloca((nlen + 3) * sizeof(char));
if (buffer != NULL)
if (buffer != nullptr)
{
if (nlen > 0)
{
@ -35,7 +35,7 @@ void Recompiler_Log_Message(const char * strFormat, ...)
void Start_Recompiler_Log (void)
{
CPath LogFileName(g_Settings->LoadStringVal(Directory_Log).c_str(), "CPUoutput.log");
if (g_CPULogFile != NULL)
if (g_CPULogFile != nullptr)
{
Stop_Recompiler_Log();
}
@ -49,23 +49,23 @@ void Start_Recompiler_Log (void)
else
{
delete g_CPULogFile;
g_CPULogFile = NULL;
g_CPULogFile = nullptr;
}
}
}
void Stop_Recompiler_Log (void)
{
if (g_CPULogFile != NULL)
if (g_CPULogFile != nullptr)
{
delete g_CPULogFile;
g_CPULogFile = NULL;
g_CPULogFile = nullptr;
}
}
void Flush_Recompiler_Log(void)
{
if (g_CPULogFile != NULL)
if (g_CPULogFile != nullptr)
{
g_CPULogFile->Flush();
}

View File

@ -5,10 +5,10 @@
#include <Common/MemoryManagement.h>
CRecompMemory::CRecompMemory() :
m_RecompCode(NULL),
m_RecompCode(nullptr),
m_RecompSize(0)
{
m_RecompPos = NULL;
m_RecompPos = nullptr;
}
CRecompMemory::~CRecompMemory()
@ -16,9 +16,9 @@ CRecompMemory::~CRecompMemory()
if (m_RecompCode)
{
FreeAddressSpace(m_RecompCode,MaxCompileBufferSize + 4);
m_RecompCode = NULL;
m_RecompCode = nullptr;
}
m_RecompPos = NULL;
m_RecompPos = nullptr;
}
bool CRecompMemory::AllocateMemory()
@ -26,7 +26,7 @@ bool CRecompMemory::AllocateMemory()
WriteTrace(TraceRecompiler, TraceDebug, "Start");
uint8_t * RecompCodeBase = (uint8_t *)AllocateAddressSpace(MaxCompileBufferSize + 4);
WriteTrace(TraceRecompiler, TraceDebug, "RecompCodeBase = %X", RecompCodeBase);
if (RecompCodeBase == NULL)
if (RecompCodeBase == nullptr)
{
WriteTrace(TraceRecompiler, TraceError, "failed to allocate RecompCodeBase");
g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR);
@ -34,7 +34,7 @@ bool CRecompMemory::AllocateMemory()
}
m_RecompCode = (uint8_t *)CommitMemory(RecompCodeBase, InitialCompileBufferSize, MEM_EXECUTE_READWRITE);
if (m_RecompCode == NULL)
if (m_RecompCode == nullptr)
{
WriteTrace(TraceRecompiler, TraceError, "failed to commit initial buffer");
FreeAddressSpace(RecompCodeBase,MaxCompileBufferSize + 4);
@ -61,7 +61,7 @@ void CRecompMemory::CheckRecompMem()
return;
}
void * MemAddr = CommitMemory(m_RecompCode + m_RecompSize, IncreaseCompileBufferSize, MEM_EXECUTE_READWRITE);
if (MemAddr == NULL)
if (MemAddr == nullptr)
{
WriteTrace(TraceRecompiler, TraceError, "failed to increase buffer");
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);

View File

@ -7,8 +7,8 @@ CJumpInfo::CJumpInfo()
TargetPC = (uint32_t)-1;
JumpPC = (uint32_t)-1;
BranchLabel = "";
LinkLocation = NULL;
LinkLocation2 = NULL;
LinkLocation = nullptr;
LinkLocation2 = nullptr;
FallThrough = false;
PermLoop = false;
DoneDelaySlot = false;
@ -19,7 +19,7 @@ CJumpInfo::CJumpInfo()
bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test)
{
if (IgnoreIfCompiled && Parent->CompiledLocation != NULL) { return true; }
if (IgnoreIfCompiled && Parent->CompiledLocation != nullptr) { return true; }
if (!InLoop) { return false; }
if (!Parent->InLoop) { return false; }
if (Parent->ParentSection.empty()) { return false; }
@ -59,7 +59,7 @@ void CCodeSection::UnlinkParent( CCodeSection * Parent, bool AllowDelete, bool C
// }
if (ContinueSection && Parent->ContinueSection == this)
{
Parent->ContinueSection = NULL;
Parent->ContinueSection = nullptr;
}
// if (Parent->ContinueSection != Parent->JumpSection)
// {
@ -70,7 +70,7 @@ void CCodeSection::UnlinkParent( CCodeSection * Parent, bool AllowDelete, bool C
// }
if (!ContinueSection && Parent->JumpSection == this)
{
Parent->JumpSection = NULL;
Parent->JumpSection = nullptr;
}
if (AllowDelete)
{
@ -106,7 +106,7 @@ CCodeSection::~CCodeSection()
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
ContinueSection = NULL;
ContinueSection = nullptr;
}
if (JumpSection)
{
@ -115,7 +115,7 @@ CCodeSection::~CCodeSection()
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
JumpSection = NULL;
JumpSection = nullptr;
}
}

View File

@ -20,7 +20,7 @@
#include <Project64-core/Debugger.h>
#include <stdio.h>
CCodeSection * CX86RecompilerOps::m_Section = NULL;
CCodeSection * CX86RecompilerOps::m_Section = nullptr;
CRegInfo CX86RecompilerOps::m_RegWorkingSet;
STEP_TYPE CX86RecompilerOps::m_NextInstruction;
uint32_t CX86RecompilerOps::m_CompilePC;
@ -355,8 +355,8 @@ bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2);
/*************************** Trap functions *************************/
void CX86RecompilerOps::Compile_TrapCompare(TRAP_COMPARE CompareType)
{
void *FunctAddress = NULL;
const char *FunctName = NULL;
void *FunctAddress = nullptr;
const char *FunctName = nullptr;
switch (CompareType)
{
case CompareTypeTEQ:
@ -411,7 +411,7 @@ void CX86RecompilerOps::Compile_TrapCompare(TRAP_COMPARE CompareType)
g_Notify->BreakPoint(__FILE__, __LINE__);
}
if (FunctName != NULL && FunctAddress != NULL)
if (FunctName != nullptr && FunctAddress != nullptr)
{
if (IsMapped(m_Opcode.rs)) {
UnMap_GPR(m_Opcode.rs, true);
@ -500,7 +500,7 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
}
m_Section->m_Jump.JumpPC = m_CompilePC;
m_Section->m_Jump.TargetPC = m_CompilePC + ((int16_t)m_Opcode.offset << 2) + 4;
if (m_Section->m_JumpSection != NULL)
if (m_Section->m_JumpSection != nullptr)
{
m_Section->m_Jump.BranchLabel.Format("Section_%d", m_Section->m_JumpSection->m_SectionID);
}
@ -508,12 +508,12 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
{
m_Section->m_Jump.BranchLabel.Format("Exit_%X_jump_%X", m_Section->m_EnterPC, m_Section->m_Jump.TargetPC);
}
m_Section->m_Jump.LinkLocation = NULL;
m_Section->m_Jump.LinkLocation2 = NULL;
m_Section->m_Jump.LinkLocation = nullptr;
m_Section->m_Jump.LinkLocation2 = nullptr;
m_Section->m_Jump.DoneDelaySlot = false;
m_Section->m_Cont.JumpPC = m_CompilePC;
m_Section->m_Cont.TargetPC = m_CompilePC + 8;
if (m_Section->m_ContinueSection != NULL)
if (m_Section->m_ContinueSection != nullptr)
{
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
}
@ -521,8 +521,8 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
{
m_Section->m_Cont.BranchLabel.Format("Exit_%X_continue_%X", m_Section->m_EnterPC, m_Section->m_Cont.TargetPC);
}
m_Section->m_Cont.LinkLocation = NULL;
m_Section->m_Cont.LinkLocation2 = NULL;
m_Section->m_Cont.LinkLocation = nullptr;
m_Section->m_Cont.LinkLocation2 = nullptr;
m_Section->m_Cont.DoneDelaySlot = false;
if (m_Section->m_Jump.TargetPC < m_Section->m_Cont.TargetPC)
{
@ -545,8 +545,8 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
{
if ((m_CompilePC & 0xFFC) != 0xFFC)
{
m_Section->m_Cont.BranchLabel = m_Section->m_ContinueSection != NULL ? "Continue" : "ExitBlock";
m_Section->m_Jump.BranchLabel = m_Section->m_JumpSection != NULL ? "Jump" : "ExitBlock";
m_Section->m_Cont.BranchLabel = m_Section->m_ContinueSection != nullptr ? "Continue" : "ExitBlock";
m_Section->m_Jump.BranchLabel = m_Section->m_JumpSection != nullptr ? "Jump" : "ExitBlock";
}
else
{
@ -559,14 +559,14 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
}
if (!m_Section->m_Jump.FallThrough && !m_Section->m_Cont.FallThrough)
{
if (m_Section->m_Jump.LinkLocation != NULL)
if (m_Section->m_Jump.LinkLocation != nullptr)
{
CPU_Message("");
CPU_Message(" %s:", m_Section->m_Jump.BranchLabel.c_str());
LinkJump(m_Section->m_Jump);
m_Section->m_Jump.FallThrough = true;
}
else if (m_Section->m_Cont.LinkLocation != NULL)
else if (m_Section->m_Cont.LinkLocation != nullptr)
{
CPU_Message("");
CPU_Message(" %s:", m_Section->m_Cont.BranchLabel.c_str());
@ -576,10 +576,10 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
}
if ((m_CompilePC & 0xFFC) == 0xFFC)
{
uint8_t * DelayLinkLocation = NULL;
uint8_t * DelayLinkLocation = nullptr;
if (m_Section->m_Jump.FallThrough)
{
if (m_Section->m_Jump.LinkLocation != NULL || m_Section->m_Jump.LinkLocation2 != NULL)
if (m_Section->m_Jump.LinkLocation != nullptr || m_Section->m_Jump.LinkLocation2 != nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
@ -587,17 +587,17 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
}
else if (m_Section->m_Cont.FallThrough)
{
if (m_Section->m_Cont.LinkLocation != NULL || m_Section->m_Cont.LinkLocation2 != NULL)
if (m_Section->m_Cont.LinkLocation != nullptr || m_Section->m_Cont.LinkLocation2 != nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
MoveConstToVariable(m_Section->m_Cont.TargetPC, &R4300iOp::m_JumpToLocation, "R4300iOp::m_JumpToLocation");
}
if (m_Section->m_Jump.LinkLocation != NULL || m_Section->m_Jump.LinkLocation2 != NULL)
if (m_Section->m_Jump.LinkLocation != nullptr || m_Section->m_Jump.LinkLocation2 != nullptr)
{
JmpLabel8("DoDelaySlot", 0);
if (DelayLinkLocation != NULL) { g_Notify->BreakPoint(__FILE__, __LINE__); }
if (DelayLinkLocation != nullptr) { g_Notify->BreakPoint(__FILE__, __LINE__); }
DelayLinkLocation = (uint8_t *)(*g_RecompPos - 1);
CPU_Message(" ");
@ -605,10 +605,10 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
LinkJump(m_Section->m_Jump);
MoveConstToVariable(m_Section->m_Jump.TargetPC, &R4300iOp::m_JumpToLocation, "R4300iOp::m_JumpToLocation");
}
if (m_Section->m_Cont.LinkLocation != NULL || m_Section->m_Cont.LinkLocation2 != NULL)
if (m_Section->m_Cont.LinkLocation != nullptr || m_Section->m_Cont.LinkLocation2 != nullptr)
{
JmpLabel8("DoDelaySlot", 0);
if (DelayLinkLocation != NULL) { g_Notify->BreakPoint(__FILE__, __LINE__); }
if (DelayLinkLocation != nullptr) { g_Notify->BreakPoint(__FILE__, __LINE__); }
DelayLinkLocation = (uint8_t *)(*g_RecompPos - 1);
CPU_Message(" ");
@ -643,7 +643,7 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
FallInfo->RegSet = m_RegWorkingSet;
if (FallInfo == &m_Section->m_Jump)
{
if (m_Section->m_JumpSection != NULL)
if (m_Section->m_JumpSection != nullptr)
{
m_Section->m_Jump.BranchLabel.Format("Section_%d", m_Section->m_JumpSection->m_SectionID);
}
@ -663,7 +663,7 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
}
else
{
if (m_Section->m_ContinueSection != NULL)
if (m_Section->m_ContinueSection != nullptr)
{
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
}
@ -679,7 +679,7 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
JmpLabel32(FallInfo->BranchLabel.c_str(), 0);
FallInfo->LinkLocation = (uint32_t *)(*g_RecompPos - 4);
if (JumpInfo->LinkLocation != NULL)
if (JumpInfo->LinkLocation != nullptr)
{
CPU_Message(" %s:", JumpInfo->BranchLabel.c_str());
LinkJump(*JumpInfo);
@ -705,12 +705,12 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
m_Section->m_Jump.FallThrough = false;
m_Section->m_Cont.FallThrough = true;
m_Section->m_Cont.RegSet = m_RegWorkingSet;
if (m_Section->m_ContinueSection == NULL && m_Section->m_JumpSection != NULL)
if (m_Section->m_ContinueSection == nullptr && m_Section->m_JumpSection != nullptr)
{
m_Section->m_ContinueSection = m_Section->m_JumpSection;
m_Section->m_JumpSection = NULL;
m_Section->m_JumpSection = nullptr;
}
if (m_Section->m_ContinueSection != NULL)
if (m_Section->m_ContinueSection != nullptr)
{
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
}
@ -763,7 +763,7 @@ void CX86RecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
}
}
if (m_Section->m_JumpSection != NULL)
if (m_Section->m_JumpSection != nullptr)
{
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
}
@ -772,7 +772,7 @@ void CX86RecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
m_Section->m_Jump.BranchLabel = "ExitBlock";
}
if (m_Section->m_ContinueSection != NULL)
if (m_Section->m_ContinueSection != nullptr)
{
m_Section->m_Cont.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_ContinueSection)->m_SectionID);
}
@ -782,11 +782,11 @@ void CX86RecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
}
m_Section->m_Jump.FallThrough = true;
m_Section->m_Jump.LinkLocation = NULL;
m_Section->m_Jump.LinkLocation2 = NULL;
m_Section->m_Jump.LinkLocation = nullptr;
m_Section->m_Jump.LinkLocation2 = nullptr;
m_Section->m_Cont.FallThrough = false;
m_Section->m_Cont.LinkLocation = NULL;
m_Section->m_Cont.LinkLocation2 = NULL;
m_Section->m_Cont.LinkLocation = nullptr;
m_Section->m_Cont.LinkLocation2 = nullptr;
if (Link)
{
@ -803,13 +803,13 @@ void CX86RecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
{
if (m_Section->m_Cont.FallThrough)
{
if (m_Section->m_Jump.LinkLocation != NULL)
if (m_Section->m_Jump.LinkLocation != nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
}
if (m_Section->m_Jump.LinkLocation != NULL || m_Section->m_Jump.FallThrough)
if (m_Section->m_Jump.LinkLocation != nullptr || m_Section->m_Jump.FallThrough)
{
LinkJump(m_Section->m_Jump);
@ -824,7 +824,7 @@ void CX86RecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
}
LinkJump(m_Section->m_Cont);
CompileExit(m_CompilePC, m_CompilePC + 8, m_Section->m_Cont.RegSet, CExitInfo::Normal, true, NULL);
CompileExit(m_CompilePC, m_CompilePC + 8, m_Section->m_Cont.RegSet, CExitInfo::Normal, true, nullptr);
return;
}
else
@ -842,7 +842,7 @@ void CX86RecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
{
if (m_Section->m_Cont.FallThrough)
{
if (m_Section->m_Jump.LinkLocation != NULL)
if (m_Section->m_Jump.LinkLocation != nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
@ -866,7 +866,7 @@ void CX86RecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
void CX86RecompilerOps::BNE_Compare()
{
uint8_t *Jump = NULL;
uint8_t *Jump = nullptr;
if (IsKnown(m_Opcode.rs) && IsKnown(m_Opcode.rt))
{
@ -1191,7 +1191,7 @@ void CX86RecompilerOps::BNE_Compare()
void CX86RecompilerOps::BEQ_Compare()
{
uint8_t *Jump = NULL;
uint8_t *Jump = nullptr;
if (IsKnown(m_Opcode.rs) && IsKnown(m_Opcode.rt))
{
@ -1576,7 +1576,7 @@ void CX86RecompilerOps::BGTZ_Compare()
}
else
{
uint8_t *Jump = NULL;
uint8_t *Jump = nullptr;
if (IsMapped(m_Opcode.rs))
{
@ -1709,7 +1709,7 @@ void CX86RecompilerOps::BLEZ_Compare()
}
else
{
uint8_t *Jump = NULL;
uint8_t *Jump = nullptr;
if (IsMapped(m_Opcode.rs))
{
@ -1773,7 +1773,7 @@ void CX86RecompilerOps::BLEZ_Compare()
}
}
else {
uint8_t *Jump = NULL;
uint8_t *Jump = nullptr;
if (!g_System->b32BitCore())
{
@ -2141,7 +2141,7 @@ void CX86RecompilerOps::J()
m_Section->m_Jump.TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);;
m_Section->m_Jump.JumpPC = m_CompilePC;
if (m_Section->m_JumpSection != NULL)
if (m_Section->m_JumpSection != nullptr)
{
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
}
@ -2150,8 +2150,8 @@ void CX86RecompilerOps::J()
m_Section->m_Jump.BranchLabel = "ExitBlock";
}
m_Section->m_Jump.FallThrough = true;
m_Section->m_Jump.LinkLocation = NULL;
m_Section->m_Jump.LinkLocation2 = NULL;
m_Section->m_Jump.LinkLocation = nullptr;
m_Section->m_Jump.LinkLocation2 = nullptr;
m_NextInstruction = DO_DELAY_SLOT;
}
else if (m_NextInstruction == DELAY_SLOT_DONE)
@ -2182,7 +2182,7 @@ void CX86RecompilerOps::JAL()
}
m_Section->m_Jump.TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);
m_Section->m_Jump.JumpPC = m_CompilePC;
if (m_Section->m_JumpSection != NULL)
if (m_Section->m_JumpSection != nullptr)
{
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
}
@ -2191,8 +2191,8 @@ void CX86RecompilerOps::JAL()
m_Section->m_Jump.BranchLabel = "ExitBlock";
}
m_Section->m_Jump.FallThrough = true;
m_Section->m_Jump.LinkLocation = NULL;
m_Section->m_Jump.LinkLocation2 = NULL;
m_Section->m_Jump.LinkLocation = nullptr;
m_Section->m_Jump.LinkLocation2 = nullptr;
m_NextInstruction = DO_DELAY_SLOT;
}
else if (m_NextInstruction == DELAY_SLOT_DONE)
@ -2216,7 +2216,7 @@ void CX86RecompilerOps::JAL()
bool bCheck = TargetPC <= m_CompilePC;
UpdateCounters(m_RegWorkingSet, bCheck, true);
CompileExit((uint32_t)-1, (uint32_t)-1, m_RegWorkingSet, bCheck ? CExitInfo::Normal : CExitInfo::Normal_NoSysCheck, true, NULL);
CompileExit((uint32_t)-1, (uint32_t)-1, m_RegWorkingSet, bCheck ? CExitInfo::Normal : CExitInfo::Normal_NoSysCheck, true, nullptr);
}
m_NextInstruction = END_BLOCK;
}
@ -2349,7 +2349,7 @@ void CX86RecompilerOps::SLTIU()
}
else
{
uint8_t * Jump = NULL;
uint8_t * Jump = nullptr;
CompConstToVariable(((int16_t)m_Opcode.immediate >> 31), &_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]);
JneLabel8("CompareSet", 0);
@ -2445,7 +2445,7 @@ void CX86RecompilerOps::SLTI()
}
else
{
uint8_t * Jump[2] = { NULL, NULL };
uint8_t * Jump[2] = { nullptr, nullptr };
CompConstToVariable(((int16_t)m_Opcode.immediate >> 31), &_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]);
JeLabel8("Low Compare", 0);
Jump[0] = *g_RecompPos - 1;
@ -3349,7 +3349,7 @@ void CX86RecompilerOps::LW_KnownAddress(x86Reg Reg, uint32_t VAddr)
}
else
{
if (g_Plugins->Audio()->AiReadLength != NULL)
if (g_Plugins->Audio()->AiReadLength != nullptr)
{
m_RegWorkingSet.BeforeCallDirect();
Call_Direct((void *)g_Plugins->Audio()->AiReadLength, "AiReadLength");
@ -3495,7 +3495,7 @@ void CX86RecompilerOps::LW_KnownAddress(x86Reg Reg, uint32_t VAddr)
sprintf(VarName, "RDRAM + %X", PAddr);
MoveVariableToX86reg(PAddr + g_MMU->Rdram(), VarName, Reg);
}
else if (g_DDRom != NULL && ((PAddr & 0xFF000000) == 0x06000000 && (PAddr - 0x06000000) < g_DDRom->GetRomSize()))
else if (g_DDRom != nullptr && ((PAddr & 0xFF000000) == 0x06000000 && (PAddr - 0x06000000) < g_DDRom->GetRomSize()))
{
// read from ddrom
sprintf(VarName, "RDRAM + %X", PAddr);
@ -4137,7 +4137,7 @@ void CX86RecompilerOps::SW(bool bCheckLLbit)
ShiftRightUnsignImmed(TempReg2, 12);
MoveVariableDispToX86Reg(g_MMU->m_TLB_WriteMap, "MMU->TLB_WriteMap", TempReg2, TempReg2, 4);
CompileWriteTLBMiss(TempReg1, TempReg2);
uint8_t * Jump = NULL;
uint8_t * Jump = nullptr;
if (bCheckLLbit)
{
CompConstToVariable(1, _LLBit, "_LLBit");
@ -5161,11 +5161,11 @@ void CX86RecompilerOps::SPECIAL_JR()
}
m_Section->m_Jump.FallThrough = false;
m_Section->m_Jump.LinkLocation = NULL;
m_Section->m_Jump.LinkLocation2 = NULL;
m_Section->m_Jump.LinkLocation = nullptr;
m_Section->m_Jump.LinkLocation2 = nullptr;
m_Section->m_Cont.FallThrough = false;
m_Section->m_Cont.LinkLocation = NULL;
m_Section->m_Cont.LinkLocation2 = NULL;
m_Section->m_Cont.LinkLocation = nullptr;
m_Section->m_Cont.LinkLocation2 = nullptr;
if (DelaySlotEffectsCompare(m_CompilePC, m_Opcode.rs, 0))
{
@ -5188,7 +5188,7 @@ void CX86RecompilerOps::SPECIAL_JR()
{
if (DelaySlotEffectsCompare(m_CompilePC, m_Opcode.rs, 0))
{
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, NULL);
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, nullptr);
}
else
{
@ -5205,7 +5205,7 @@ void CX86RecompilerOps::SPECIAL_JR()
{
MoveX86regToVariable(Map_TempReg(x86_Any, m_Opcode.rs, false), _PROGRAM_COUNTER, "PROGRAM_COUNTER");
}
CompileExit((uint32_t)-1, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, NULL);
CompileExit((uint32_t)-1, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, nullptr);
if (m_Section->m_JumpSection)
{
m_Section->GenerateSectionLinkage();
@ -5258,11 +5258,11 @@ void CX86RecompilerOps::SPECIAL_JALR()
}
m_Section->m_Jump.FallThrough = false;
m_Section->m_Jump.LinkLocation = NULL;
m_Section->m_Jump.LinkLocation2 = NULL;
m_Section->m_Jump.LinkLocation = nullptr;
m_Section->m_Jump.LinkLocation2 = nullptr;
m_Section->m_Cont.FallThrough = false;
m_Section->m_Cont.LinkLocation = NULL;
m_Section->m_Cont.LinkLocation2 = NULL;
m_Section->m_Cont.LinkLocation = nullptr;
m_Section->m_Cont.LinkLocation2 = nullptr;
m_NextInstruction = DO_DELAY_SLOT;
}
@ -5270,7 +5270,7 @@ void CX86RecompilerOps::SPECIAL_JALR()
{
if (DelaySlotEffectsCompare(m_CompilePC, m_Opcode.rs, 0))
{
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, NULL);
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, nullptr);
}
else
{
@ -5287,7 +5287,7 @@ void CX86RecompilerOps::SPECIAL_JALR()
{
MoveX86regToVariable(Map_TempReg(x86_Any, m_Opcode.rs, false), _PROGRAM_COUNTER, "PROGRAM_COUNTER");
}
CompileExit((uint32_t)-1, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, NULL);
CompileExit((uint32_t)-1, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, nullptr);
if (m_Section->m_JumpSection)
{
m_Section->GenerateSectionLinkage();
@ -5303,7 +5303,7 @@ void CX86RecompilerOps::SPECIAL_JALR()
void CX86RecompilerOps::SPECIAL_SYSCALL()
{
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::DoSysCall, true, NULL);
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::DoSysCall, true, nullptr);
m_NextInstruction = END_BLOCK;
}
@ -5681,7 +5681,7 @@ void CX86RecompilerOps::SPECIAL_DIVU()
MoveConstToVariable(0, &_RegHI->UW[1], "_RegHI->UW[1]");
return;
}
Jump[1] = NULL;
Jump[1] = nullptr;
}
else
{
@ -5731,7 +5731,7 @@ void CX86RecompilerOps::SPECIAL_DIVU()
MoveX86regToVariable(x86_EAX, &_RegLO->UW[1], "_RegLO->UW[1]");
MoveX86regToVariable(x86_EDX, &_RegHI->UW[1], "_RegHI->UW[1]");
if (Jump[1] != NULL)
if (Jump[1] != nullptr)
{
CPU_Message("");
CPU_Message(" EndDivu:");
@ -7018,7 +7018,7 @@ void CX86RecompilerOps::SPECIAL_SLT()
}
else
{
uint8_t *Jump[2] = { NULL, NULL };
uint8_t *Jump[2] = { nullptr, nullptr };
x86Reg Reg = Map_TempReg(x86_Any, m_Opcode.rs, true);
CompX86regToVariable(Reg, &_GPR[m_Opcode.rt].W[1], CRegName::GPR_Hi[m_Opcode.rt]);
@ -7195,7 +7195,7 @@ void CX86RecompilerOps::SPECIAL_SLTU()
{
uint32_t KnownReg = IsKnown(m_Opcode.rt) ? m_Opcode.rt : m_Opcode.rs;
uint32_t UnknownReg = IsKnown(m_Opcode.rt) ? m_Opcode.rs : m_Opcode.rt;
uint8_t *Jump[2] = { NULL, NULL };
uint8_t *Jump[2] = { nullptr, nullptr };
ProtectGPR(KnownReg);
if (g_System->b32BitCore())
@ -7298,7 +7298,7 @@ void CX86RecompilerOps::SPECIAL_SLTU()
}
else
{
uint8_t *Jump[2] = { NULL, NULL };
uint8_t *Jump[2] = { nullptr, nullptr };
x86Reg Reg = Map_TempReg(x86_Any, m_Opcode.rs, true);
CompX86regToVariable(Reg, &_GPR[m_Opcode.rt].W[1], CRegName::GPR_Hi[m_Opcode.rt]);
@ -8171,7 +8171,7 @@ void CX86RecompilerOps::COP0_CO_ERET(void)
Call_Direct((void *)x86_compiler_COP0_CO_ERET, "x86_compiler_COP0_CO_ERET");
UpdateCounters(m_RegWorkingSet, true, true);
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, NULL);
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, nullptr);
m_NextInstruction = END_BLOCK;
}
@ -9259,7 +9259,7 @@ void CX86RecompilerOps::CompileExitCode()
CPU_Message(" $Exit_%d", ExitIter->ID);
SetJump32(ExitIter->JumpLoc, (uint32_t *)*g_RecompPos);
m_NextInstruction = ExitIter->NextInstruction;
CompileExit((uint32_t)-1, ExitIter->TargetPC, ExitIter->ExitRegSet, ExitIter->reason, true, NULL);
CompileExit((uint32_t)-1, ExitIter->TargetPC, ExitIter->ExitRegSet, ExitIter->reason, true, nullptr);
}
}
@ -9552,11 +9552,11 @@ void CX86RecompilerOps::SetRegWorkingSet(const CRegInfo & RegInfo)
bool CX86RecompilerOps::InheritParentInfo()
{
if (m_Section->m_CompiledLocation == NULL)
if (m_Section->m_CompiledLocation == nullptr)
{
m_Section->m_CompiledLocation = *g_RecompPos;
m_Section->DisplaySectionInformation();
m_Section->m_CompiledLocation = NULL;
m_Section->m_CompiledLocation = nullptr;
}
else
{
@ -9572,7 +9572,7 @@ bool CX86RecompilerOps::InheritParentInfo()
if (m_Section->m_ParentSection.size() == 1)
{
CCodeSection * Parent = *(m_Section->m_ParentSection.begin());
if (Parent->m_CompiledLocation == NULL)
if (Parent->m_CompiledLocation == nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
@ -9592,7 +9592,7 @@ bool CX86RecompilerOps::InheritParentInfo()
CCodeSection * Parent = *iter;
BLOCK_PARENT BlockParent;
if (Parent->m_CompiledLocation == NULL) { continue; }
if (Parent->m_CompiledLocation == nullptr) { continue; }
if (Parent->m_JumpSection != Parent->m_ContinueSection)
{
BlockParent.Parent = Parent;
@ -9622,7 +9622,7 @@ bool CX86RecompilerOps::InheritParentInfo()
CCodeSection * Parent = *iter;
BLOCK_PARENT BlockParent;
if (Parent->m_CompiledLocation != NULL) { continue; }
if (Parent->m_CompiledLocation != nullptr) { continue; }
if (Parent->m_JumpSection != Parent->m_ContinueSection)
{
BlockParent.Parent = Parent;
@ -9708,7 +9708,7 @@ bool CX86RecompilerOps::InheritParentInfo()
if (i == (size_t)FirstParent) { continue; }
Parent = ParentList[i].Parent;
if (Parent->m_CompiledLocation == NULL)
if (Parent->m_CompiledLocation == nullptr)
{
continue;
}
@ -9915,20 +9915,20 @@ bool CX86RecompilerOps::InheritParentInfo()
JumpInfo = ParentList[CurrentParent].JumpInfo;
JmpLabel32(Label.c_str(), 0);
JumpInfo->LinkLocation = (uint32_t *)(*g_RecompPos - 4);
JumpInfo->LinkLocation2 = NULL;
JumpInfo->LinkLocation2 = nullptr;
CurrentParent = i;
Parent = ParentList[CurrentParent].Parent;
JumpInfo = ParentList[CurrentParent].JumpInfo;
CPU_Message(" Section_%d (from %d):", m_Section->m_SectionID, Parent->m_SectionID);
if (JumpInfo->LinkLocation != NULL)
if (JumpInfo->LinkLocation != nullptr)
{
SetJump32(JumpInfo->LinkLocation, (uint32_t *)*g_RecompPos);
JumpInfo->LinkLocation = NULL;
if (JumpInfo->LinkLocation2 != NULL)
JumpInfo->LinkLocation = nullptr;
if (JumpInfo->LinkLocation2 != nullptr)
{
SetJump32(JumpInfo->LinkLocation2, (uint32_t *)*g_RecompPos);
JumpInfo->LinkLocation2 = NULL;
JumpInfo->LinkLocation2 = nullptr;
}
}
@ -9961,7 +9961,7 @@ bool CX86RecompilerOps::InheritParentInfo()
void CX86RecompilerOps::LinkJump(CJumpInfo & JumpInfo, uint32_t SectionID, uint32_t FromSectionID)
{
if (JumpInfo.LinkLocation != NULL)
if (JumpInfo.LinkLocation != nullptr)
{
if (SectionID != -1)
{
@ -9975,11 +9975,11 @@ void CX86RecompilerOps::LinkJump(CJumpInfo & JumpInfo, uint32_t SectionID, uint3
}
}
SetJump32(JumpInfo.LinkLocation, (uint32_t *)*g_RecompPos);
JumpInfo.LinkLocation = NULL;
if (JumpInfo.LinkLocation2 != NULL)
JumpInfo.LinkLocation = nullptr;
if (JumpInfo.LinkLocation2 != nullptr)
{
SetJump32(JumpInfo.LinkLocation2, (uint32_t *)*g_RecompPos);
JumpInfo.LinkLocation2 = NULL;
JumpInfo.LinkLocation2 = nullptr;
}
}
}
@ -10231,7 +10231,7 @@ void CX86RecompilerOps::OverflowDelaySlot(bool TestTimer)
void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason)
{
CompileExit(JumpPC, TargetPC, ExitRegSet, reason, true, NULL);
CompileExit(JumpPC, TargetPC, ExitRegSet, reason, true, nullptr);
}
void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason, bool CompileNow, void(*x86Jmp)(const char * Label, uint32_t Value))
@ -10240,7 +10240,7 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
{
char String[100];
sprintf(String, "Exit_%d", m_ExitInfo.size());
if (x86Jmp == NULL)
if (x86Jmp == nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
return;
@ -10314,7 +10314,7 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
// uint32_t pAddr = TargetPC & 0x1FFFFFFF;
//
// MoveVariableToX86reg((uint8_t *)RDRAM + pAddr,"RDRAM + pAddr",x86_EAX);
// Jump2 = NULL;
// Jump2 = nullptr;
// } else {
// MoveConstToX86reg((TargetPC >> 12),x86_ECX);
// MoveConstToX86reg(TargetPC,x86_EBX);
@ -10336,7 +10336,7 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
// JmpDirectReg(x86_ECX);
// CPU_Message(" NoCode:");
// *((uint8_t *)(Jump))=(uint8_t)(*g_RecompPos - Jump - 1);
// if (Jump2 != NULL) {
// if (Jump2 != nullptr) {
// CPU_Message(" NoTlbEntry:");
// *((uint8_t *)(Jump2))=(uint8_t)(*g_RecompPos - Jump2 - 1);
// }
@ -10356,7 +10356,7 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
}
else if (LookUpMode() == FuncFind_PhysicalLookup)
{
uint8_t * Jump2 = NULL;
uint8_t * Jump2 = nullptr;
if (TargetPC >= 0x80000000 && TargetPC < 0x90000000)
{
uint32_t pAddr = TargetPC & 0x1FFFFFFF;
@ -10384,7 +10384,7 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
JmpDirectReg(x86_EAX);
CPU_Message(" NullPointer:");
*((uint8_t *)(Jump)) = (uint8_t)(*g_RecompPos - Jump - 1);
if (Jump2 != NULL)
if (Jump2 != nullptr)
{
CPU_Message(" NoTlbEntry:");
*((uint8_t *)(Jump2)) = (uint8_t)(*g_RecompPos - Jump2 - 1);
@ -11014,7 +11014,7 @@ void CX86RecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
switch (PAddr)
{
case 0x04400000:
if (g_Plugins->Gfx()->ViStatusChanged != NULL)
if (g_Plugins->Gfx()->ViStatusChanged != nullptr)
{
CompConstToVariable(Value, &g_Reg->VI_STATUS_REG, "VI_STATUS_REG");
JeLabel8("Continue", 0);
@ -11030,7 +11030,7 @@ void CX86RecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
break;
case 0x04400004: MoveConstToVariable((Value & 0xFFFFFF), &g_Reg->VI_ORIGIN_REG, "VI_ORIGIN_REG"); break;
case 0x04400008:
if (g_Plugins->Gfx()->ViWidthChanged != NULL)
if (g_Plugins->Gfx()->ViWidthChanged != nullptr)
{
CompConstToVariable(Value, &g_Reg->VI_WIDTH_REG, "VI_WIDTH_REG");
JeLabel8("Continue", 0);
@ -11473,7 +11473,7 @@ void CX86RecompilerOps::SW_Register(x86Reg Reg, uint32_t VAddr)
case 0x04400000:
switch (PAddr) {
case 0x04400000:
if (g_Plugins->Gfx()->ViStatusChanged != NULL)
if (g_Plugins->Gfx()->ViStatusChanged != nullptr)
{
uint8_t * Jump;
CompX86regToVariable(Reg, &g_Reg->VI_STATUS_REG, "VI_STATUS_REG");
@ -11493,7 +11493,7 @@ void CX86RecompilerOps::SW_Register(x86Reg Reg, uint32_t VAddr)
AndConstToVariable(0xFFFFFF, &g_Reg->VI_ORIGIN_REG, "VI_ORIGIN_REG");
break;
case 0x04400008:
if (g_Plugins->Gfx()->ViWidthChanged != NULL)
if (g_Plugins->Gfx()->ViWidthChanged != nullptr)
{
uint8_t * Jump;
CompX86regToVariable(Reg, &g_Reg->VI_WIDTH_REG, "VI_WIDTH_REG");

View File

@ -4261,7 +4261,7 @@ void CX86Ops::SetJump32(uint32_t * Loc, uint32_t * JumpLoc)
void CX86Ops::SetJump8(uint8_t * Loc, uint8_t * JumpLoc)
{
if (Loc == NULL || JumpLoc == NULL)
if (Loc == nullptr || JumpLoc == nullptr)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
return;
@ -4289,7 +4289,7 @@ void * CX86Ops::GetAddressOf(int value, ...)
void CX86Ops::AddCode8(uint8_t value)
{
#ifdef _DEBUG
if (g_RecompPos == NULL)
if (g_RecompPos == nullptr)
{
g_Notify->BreakPoint(__FILE__,__LINE__);
}
@ -4301,7 +4301,7 @@ void CX86Ops::AddCode8(uint8_t value)
void CX86Ops::AddCode16(uint16_t value)
{
#ifdef _DEBUG
if (g_RecompPos == NULL)
if (g_RecompPos == nullptr)
{
g_Notify->BreakPoint(__FILE__,__LINE__);
}
@ -4313,7 +4313,7 @@ void CX86Ops::AddCode16(uint16_t value)
void CX86Ops::AddCode32(uint32_t value)
{
#ifdef _DEBUG
if (g_RecompPos == NULL)
if (g_RecompPos == nullptr)
{
g_Notify->BreakPoint(__FILE__,__LINE__);
}

View File

@ -62,7 +62,7 @@ bool CSpeedLimiter::Timer_Process(uint32_t * FrameRate)
if (CurrentTimeValue - LastTime >= 1000000)
{
/* Output FPS */
if (FrameRate != NULL) { *FrameRate = m_Frames; }
if (FrameRate != nullptr) { *FrameRate = m_Frames; }
m_Frames = 0;
m_LastTime = CurrentTime;
return true;

View File

@ -1,28 +1,28 @@
#include "stdafx.h"
#include "SystemGlobals.h"
CN64System * g_System = NULL;
CN64System * g_BaseSystem = NULL;
CN64System * g_SyncSystem = NULL;
CRecompiler * g_Recompiler = NULL;
CMipsMemoryVM * g_MMU = NULL; //Memory of the n64
CTLB * g_TLB = NULL; //TLB Unit
CRegisters * g_Reg = NULL; //Current Register Set attacted to the g_MMU
CNotification * g_Notify = NULL;
CPlugins * g_Plugins = NULL;
CN64Rom * g_Rom = NULL; //The current rom that this system is executing.. it can only execute one file at the time
CN64Rom * g_DDRom = NULL; //64DD IPL ROM
CN64Disk * g_Disk = NULL; //64DD DISK
CAudio * g_Audio = NULL;
CSystemTimer * g_SystemTimer = NULL;
CTransVaddr * g_TransVaddr = NULL;
CSystemEvents * g_SystemEvents = NULL;
uint32_t * g_TLBLoadAddress = NULL;
uint32_t * g_TLBStoreAddress = NULL;
CDebugger * g_Debugger = NULL;
uint8_t ** g_RecompPos = NULL;
CMempak * g_Mempak = NULL;
CRandom * g_Random = NULL;
CEnhancements * g_Enhancements = NULL;
CN64System * g_System = nullptr;
CN64System * g_BaseSystem = nullptr;
CN64System * g_SyncSystem = nullptr;
CRecompiler * g_Recompiler = nullptr;
CMipsMemoryVM * g_MMU = nullptr; //Memory of the n64
CTLB * g_TLB = nullptr; //TLB Unit
CRegisters * g_Reg = nullptr; //Current Register Set attacted to the g_MMU
CNotification * g_Notify = nullptr;
CPlugins * g_Plugins = nullptr;
CN64Rom * g_Rom = nullptr; //The current rom that this system is executing.. it can only execute one file at the time
CN64Rom * g_DDRom = nullptr; //64DD IPL ROM
CN64Disk * g_Disk = nullptr; //64DD DISK
CAudio * g_Audio = nullptr;
CSystemTimer * g_SystemTimer = nullptr;
CTransVaddr * g_TransVaddr = nullptr;
CSystemEvents * g_SystemEvents = nullptr;
uint32_t * g_TLBLoadAddress = nullptr;
uint32_t * g_TLBStoreAddress = nullptr;
CDebugger * g_Debugger = nullptr;
uint8_t ** g_RecompPos = nullptr;
CMempak * g_Mempak = nullptr;
CRandom * g_Random = nullptr;
CEnhancements * g_Enhancements = nullptr;
int * g_NextTimer;

View File

@ -11,18 +11,18 @@
#endif
CAudioPlugin::CAudioPlugin() :
AiLenChanged(NULL),
AiReadLength(NULL),
ProcessAList(NULL),
m_hAudioThread(NULL),
AiUpdate(NULL),
AiDacrateChanged(NULL)
AiLenChanged(nullptr),
AiReadLength(nullptr),
ProcessAList(nullptr),
m_hAudioThread(nullptr),
AiUpdate(nullptr),
AiDacrateChanged(nullptr)
{
}
CAudioPlugin::~CAudioPlugin()
{
Close(NULL);
Close(nullptr);
UnloadPlugin();
}
@ -40,15 +40,15 @@ bool CAudioPlugin::LoadFunctions(void)
LoadFunction(ProcessAList);
// Make sure dll has all needed functions
if (AiDacrateChanged == NULL) { UnloadPlugin(); return false; }
if (AiLenChanged == NULL) { UnloadPlugin(); return false; }
if (AiReadLength == NULL) { UnloadPlugin(); return false; }
if (InitiateAudio == NULL) { UnloadPlugin(); return false; }
if (ProcessAList == NULL) { UnloadPlugin(); return false; }
if (AiDacrateChanged == nullptr) { UnloadPlugin(); return false; }
if (AiLenChanged == nullptr) { UnloadPlugin(); return false; }
if (AiReadLength == nullptr) { UnloadPlugin(); return false; }
if (InitiateAudio == nullptr) { UnloadPlugin(); return false; }
if (ProcessAList == nullptr) { UnloadPlugin(); return false; }
if (m_PluginInfo.Version >= 0x0102)
{
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
if (PluginOpened == nullptr) { UnloadPlugin(); return false; }
}
return true;
}
@ -86,23 +86,23 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
//Get Function from DLL
int32_t(CALL *InitiateAudio)(AUDIO_INFO Audio_Info);
LoadFunction(InitiateAudio);
if (InitiateAudio == NULL) { return false; }
if (InitiateAudio == nullptr) { return false; }
AUDIO_INFO Info = { 0 };
#ifdef _WIN32
Info.hwnd = Window ? Window->GetWindowHandle() : NULL;
Info.hinst = Window ? Window->GetModuleInstance() : NULL;
Info.hwnd = Window ? Window->GetWindowHandle() : nullptr;
Info.hinst = Window ? Window->GetModuleInstance() : nullptr;
#else
Info.hwnd = NULL;
Info.hinst = NULL;
Info.hwnd = nullptr;
Info.hinst = nullptr;
#endif
Info.MemoryBswaped = true;
Info.CheckInterrupts = DummyCheckInterrupts;
// We are initializing the plugin before any rom is loaded so we do not have any correct
// parameters here.. just needed to we can config the DLL.
if (System == NULL)
if (System == nullptr)
{
static uint8_t Buffer[100];
static uint32_t Value = 0;
@ -125,7 +125,7 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
CMipsMemoryVM & MMU = System->m_MMU_VM;
CRegisters & Reg = System->m_Reg;
if (g_Rom->IsLoadedRomDDIPL() && g_Disk != NULL)
if (g_Rom->IsLoadedRomDDIPL() && g_Disk != nullptr)
Info.HEADER = g_Disk->GetDiskHeader();
else
Info.HEADER = g_Rom->GetRomAddress();
@ -144,7 +144,7 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
m_Initialized = InitiateAudio(Info) != 0;
#ifdef _WIN32
if (System != NULL)
if (System != nullptr)
{
if (AiUpdate)
{
@ -154,7 +154,7 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
TerminateThread(m_hAudioThread, 0);
}
DWORD ThreadID;
m_hAudioThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)AudioThread, (LPVOID)this, 0, &ThreadID);
m_hAudioThread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)AudioThread, (LPVOID)this, 0, &ThreadID);
}
if (System->m_Reg.AI_DACRATE_REG != 0)
@ -173,14 +173,14 @@ void CAudioPlugin::UnloadPluginDetails(void)
{
WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread");
TerminateThread(m_hAudioThread, 0);
m_hAudioThread = NULL;
m_hAudioThread = nullptr;
}
#endif
AiDacrateChanged = NULL;
AiLenChanged = NULL;
AiReadLength = NULL;
AiUpdate = NULL;
ProcessAList = NULL;
AiDacrateChanged = nullptr;
AiLenChanged = nullptr;
AiReadLength = nullptr;
AiUpdate = nullptr;
ProcessAList = nullptr;
}
void CAudioPlugin::DacrateChanged(SYSTEM_TYPE Type)

View File

@ -5,12 +5,12 @@
#include "ControllerPlugin.h"
CControl_Plugin::CControl_Plugin(void) :
WM_KeyDown(NULL),
WM_KeyUp(NULL),
RumbleCommand(NULL),
GetKeys(NULL),
ReadController(NULL),
ControllerCommand(NULL),
WM_KeyDown(nullptr),
WM_KeyUp(nullptr),
RumbleCommand(nullptr),
GetKeys(nullptr),
ReadController(nullptr),
ControllerCommand(nullptr),
m_AllocatedControllers(false)
{
memset(&m_PluginControllers, 0, sizeof(m_PluginControllers));
@ -19,7 +19,7 @@ CControl_Plugin::CControl_Plugin(void) :
CControl_Plugin::~CControl_Plugin()
{
Close(NULL);
Close(nullptr);
UnloadPlugin();
}
@ -36,11 +36,11 @@ bool CControl_Plugin::LoadFunctions(void)
LoadFunction(RumbleCommand);
//Make sure dll had all needed functions
if (InitiateControllers == NULL) { UnloadPlugin(); return false; }
if (InitiateControllers == nullptr) { UnloadPlugin(); return false; }
if (m_PluginInfo.Version >= 0x0102)
{
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
if (PluginOpened == nullptr) { UnloadPlugin(); return false; }
}
// Allocate our own controller
@ -69,11 +69,11 @@ bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
//Get Function from DLL
void(CALL *InitiateControllers_1_0)(void * hMainWindow, CONTROL Controls[4]);
_LoadFunction("InitiateControllers", InitiateControllers_1_0);
if (InitiateControllers_1_0 == NULL) { return false; }
if (InitiateControllers_1_0 == nullptr) { return false; }
#ifdef _WIN32
InitiateControllers_1_0(Window->GetWindowHandle(), m_PluginControllers);
#else
InitiateControllers_1_0(NULL, m_PluginControllers);
InitiateControllers_1_0(nullptr, m_PluginControllers);
#endif
m_Initialized = true;
}
@ -81,13 +81,13 @@ bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
{
CONTROL_INFO ControlInfo;
ControlInfo.Controls = m_PluginControllers;
ControlInfo.HEADER = (System == NULL ? Buffer : g_Rom->GetRomAddress());
ControlInfo.HEADER = (System == nullptr ? Buffer : g_Rom->GetRomAddress());
#ifdef _WIN32
ControlInfo.hinst = Window ? Window->GetModuleInstance() : NULL;
ControlInfo.hMainWindow = Window ? Window->GetWindowHandle() : NULL;
ControlInfo.hinst = Window ? Window->GetModuleInstance() : nullptr;
ControlInfo.hMainWindow = Window ? Window->GetWindowHandle() : nullptr;
#else
ControlInfo.hinst = NULL;
ControlInfo.hMainWindow = NULL;
ControlInfo.hinst = nullptr;
ControlInfo.hMainWindow = nullptr;
#endif
ControlInfo.MemoryBswaped = true;
@ -96,7 +96,7 @@ bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
//Get Function from DLL
void(CALL *InitiateControllers_1_1)(CONTROL_INFO ControlInfo);
_LoadFunction("InitiateControllers", InitiateControllers_1_1);
if (InitiateControllers_1_1 == NULL) { return false; }
if (InitiateControllers_1_1 == nullptr) { return false; }
InitiateControllers_1_1(ControlInfo);
m_Initialized = true;
@ -106,7 +106,7 @@ bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
//Get Function from DLL
void(CALL *InitiateControllers_1_2)(CONTROL_INFO * ControlInfo);
_LoadFunction("InitiateControllers", InitiateControllers_1_2);
if (InitiateControllers_1_2 == NULL) { return false; }
if (InitiateControllers_1_2 == nullptr) { return false; }
InitiateControllers_1_2(&ControlInfo);
m_Initialized = true;
@ -122,16 +122,16 @@ void CControl_Plugin::UnloadPluginDetails(void)
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
{
delete m_Controllers[count];
m_Controllers[count] = NULL;
m_Controllers[count] = nullptr;
}
}
m_AllocatedControllers = false;
ControllerCommand = NULL;
GetKeys = NULL;
ReadController = NULL;
WM_KeyDown = NULL;
WM_KeyUp = NULL;
ControllerCommand = nullptr;
GetKeys = nullptr;
ReadController = nullptr;
WM_KeyDown = nullptr;
WM_KeyUp = nullptr;
}
void CControl_Plugin::UpdateKeys(void)
@ -149,7 +149,7 @@ void CControl_Plugin::UpdateKeys(void)
g_Notify->BreakPoint(__FILE__, __LINE__);
}
}
if (ReadController) { ReadController(-1, NULL); }
if (ReadController) { ReadController(-1, nullptr); }
}
void CControl_Plugin::SetControl(CControl_Plugin const * const Plugin)
@ -159,7 +159,7 @@ void CControl_Plugin::SetControl(CControl_Plugin const * const Plugin)
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
{
delete m_Controllers[count];
m_Controllers[count] = NULL;
m_Controllers[count] = nullptr;
}
}
m_AllocatedControllers = false;

View File

@ -8,22 +8,22 @@
#include "GFXPlugin.h"
CGfxPlugin::CGfxPlugin() :
CaptureScreen(NULL),
ChangeWindow(NULL),
DrawScreen(NULL),
DrawStatus(NULL),
MoveScreen(NULL),
ProcessDList(NULL),
ProcessRDPList(NULL),
ShowCFB(NULL),
UpdateScreen(NULL),
ViStatusChanged(NULL),
ViWidthChanged(NULL),
SoftReset(NULL),
GetRomBrowserMenu(NULL),
OnRomBrowserMenuItem(NULL),
GetDebugInfo(NULL),
InitiateDebugger(NULL)
CaptureScreen(nullptr),
ChangeWindow(nullptr),
DrawScreen(nullptr),
DrawStatus(nullptr),
MoveScreen(nullptr),
ProcessDList(nullptr),
ProcessRDPList(nullptr),
ShowCFB(nullptr),
UpdateScreen(nullptr),
ViStatusChanged(nullptr),
ViWidthChanged(nullptr),
SoftReset(nullptr),
GetRomBrowserMenu(nullptr),
OnRomBrowserMenuItem(nullptr),
GetDebugInfo(nullptr),
InitiateDebugger(nullptr)
{
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
}
@ -31,7 +31,7 @@ InitiateDebugger(NULL)
CGfxPlugin::~CGfxPlugin()
{
WriteTrace(TraceGFXPlugin, TraceDebug, "Start");
Close(NULL);
Close(nullptr);
UnloadPlugin();
WriteTrace(TraceGFXPlugin, TraceDebug, "Done");
}
@ -62,15 +62,15 @@ bool CGfxPlugin::LoadFunctions(void)
LoadFunction(OnRomBrowserMenuItem);
//Make sure dll had all needed functions
if (ChangeWindow == NULL) { UnloadPlugin(); return false; }
if (DrawScreen == NULL) { DrawScreen = DummyDrawScreen; }
if (InitiateGFX == NULL) { UnloadPlugin(); return false; }
if (MoveScreen == NULL) { MoveScreen = DummyMoveScreen; }
if (ProcessDList == NULL) { UnloadPlugin(); return false; }
if (UpdateScreen == NULL) { UnloadPlugin(); return false; }
if (ViStatusChanged == NULL) { ViStatusChanged = DummyViStatusChanged; }
if (ViWidthChanged == NULL) { ViWidthChanged = DummyViWidthChanged; }
if (SoftReset == NULL) { SoftReset = DummySoftReset; }
if (ChangeWindow == nullptr) { UnloadPlugin(); return false; }
if (DrawScreen == nullptr) { DrawScreen = DummyDrawScreen; }
if (InitiateGFX == nullptr) { UnloadPlugin(); return false; }
if (MoveScreen == nullptr) { MoveScreen = DummyMoveScreen; }
if (ProcessDList == nullptr) { UnloadPlugin(); return false; }
if (UpdateScreen == nullptr) { UnloadPlugin(); return false; }
if (ViStatusChanged == nullptr) { ViStatusChanged = DummyViStatusChanged; }
if (ViWidthChanged == nullptr) { ViWidthChanged = DummyViWidthChanged; }
if (SoftReset == nullptr) { SoftReset = DummySoftReset; }
if (m_PluginInfo.Version >= 0x0103)
{
@ -80,17 +80,17 @@ bool CGfxPlugin::LoadFunctions(void)
LoadFunction(GetDebugInfo);
_LoadFunction("InitiateGFXDebugger", InitiateDebugger);
if (ProcessRDPList == NULL) { UnloadPlugin(); return false; }
if (CaptureScreen == NULL) { UnloadPlugin(); return false; }
if (ShowCFB == NULL) { UnloadPlugin(); return false; }
if (ProcessRDPList == nullptr) { UnloadPlugin(); return false; }
if (CaptureScreen == nullptr) { UnloadPlugin(); return false; }
if (ShowCFB == nullptr) { UnloadPlugin(); return false; }
}
if (m_PluginInfo.Version >= 0x0104)
{
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
if (PluginOpened == nullptr) { UnloadPlugin(); return false; }
}
if (GetDebugInfo != NULL)
if (GetDebugInfo != nullptr)
{
GetDebugInfo(&m_GFXDebug);
}
@ -114,7 +114,7 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
typedef struct
{
void * hWnd; /* Render window */
void * hStatusBar; /* if render window does not have a status bar then this is NULL */
void * hStatusBar; /* if render window does not have a status bar then this is nullptr */
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre
// bswap on a dword (32 bits) boundry
@ -162,7 +162,7 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
//Get Function from DLL
int32_t(CALL *InitiateGFX)(GFX_INFO Gfx_Info);
_LoadFunction("InitiateGFX", InitiateGFX);
if (InitiateGFX == NULL)
if (InitiateGFX == nullptr)
{
WriteTrace(TraceGFXPlugin, TraceDebug, "Failed to find InitiateGFX");
return false;
@ -174,10 +174,10 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
#if defined(ANDROID) || defined(__ANDROID__)
Info.SwapBuffers = SwapBuffers;
#endif
Info.hWnd = NULL;
Info.hStatusBar = NULL;
Info.hWnd = nullptr;
Info.hStatusBar = nullptr;
#ifdef _WIN32
if (Window != NULL)
if (Window != nullptr)
{
Info.hWnd = Window->GetWindowHandle();
Info.hStatusBar = Window->GetStatusBar();
@ -188,7 +188,7 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
// We are initializing the plugin before any rom is loaded so we do not have any correct
// parameters here.. it's just needed so we can config the DLL.
WriteTrace(TraceGFXPlugin, TraceDebug, "System = %X", System);
if (System == NULL)
if (System == nullptr)
{
static uint8_t Buffer[100];
static uint32_t Value = 0;
@ -219,7 +219,7 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
CMipsMemoryVM & MMU = System->m_MMU_VM;
CRegisters & Reg = System->m_Reg;
if (g_Rom->IsLoadedRomDDIPL() && g_Disk != NULL)
if (g_Rom->IsLoadedRomDDIPL() && g_Disk != nullptr)
Info.HEADER = g_Disk->GetDiskHeader();
else
Info.HEADER = g_Rom->GetRomAddress();
@ -261,30 +261,30 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
void CGfxPlugin::UnloadPluginDetails(void)
{
WriteTrace(TraceGFXPlugin, TraceDebug, "start");
if (m_LibHandle != NULL)
if (m_LibHandle != nullptr)
{
pjutil::DynLibClose(m_LibHandle);
m_LibHandle = NULL;
m_LibHandle = nullptr;
}
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
// CaptureScreen = NULL;
ChangeWindow = NULL;
GetDebugInfo = NULL;
DrawScreen = NULL;
DrawStatus = NULL;
// FrameBufferRead = NULL;
// FrameBufferWrite = NULL;
InitiateDebugger = NULL;
MoveScreen = NULL;
ProcessDList = NULL;
ProcessRDPList = NULL;
ShowCFB = NULL;
UpdateScreen = NULL;
ViStatusChanged = NULL;
ViWidthChanged = NULL;
GetRomBrowserMenu = NULL;
OnRomBrowserMenuItem = NULL;
// CaptureScreen = nullptr;
ChangeWindow = nullptr;
GetDebugInfo = nullptr;
DrawScreen = nullptr;
DrawStatus = nullptr;
// FrameBufferRead = nullptr;
// FrameBufferWrite = nullptr;
InitiateDebugger = nullptr;
MoveScreen = nullptr;
ProcessDList = nullptr;
ProcessRDPList = nullptr;
ShowCFB = nullptr;
UpdateScreen = nullptr;
ViStatusChanged = nullptr;
ViWidthChanged = nullptr;
GetRomBrowserMenu = nullptr;
OnRomBrowserMenuItem = nullptr;
WriteTrace(TraceGFXPlugin, TraceDebug, "Done");
}
@ -299,9 +299,9 @@ void CGfxPlugin::ProcessMenuItem(int32_t id)
#ifdef ANDROID
void CGfxPlugin::SwapBuffers(void)
{
RenderWindow * render = g_Plugins ? g_Plugins->MainWindow() : NULL;
RenderWindow * render = g_Plugins ? g_Plugins->MainWindow() : nullptr;
WriteTrace(TraceGFXPlugin, TraceDebug, "Start (render: %p)",render);
if (render != NULL)
if (render != nullptr)
{
render->SwapWindow();
}

View File

@ -3,16 +3,16 @@
#include <Common/path.h>
CPlugin::CPlugin() :
DllAbout(NULL),
DllConfig(NULL),
CloseDLL(NULL),
RomOpen(NULL),
RomClosed(NULL),
PluginOpened(NULL),
SetSettingInfo(NULL),
SetSettingInfo2(NULL),
SetSettingInfo3(NULL),
m_LibHandle(NULL),
DllAbout(nullptr),
DllConfig(nullptr),
CloseDLL(nullptr),
RomOpen(nullptr),
RomClosed(nullptr),
PluginOpened(nullptr),
SetSettingInfo(nullptr),
SetSettingInfo2(nullptr),
SetSettingInfo3(nullptr),
m_LibHandle(nullptr),
m_Initialized(false),
m_RomOpen(false)
{
@ -31,7 +31,7 @@ bool CPlugin::Load(const char * FileName)
WriteTrace(PluginTraceType(), TraceDebug, "Loading: %s", FileName);
// Already loaded, so unload first.
if (m_LibHandle != NULL)
if (m_LibHandle != nullptr)
{
UnloadPlugin();
}
@ -41,7 +41,7 @@ bool CPlugin::Load(const char * FileName)
m_LibHandle = pjutil::DynLibOpen(FileName, HaveDebugger());
WriteTrace(PluginTraceType(), TraceDebug, "Loaded: %s LibHandle: %X", FileName, m_LibHandle);
if (m_LibHandle == NULL)
if (m_LibHandle == nullptr)
{
return false;
}
@ -49,7 +49,7 @@ bool CPlugin::Load(const char * FileName)
// Get DLL information
void(CALL *GetDllInfo) (PLUGIN_INFO * PluginInfo);
LoadFunction(GetDllInfo);
if (GetDllInfo == NULL) { return false; }
if (GetDllInfo == nullptr) { return false; }
GetDllInfo(&m_PluginInfo);
if (!ValidPluginVersion(m_PluginInfo)) { return false; }
@ -120,12 +120,12 @@ bool CPlugin::Load(const char * FileName)
info.GetSettingSz = (const char * (*)(void *, int, char *, int))&CSettings::GetSettingSz;
info.SetSetting = (void(*)(void *, int, uint32_t))&CSettings::SetSetting;
info.SetSettingSz = (void(*)(void *, int, const char *))&CSettings::SetSettingSz;
info.UseUnregisteredSetting = NULL;
info.UseUnregisteredSetting = nullptr;
SetSettingInfo(&info);
}
if (RomClosed == NULL)
if (RomClosed == nullptr)
{
return false;
}
@ -158,7 +158,7 @@ void CPlugin::RomOpened(RenderWindow * Render)
if (m_PluginInfo.Type == PLUGIN_TYPE_GFX)
{
WriteTrace(PluginTraceType(), TraceDebug, "Render = %p", Render);
if (Render != NULL)
if (Render != nullptr)
{
WriteTrace(PluginTraceType(), TraceDebug, "Calling GfxThreadInit");
Render->GfxThreadInit();
@ -169,7 +169,7 @@ void CPlugin::RomOpened(RenderWindow * Render)
Render = Render; // used just for andoid
#endif
if (RomOpen != NULL)
if (RomOpen != nullptr)
{
WriteTrace(PluginTraceType(), TraceDebug, "Before Rom Open");
RomOpen();
@ -190,7 +190,7 @@ void CPlugin::RomClose(RenderWindow * Render)
if (m_PluginInfo.Type == PLUGIN_TYPE_GFX)
{
WriteTrace(PluginTraceType(), TraceDebug, "Render = %p", Render);
if (Render != NULL)
if (Render != nullptr)
{
WriteTrace(PluginTraceType(), TraceDebug, "Calling GfxThreadDone");
Render->GfxThreadDone();
@ -221,7 +221,7 @@ void CPlugin::Close(RenderWindow * Render)
WriteTrace(PluginTraceType(), TraceDebug, "(%s): Start", PluginType());
RomClose(Render);
m_Initialized = false;
if (CloseDLL != NULL)
if (CloseDLL != nullptr)
{
CloseDLL();
}
@ -232,25 +232,25 @@ void CPlugin::UnloadPlugin()
{
WriteTrace(PluginTraceType(), TraceDebug, "(%s): Start", PluginType());
memset(&m_PluginInfo, 0, sizeof(m_PluginInfo));
if (m_LibHandle != NULL)
if (m_LibHandle != nullptr)
{
UnloadPluginDetails();
}
if (m_LibHandle != NULL)
if (m_LibHandle != nullptr)
{
pjutil::DynLibClose(m_LibHandle);
m_LibHandle = NULL;
m_LibHandle = nullptr;
}
DllAbout = NULL;
CloseDLL = NULL;
RomOpen = NULL;
RomClosed = NULL;
PluginOpened = NULL;
DllConfig = NULL;
SetSettingInfo = NULL;
SetSettingInfo2 = NULL;
SetSettingInfo3 = NULL;
DllAbout = nullptr;
CloseDLL = nullptr;
RomOpen = nullptr;
RomClosed = nullptr;
PluginOpened = nullptr;
DllConfig = nullptr;
SetSettingInfo = nullptr;
SetSettingInfo2 = nullptr;
SetSettingInfo3 = nullptr;
WriteTrace(PluginTraceType(), TraceDebug, "(%s): Done", PluginType());
}

View File

@ -5,14 +5,14 @@
#include <Common/path.h>
CPlugins::CPlugins(SettingID PluginDirSetting, bool SyncPlugins) :
m_MainWindow(NULL),
m_SyncWindow(NULL),
m_MainWindow(nullptr),
m_SyncWindow(nullptr),
m_PluginDirSetting(PluginDirSetting),
m_PluginDir(g_Settings->LoadStringVal(PluginDirSetting)),
m_Gfx(NULL),
m_Audio(NULL),
m_RSP(NULL),
m_Control(NULL),
m_Gfx(nullptr),
m_Audio(nullptr),
m_RSP(nullptr),
m_Control(nullptr),
m_initilized(false),
m_SyncPlugins(SyncPlugins)
{
@ -95,7 +95,7 @@ void CPlugins::PluginChanged(CPlugins * _this)
}
else
{
_this->Reset(NULL);
_this->Reset(nullptr);
}
}
WriteTrace(TracePlugins, TraceDebug, "Done");
@ -104,7 +104,7 @@ void CPlugins::PluginChanged(CPlugins * _this)
template <typename plugin_type>
static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID, plugin_type * & plugin, const char * PluginDir, stdstr & FileName, TraceModuleProject64 TraceLevel, const char * type, bool IsCopy)
{
if (plugin != NULL)
if (plugin != nullptr)
{
return;
}
@ -127,7 +127,7 @@ static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID,
{
WriteTrace(TraceLevel, TraceError, "Failed to load %s", (const char *)PluginFileName);
delete plugin;
plugin = NULL;
plugin = nullptr;
}
WriteTrace(TraceLevel, TraceDebug, "%s Loading Done", type);
}
@ -147,7 +147,7 @@ void CPlugins::CreatePlugins(void)
LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir.c_str(), m_ControlFile, TraceControllerPlugin, "Control", m_SyncPlugins);
//Enable debugger
if (m_RSP != NULL && m_RSP->EnableDebugging)
if (m_RSP != nullptr && m_RSP->EnableDebugging)
{
WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging starting");
m_RSP->EnableDebugging(HaveDebugger());
@ -178,7 +178,7 @@ void CPlugins::GameReset(void)
void CPlugins::DestroyGfxPlugin(void)
{
if (m_Gfx == NULL)
if (m_Gfx == nullptr)
{
return;
}
@ -187,15 +187,15 @@ void CPlugins::DestroyGfxPlugin(void)
WriteTrace(TraceGFXPlugin, TraceInfo, "deleting");
delete m_Gfx;
WriteTrace(TraceGFXPlugin, TraceInfo, "m_Gfx deleted");
m_Gfx = NULL;
// g_Settings->UnknownSetting_GFX = NULL;
m_Gfx = nullptr;
// g_Settings->UnknownSetting_GFX = nullptr;
DestroyRspPlugin();
WriteTrace(TraceGFXPlugin, TraceInfo, "Done");
}
void CPlugins::DestroyAudioPlugin(void)
{
if (m_Audio == NULL)
if (m_Audio == nullptr)
{
return;
}
@ -204,16 +204,16 @@ void CPlugins::DestroyAudioPlugin(void)
WriteTrace(TraceAudioPlugin, TraceDebug, "before delete");
delete m_Audio;
WriteTrace(TraceAudioPlugin, TraceDebug, "after delete");
m_Audio = NULL;
m_Audio = nullptr;
WriteTrace(TraceAudioPlugin, TraceDebug, "before DestroyRspPlugin");
// g_Settings->UnknownSetting_AUDIO = NULL;
// g_Settings->UnknownSetting_AUDIO = nullptr;
DestroyRspPlugin();
WriteTrace(TraceAudioPlugin, TraceDebug, "after DestroyRspPlugin");
}
void CPlugins::DestroyRspPlugin(void)
{
if (m_RSP == NULL)
if (m_RSP == nullptr)
{
return;
}
@ -221,14 +221,14 @@ void CPlugins::DestroyRspPlugin(void)
m_RSP->Close(m_MainWindow);
WriteTrace(TraceRSPPlugin, TraceDebug, "before delete");
delete m_RSP;
m_RSP = NULL;
m_RSP = nullptr;
WriteTrace(TraceRSPPlugin, TraceDebug, "after delete");
// g_Settings->UnknownSetting_RSP = NULL;
// g_Settings->UnknownSetting_RSP = nullptr;
}
void CPlugins::DestroyControlPlugin(void)
{
if (m_Control == NULL)
if (m_Control == nullptr)
{
return;
}
@ -236,9 +236,9 @@ void CPlugins::DestroyControlPlugin(void)
m_Control->Close(m_MainWindow);
WriteTrace(TraceControllerPlugin, TraceDebug, "before delete");
delete m_Control;
m_Control = NULL;
m_Control = nullptr;
WriteTrace(TraceControllerPlugin, TraceDebug, "after delete");
// g_Settings->UnknownSetting_CTRL = NULL;
// g_Settings->UnknownSetting_CTRL = nullptr;
}
void CPlugins::SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWindow)
@ -276,10 +276,10 @@ bool CPlugins::Initiate(CN64System * System)
{
WriteTrace(TracePlugins, TraceDebug, "Start");
//Check to make sure we have the plugin available to be used
if (m_Gfx == NULL) { return false; }
if (m_Audio == NULL) { return false; }
if (m_RSP == NULL) { return false; }
if (m_Control == NULL) { return false; }
if (m_Gfx == nullptr) { return false; }
if (m_Audio == nullptr) { return false; }
if (m_RSP == nullptr) { return false; }
if (m_Control == nullptr) { return false; }
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Starting");
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
@ -372,10 +372,10 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
switch (Type)
{
case PLUGIN_TYPE_RSP:
if (m_RSP == NULL || m_RSP->DllConfig == NULL) { break; }
if (m_RSP == nullptr || m_RSP->DllConfig == nullptr) { break; }
if (!m_RSP->Initialized())
{
if (!m_RSP->Initiate(this, NULL))
if (!m_RSP->Initiate(this, nullptr))
{
break;
}
@ -383,10 +383,10 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
m_RSP->DllConfig(hParent);
break;
case PLUGIN_TYPE_GFX:
if (m_Gfx == NULL || m_Gfx->DllConfig == NULL) { break; }
if (m_Gfx == nullptr || m_Gfx->DllConfig == nullptr) { break; }
if (!m_Gfx->Initialized())
{
if (!m_Gfx->Initiate(NULL, m_MainWindow))
if (!m_Gfx->Initiate(nullptr, m_MainWindow))
{
break;
}
@ -394,10 +394,10 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
m_Gfx->DllConfig(hParent);
break;
case PLUGIN_TYPE_AUDIO:
if (m_Audio == NULL || m_Audio->DllConfig == NULL) { break; }
if (m_Audio == nullptr || m_Audio->DllConfig == nullptr) { break; }
if (!m_Audio->Initialized())
{
if (!m_Audio->Initiate(NULL, m_MainWindow))
if (!m_Audio->Initiate(nullptr, m_MainWindow))
{
break;
}
@ -409,10 +409,10 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
}
break;
case PLUGIN_TYPE_CONTROLLER:
if (m_Control == NULL || m_Control->DllConfig == NULL) { break; }
if (m_Control == nullptr || m_Control->DllConfig == nullptr) { break; }
if (!m_Control->Initialized())
{
if (!m_Control->Initiate(NULL, m_MainWindow))
if (!m_Control->Initiate(nullptr, m_MainWindow))
{
break;
}

View File

@ -12,18 +12,18 @@
void DummyFunc1(int a) { a += 1; }
CRSP_Plugin::CRSP_Plugin(void) :
DoRspCycles(NULL),
EnableDebugging(NULL),
DoRspCycles(nullptr),
EnableDebugging(nullptr),
m_CycleCount(0),
GetDebugInfo(NULL),
InitiateDebugger(NULL)
GetDebugInfo(nullptr),
InitiateDebugger(nullptr)
{
memset(&m_RSPDebug, 0, sizeof(m_RSPDebug));
}
CRSP_Plugin::~CRSP_Plugin()
{
Close(NULL);
Close(nullptr);
UnloadPlugin();
}
@ -36,21 +36,21 @@ bool CRSP_Plugin::LoadFunctions(void)
_LoadFunction("GetRspDebugInfo", GetDebugInfo);
_LoadFunction("InitiateRSPDebugger", InitiateDebugger);
LoadFunction(EnableDebugging);
if (EnableDebugging == NULL) { EnableDebugging = DummyFunc1; }
if (EnableDebugging == nullptr) { EnableDebugging = DummyFunc1; }
//Make sure dll had all needed functions
if (DoRspCycles == NULL) { UnloadPlugin(); return false; }
if (InitiateRSP == NULL) { UnloadPlugin(); return false; }
if (RomClosed == NULL) { UnloadPlugin(); return false; }
if (CloseDLL == NULL) { UnloadPlugin(); return false; }
if (DoRspCycles == nullptr) { UnloadPlugin(); return false; }
if (InitiateRSP == nullptr) { UnloadPlugin(); return false; }
if (RomClosed == nullptr) { UnloadPlugin(); return false; }
if (CloseDLL == nullptr) { UnloadPlugin(); return false; }
if (m_PluginInfo.Version >= 0x0102)
{
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
if (PluginOpened == nullptr) { UnloadPlugin(); return false; }
}
// Get debug info if able
if (GetDebugInfo != NULL)
if (GetDebugInfo != nullptr)
{
GetDebugInfo(&m_RSPDebug);
}
@ -111,17 +111,17 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
RSP_INFO_1_3 Info = { 0 };
#ifdef _WIN32
Info.hInst = (Plugins != NULL && Plugins->MainWindow() != NULL) ? Plugins->MainWindow()->GetModuleInstance() : NULL;
Info.hInst = (Plugins != nullptr && Plugins->MainWindow() != nullptr) ? Plugins->MainWindow()->GetModuleInstance() : nullptr;
#else
Info.hInst = NULL;
Info.hInst = nullptr;
#endif
Info.CheckInterrupts = DummyCheckInterrupts;
Info.MemoryBswaped = (System == NULL); // only true when the system's not yet loaded
Info.MemoryBswaped = (System == nullptr); // only true when the system's not yet loaded
//Get Function from DLL
void(CALL *InitiateRSP) (RSP_INFO_1_3 RSP_Info, uint32_t * Cycles);
LoadFunction(InitiateRSP);
if (InitiateRSP == NULL)
if (InitiateRSP == nullptr)
{
WriteTrace(TraceRSPPlugin, TraceDebug, "Failed to find InitiateRSP");
WriteTrace(TraceRSPPlugin, TraceDebug, "Done (res: false)");
@ -130,7 +130,7 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
// We are initializing the plugin before any rom is loaded so we do not have any correct
// parameters here.. just needed to we can config the DLL.
if (System == NULL)
if (System == nullptr)
{
static uint8_t Buffer[100];
static uint32_t Value = 0;
@ -177,7 +177,7 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
CMipsMemoryVM & MMU = System->m_MMU_VM;
CRegisters & Reg = System->m_Reg;
if (g_Rom->IsLoadedRomDDIPL() && g_Disk != NULL)
if (g_Rom->IsLoadedRomDDIPL() && g_Disk != nullptr)
Info.HEADER = g_Disk->GetDiskHeader();
else
Info.HEADER = g_Rom->GetRomAddress();
@ -251,17 +251,17 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
RSP_INFO_1_1 Info = { 0 };
#ifdef _WIN32
Info.hInst = (Plugins != NULL && Plugins->MainWindow() != NULL) ? Plugins->MainWindow()->GetModuleInstance() : NULL;
Info.hInst = (Plugins != nullptr && Plugins->MainWindow() != nullptr) ? Plugins->MainWindow()->GetModuleInstance() : nullptr;
#else
Info.hInst = NULL;
Info.hInst = nullptr;
#endif
Info.CheckInterrupts = DummyCheckInterrupts;
Info.MemoryBswaped = (System == NULL); // only true when the system's not yet loaded
Info.MemoryBswaped = (System == nullptr); // only true when the system's not yet loaded
//Get Function from DLL
void(CALL *InitiateRSP) (RSP_INFO_1_1 RSP_Info, uint32_t * Cycles);
LoadFunction(InitiateRSP);
if (InitiateRSP == NULL)
if (InitiateRSP == nullptr)
{
WriteTrace(TraceRSPPlugin, TraceDebug, "Failed to find InitiateRSP");
WriteTrace(TraceRSPPlugin, TraceDebug, "Done (res: false)");
@ -270,7 +270,7 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
// We are initializing the plugin before any rom is loaded so we do not have any correct
// parameters here.. just needed to we can config the DLL.
if (System == NULL)
if (System == nullptr)
{
static uint8_t Buffer[100];
static uint32_t Value = 0;
@ -354,10 +354,10 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
void CRSP_Plugin::UnloadPluginDetails(void)
{
memset(&m_RSPDebug, 0, sizeof(m_RSPDebug));
DoRspCycles = NULL;
EnableDebugging = NULL;
GetDebugInfo = NULL;
InitiateDebugger = NULL;
DoRspCycles = nullptr;
EnableDebugging = nullptr;
GetDebugInfo = nullptr;
InitiateDebugger = nullptr;
}
void CRSP_Plugin::ProcessMenuItem(int id)

View File

@ -31,12 +31,12 @@ CRomList::CRomList() :
m_RefreshThread((CThread::CTHREAD_START_ROUTINE)RefreshRomListStatic),
m_StopRefresh(false),
m_GameDir(g_Settings->LoadStringVal(RomList_GameDir).c_str()),
m_NotesIniFile(NULL),
m_ExtIniFile(NULL),
m_NotesIniFile(nullptr),
m_ExtIniFile(nullptr),
#ifdef _WIN32
m_ZipIniFile(NULL),
m_ZipIniFile(nullptr),
#endif
m_RomIniFile(NULL)
m_RomIniFile(nullptr)
{
WriteTrace(TraceRomList, TraceVerbose, "Start");
if (g_Settings)
@ -63,23 +63,23 @@ CRomList::~CRomList()
if (m_NotesIniFile)
{
delete m_NotesIniFile;
m_NotesIniFile = NULL;
m_NotesIniFile = nullptr;
}
if (m_ExtIniFile)
{
delete m_ExtIniFile;
m_ExtIniFile = NULL;
m_ExtIniFile = nullptr;
}
if (m_RomIniFile)
{
delete m_RomIniFile;
m_RomIniFile = NULL;
m_RomIniFile = nullptr;
}
#ifdef _WIN32
if (m_ZipIniFile)
{
delete m_ZipIniFile;
m_ZipIniFile = NULL;
m_ZipIniFile = nullptr;
}
#endif
if (g_Settings)
@ -277,7 +277,7 @@ void CRomList::FillRomList(strlist & FileList, const char * Directory)
const char backup_character = szHeader[2 * x + delimit_offset];
szHeader[2 * x + delimit_offset] = '\0';
*(uint32_t *)&RomData[x] = strtoul(&szHeader[2 * x], NULL, 16);
*(uint32_t *)&RomData[x] = strtoul(&szHeader[2 * x], nullptr, 16);
szHeader[2 * x + delimit_offset] = backup_character;
}
@ -344,13 +344,13 @@ bool CRomList::LoadDataFromRomFile(const char * FileName, uint8_t * Data, int32_
char zname[132];
unzFile file;
file = unzOpen(FileName);
if (file == NULL) { return false; }
if (file == nullptr) { return false; }
port = unzGoToFirstFile(file);
FoundRom = false;
while (port == UNZ_OK && FoundRom == false)
{
unzGetCurrentFileInfo(file, &info, zname, 128, NULL, 0, NULL, 0);
unzGetCurrentFileInfo(file, &info, zname, 128, nullptr, 0, nullptr, 0);
if (unzLocateFile(file, zname, 1) != UNZ_OK)
{
unzClose(file);
@ -507,7 +507,7 @@ bool CRomList::FillRomInfo(ROM_INFO * pRomInfo)
if (LoadDataFromRomFile(pRomInfo->szFullFileName, RomData, sizeof(RomData), &pRomInfo->RomSize, pRomInfo->FileFormat))
{
if (strstr(pRomInfo->szFullFileName, "?") != NULL)
if (strstr(pRomInfo->szFullFileName, "?") != nullptr)
{
strcpy(pRomInfo->FileName, strstr(pRomInfo->szFullFileName, "?") + 1);
}
@ -613,7 +613,7 @@ void CRomList::FillRomExtensionInfo(ROM_INFO * pRomInfo)
//Get the selected color
String.Format("%s.Sel", pRomInfo->Status);
String = m_RomIniFile->GetString("Rom Status", String.c_str(), "FFFFFFFF");
uint32_t selcol = strtoul(String.c_str(), NULL, 16);
uint32_t selcol = strtoul(String.c_str(), nullptr, 16);
if (selcol & 0x80000000)
{
pRomInfo->SelColor = -1;

View File

@ -23,7 +23,7 @@
#include <Project64-core/N64System/N64Types.h>
#include <Common/Trace.h>
CSettings * g_Settings = NULL;
CSettings * g_Settings = nullptr;
CSettings::CSettings() :
m_NextAutoSettingId(0x200000)
@ -44,7 +44,7 @@ CSettings::~CSettings()
for (SETTING_CALLBACK::iterator cb_iter = m_Callback.begin(); cb_iter != m_Callback.end(); cb_iter++)
{
SETTING_CHANGED_CB * item = cb_iter->second;
while (item != NULL)
while (item != nullptr)
{
SETTING_CHANGED_CB * current_item = item;
item = item->Next;
@ -1252,7 +1252,7 @@ void CSettings::NotifyCallBacks(SettingID Type)
return;
}
for (SETTING_CHANGED_CB * item = Callback->second; item != NULL; item = item->Next)
for (SETTING_CHANGED_CB * item = Callback->second; item != nullptr; item = item->Next)
{
item->Func(item->Data);
}
@ -1263,7 +1263,7 @@ void CSettings::RegisterChangeCB(SettingID Type, void * Data, SettingChangedFunc
SETTING_CHANGED_CB * new_item = new SETTING_CHANGED_CB;
new_item->Data = Data;
new_item->Func = Func;
new_item->Next = NULL;
new_item->Next = nullptr;
SETTING_CALLBACK::iterator Callback = m_Callback.find(Type);
if (Callback != m_Callback.end())
@ -1289,7 +1289,7 @@ void CSettings::UnregisterChangeCB(SettingID Type, void * Data, SettingChangedFu
SETTING_CALLBACK::iterator Callback = m_Callback.find(Type);
if (Callback != m_Callback.end())
{
SETTING_CHANGED_CB * PrevItem = NULL;
SETTING_CHANGED_CB * PrevItem = nullptr;
SETTING_CHANGED_CB * item = Callback->second;
while (item)
@ -1297,7 +1297,7 @@ void CSettings::UnregisterChangeCB(SettingID Type, void * Data, SettingChangedFu
if (Callback->first == Type && item->Data == Data && item->Func == Func)
{
bRemoved = true;
if (PrevItem == NULL)
if (PrevItem == nullptr)
{
if (item->Next)
{
@ -1316,7 +1316,7 @@ void CSettings::UnregisterChangeCB(SettingID Type, void * Data, SettingChangedFu
PrevItem->Next = item->Next;
}
delete item;
item = NULL;
item = nullptr;
break;
}
PrevItem = item;

View File

@ -33,32 +33,32 @@ CLogSettings::CLogSettings()
m_RefCount += 1;
if (m_RefCount == 1)
{
g_Settings->RegisterChangeCB(Logging_GenerateLog, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogRDRamRegisters, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogSPRegisters, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogDPCRegisters, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogDPSRegisters, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogMIPSInterface, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogVideoInterface, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogAudioInterface, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogPerInterface, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogRDRAMInterface, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogSerialInterface, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogPRDMAOperations, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogPRDirectMemLoads, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogPRDMAMemLoads, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogPRDirectMemStores, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogPRDMAMemStores, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogControllerPak, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogCP0changes, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogCP0reads, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogTLB, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogExceptions, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_NoInterrupts, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogCache, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogRomHeader, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogUnknown, NULL, RefreshSettings);
RefreshSettings(NULL);
g_Settings->RegisterChangeCB(Logging_GenerateLog, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogRDRamRegisters, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogSPRegisters, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogDPCRegisters, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogDPSRegisters, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogMIPSInterface, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogVideoInterface, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogAudioInterface, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogPerInterface, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogRDRAMInterface, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogSerialInterface, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogPRDMAOperations, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogPRDirectMemLoads, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogPRDMAMemLoads, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogPRDirectMemStores, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogPRDMAMemStores, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogControllerPak, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogCP0changes, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogCP0reads, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogTLB, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogExceptions, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_NoInterrupts, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogCache, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogRomHeader, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Logging_LogUnknown, nullptr, RefreshSettings);
RefreshSettings(nullptr);
}
}
@ -67,31 +67,31 @@ CLogSettings::~CLogSettings()
m_RefCount -= 1;
if (m_RefCount == 0)
{
g_Settings->UnregisterChangeCB(Logging_GenerateLog, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogRDRamRegisters, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogSPRegisters, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogDPCRegisters, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogDPSRegisters, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogMIPSInterface, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogVideoInterface, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogAudioInterface, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogPerInterface, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogRDRAMInterface, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogSerialInterface, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogPRDMAOperations, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogPRDirectMemLoads, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogPRDMAMemLoads, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogPRDirectMemStores, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogPRDMAMemStores, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogControllerPak, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogCP0changes, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogCP0reads, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogTLB, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogExceptions, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_NoInterrupts, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogCache, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogRomHeader, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogUnknown, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_GenerateLog, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogRDRamRegisters, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogSPRegisters, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogDPCRegisters, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogDPSRegisters, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogMIPSInterface, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogVideoInterface, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogAudioInterface, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogPerInterface, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogRDRAMInterface, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogSerialInterface, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogPRDMAOperations, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogPRDirectMemLoads, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogPRDMAMemLoads, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogPRDirectMemStores, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogPRDMAMemStores, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogControllerPak, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogCP0changes, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogCP0reads, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogTLB, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogExceptions, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_NoInterrupts, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogCache, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogRomHeader, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Logging_LogUnknown, nullptr, RefreshSettings);
}
}

View File

@ -14,13 +14,13 @@ CN64SystemSettings::CN64SystemSettings()
m_RefCount += 1;
if (m_RefCount == 1)
{
g_Settings->RegisterChangeCB(UserInterface_BasicMode, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(UserInterface_ShowCPUPer, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(UserInterface_DisplayFrameRate, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(Debugger_ShowDListAListCount, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(GameRunning_LimitFPS, NULL, RefreshSettings);
g_Settings->RegisterChangeCB(UserInterface_BasicMode, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(UserInterface_ShowCPUPer, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(UserInterface_DisplayFrameRate, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(Debugger_ShowDListAListCount, nullptr, RefreshSettings);
g_Settings->RegisterChangeCB(GameRunning_LimitFPS, nullptr, RefreshSettings);
RefreshSettings(NULL);
RefreshSettings(nullptr);
}
}
@ -29,11 +29,11 @@ CN64SystemSettings::~CN64SystemSettings()
m_RefCount -= 1;
if (m_RefCount == 0)
{
g_Settings->UnregisterChangeCB(UserInterface_BasicMode, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(UserInterface_DisplayFrameRate, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(UserInterface_ShowCPUPer, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_ShowDListAListCount, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(GameRunning_LimitFPS, NULL, RefreshSettings);
g_Settings->UnregisterChangeCB(UserInterface_BasicMode, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(UserInterface_DisplayFrameRate, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(UserInterface_ShowCPUPer, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_ShowDListAListCount, nullptr, RefreshSettings);
g_Settings->UnregisterChangeCB(GameRunning_LimitFPS, nullptr, RefreshSettings);
}
}

View File

@ -2,7 +2,7 @@
#include "SettingsType-Application.h"
#include <Common/path.h>
CIniFile * CSettingTypeApplication::m_SettingsIniFile = NULL;
CIniFile * CSettingTypeApplication::m_SettingsIniFile = nullptr;
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, uint32_t DefaultValue) :
m_DefaultStr(""),
@ -105,7 +105,7 @@ void CSettingTypeApplication::Flush()
void CSettingTypeApplication::ResetAll()
{
if (m_SettingsIniFile == NULL)
if (m_SettingsIniFile == nullptr)
{
return;
}
@ -123,7 +123,7 @@ void CSettingTypeApplication::CleanUp()
{
m_SettingsIniFile->SetAutoFlush(true);
delete m_SettingsIniFile;
m_SettingsIniFile = NULL;
m_SettingsIniFile = nullptr;
}
}
@ -229,7 +229,7 @@ void CSettingTypeApplication::Save(uint32_t Index, bool Value)
((m_DefaultSetting == Default_Constant && m_DefaultValue == (uint32_t)Value) ||
(m_DefaultSetting != Default_Constant && (indexed ? g_Settings->LoadBoolIndex(m_DefaultSetting, Index) : g_Settings->LoadBool(m_DefaultSetting)) == Value)))
{
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), NULL);
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), nullptr);
}
else
{
@ -243,7 +243,7 @@ void CSettingTypeApplication::Save(uint32_t /*Index*/, uint32_t Value)
((m_DefaultSetting == Default_Constant && m_DefaultValue == Value) ||
(m_DefaultSetting != Default_Constant && g_Settings->LoadDword(m_DefaultSetting) == Value)))
{
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), NULL);
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), nullptr);
}
else
{
@ -258,11 +258,11 @@ void CSettingTypeApplication::Save(uint32_t Index, const std::string & Value)
void CSettingTypeApplication::Save(uint32_t /*Index*/, const char * Value)
{
if (m_DefaultSetting != Default_None && Value != NULL &&
if (m_DefaultSetting != Default_None && Value != nullptr &&
((m_DefaultSetting == Default_Constant && strcmp(m_DefaultStr,Value) == 0) ||
(m_DefaultSetting != Default_Constant && strcmp(g_Settings->LoadStringVal(m_DefaultSetting).c_str(),Value) == 0)))
{
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), NULL);
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), nullptr);
}
else
{
@ -284,5 +284,5 @@ std::string CSettingTypeApplication::FixSectionName(const char * Section)
void CSettingTypeApplication::Delete(uint32_t /*Index*/)
{
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), NULL);
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), nullptr);
}

View File

@ -91,5 +91,5 @@ void CSettingTypeApplicationIndex::Save(uint32_t Index, const char * Value)
void CSettingTypeApplicationIndex::Delete(uint32_t Index)
{
m_KeyNameIdex = stdstr_f("%s %d", m_KeyName.c_str(), Index);
CSettingTypeApplication::Save(0, (const char *)NULL);
CSettingTypeApplication::Save(0, (const char *)nullptr);
}

View File

@ -4,7 +4,7 @@
bool CSettingTypeGame::m_RdbEditor = false;
bool CSettingTypeGame::m_EraseDefaults = true;
std::string * CSettingTypeGame::m_SectionIdent = NULL;
std::string * CSettingTypeGame::m_SectionIdent = nullptr;
CSettingTypeGame::CSettingTypeGame(const char * Name, bool DefaultValue) :
CSettingTypeApplication("", Name, DefaultValue)
@ -33,18 +33,18 @@ CSettingTypeGame::~CSettingTypeGame()
void CSettingTypeGame::Initialize(void)
{
WriteTrace(TraceAppInit, TraceDebug, "Start");
UpdateSettings(NULL);
g_Settings->RegisterChangeCB(Game_IniKey, NULL, UpdateSettings);
UpdateSettings(nullptr);
g_Settings->RegisterChangeCB(Game_IniKey, nullptr, UpdateSettings);
WriteTrace(TraceAppInit, TraceDebug, "Done");
}
void CSettingTypeGame::CleanUp(void)
{
g_Settings->UnregisterChangeCB(Game_IniKey, NULL, UpdateSettings);
g_Settings->UnregisterChangeCB(Game_IniKey, nullptr, UpdateSettings);
if (m_SectionIdent)
{
delete m_SectionIdent;
m_SectionIdent = NULL;
m_SectionIdent = nullptr;
}
}
@ -59,7 +59,7 @@ void CSettingTypeGame::UpdateSettings(void * /*Data */)
m_EraseDefaults = g_Settings->LoadBool(Setting_EraseGameDefaults);
stdstr SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
if (m_SectionIdent == NULL)
if (m_SectionIdent == nullptr)
{
m_SectionIdent = new stdstr;
}

View File

@ -109,5 +109,5 @@ void CSettingTypeRDBCpuType::Save (uint32_t /*Index*/, const char * /*Value*/ )
void CSettingTypeRDBCpuType::Delete(uint32_t /*Index*/ )
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),nullptr);
}

View File

@ -98,5 +98,5 @@ void CSettingTypeRDBOnOff::Save (uint32_t /*Index*/, const char * /*Value*/ )
void CSettingTypeRDBOnOff::Delete(uint32_t /*Index*/ )
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),nullptr);
}

View File

@ -87,5 +87,5 @@ void CSettingTypeRDBRDRamSize::Save (uint32_t /*Index*/, const char * /*Value*/
void CSettingTypeRDBRDRamSize::Delete(uint32_t /*Index*/ )
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),nullptr);
}

View File

@ -115,5 +115,5 @@ void CSettingTypeRDBSaveChip::Save (uint32_t /*Index*/, const char * /*Value*/ )
void CSettingTypeRDBSaveChip::Delete(uint32_t /*Index*/ )
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),nullptr);
}

View File

@ -110,5 +110,5 @@ void CSettingTypeRDBYesNo::Save(uint32_t /*Index*/, const char * /*Value*/)
void CSettingTypeRDBYesNo::Delete(uint32_t /*Index*/)
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), NULL);
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), nullptr);
}

View File

@ -1,10 +1,10 @@
#include "stdafx.h"
#include "SettingsType-RomDatabase.h"
CIniFile * CSettingTypeRomDatabase::m_SettingsIniFile = NULL;
CIniFile * CSettingTypeRomDatabase::m_VideoIniFile = NULL;
CIniFile * CSettingTypeRomDatabase::m_AudioIniFile = NULL;
std::string * CSettingTypeRomDatabase::m_SectionIdent = NULL;
CIniFile * CSettingTypeRomDatabase::m_SettingsIniFile = nullptr;
CIniFile * CSettingTypeRomDatabase::m_VideoIniFile = nullptr;
CIniFile * CSettingTypeRomDatabase::m_AudioIniFile = nullptr;
std::string * CSettingTypeRomDatabase::m_SectionIdent = nullptr;
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, uint32_t DefaultValue, bool DeleteOnDefault) :
m_KeyName(StripNameSection(Name)),
@ -62,8 +62,8 @@ void CSettingTypeRomDatabase::Initialize(void)
m_VideoIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_VideoRDB).c_str());
m_AudioIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_AudioRDB).c_str());
g_Settings->RegisterChangeCB(Game_IniKey, NULL, GameChanged);
g_Settings->RegisterChangeCB(Cmd_BaseDirectory, NULL, BaseDirChanged);
g_Settings->RegisterChangeCB(Game_IniKey, nullptr, GameChanged);
g_Settings->RegisterChangeCB(Cmd_BaseDirectory, nullptr, BaseDirChanged);
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
WriteTrace(TraceAppInit, TraceDebug, "Done");
@ -71,27 +71,27 @@ void CSettingTypeRomDatabase::Initialize(void)
void CSettingTypeRomDatabase::CleanUp(void)
{
g_Settings->UnregisterChangeCB(Cmd_BaseDirectory, NULL, BaseDirChanged);
g_Settings->UnregisterChangeCB(Game_IniKey, NULL, GameChanged);
g_Settings->UnregisterChangeCB(Cmd_BaseDirectory, nullptr, BaseDirChanged);
g_Settings->UnregisterChangeCB(Game_IniKey, nullptr, GameChanged);
if (m_SettingsIniFile)
{
delete m_SettingsIniFile;
m_SettingsIniFile = NULL;
m_SettingsIniFile = nullptr;
}
if (m_VideoIniFile)
{
delete m_VideoIniFile;
m_VideoIniFile = NULL;
m_VideoIniFile = nullptr;
}
if (m_AudioIniFile)
{
delete m_AudioIniFile;
m_AudioIniFile = NULL;
m_AudioIniFile = nullptr;
}
if (m_SectionIdent)
{
delete m_SectionIdent;
m_SectionIdent = NULL;
m_SectionIdent = nullptr;
}
}
@ -100,17 +100,17 @@ void CSettingTypeRomDatabase::BaseDirChanged(void * /*Data */)
if (m_SettingsIniFile)
{
delete m_SettingsIniFile;
m_SettingsIniFile = NULL;
m_SettingsIniFile = nullptr;
}
if (m_VideoIniFile)
{
delete m_VideoIniFile;
m_VideoIniFile = NULL;
m_VideoIniFile = nullptr;
}
if (m_AudioIniFile)
{
delete m_AudioIniFile;
m_AudioIniFile = NULL;
m_AudioIniFile = nullptr;
}
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
m_VideoIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_VideoRDB).c_str());
@ -332,15 +332,15 @@ void CSettingTypeRomDatabase::Delete(uint32_t /*Index*/)
}
if (m_VideoSetting)
{
m_VideoIniFile->SaveString(Section(), m_KeyName.c_str(), NULL);
m_VideoIniFile->SaveString(Section(), m_KeyName.c_str(), nullptr);
}
else if (m_AudioSetting)
{
m_AudioIniFile->SaveString(Section(), m_KeyName.c_str(), NULL);
m_AudioIniFile->SaveString(Section(), m_KeyName.c_str(), nullptr);
}
else
{
m_SettingsIniFile->SaveString(Section(), m_KeyName.c_str(), NULL);
m_SettingsIniFile->SaveString(Section(), m_KeyName.c_str(), nullptr);
}
}

View File

@ -92,5 +92,5 @@ void CSettingTypeRomDatabaseIndex::Save (uint32_t /*Index*/, const char * /*Valu
void CSettingTypeRomDatabaseIndex::Delete (uint32_t /*Index*/ )
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),nullptr);
}

View File

@ -6,7 +6,7 @@ class CSettingTypeTempBool :
public CSettingType
{
public:
CSettingTypeTempBool(bool initialValue, const char * name = NULL);
CSettingTypeTempBool(bool initialValue, const char * name = nullptr);
~CSettingTypeTempBool();
bool IndexBasedSetting(void) const { return false; }

View File

@ -35,7 +35,7 @@ void CProject64Input::InitiateControllers(CONTROL_INFO * ControlInfo)
{
CGuard guard(m_CS);
m_ControlInfo = *ControlInfo;
if (m_DirectInput.get() == NULL)
if (m_DirectInput.get() == nullptr)
{
m_DirectInput.reset(new CDirectInput(m_hinst));
}
@ -97,7 +97,7 @@ void CProject64Input::EndScanDevices(void)
CDirectInput::ScanResult CProject64Input::ScanDevices(BUTTON & Button)
{
CDirectInput::ScanResult Result = CDirectInput::SCAN_FAILED;
if (m_DirectInput.get() != NULL)
if (m_DirectInput.get() != nullptr)
{
Result = m_DirectInput->ScanDevices(Button);
}
@ -106,7 +106,7 @@ CDirectInput::ScanResult CProject64Input::ScanDevices(BUTTON & Button)
std::wstring CProject64Input::ButtonAssignment(BUTTON & Button)
{
if (m_DirectInput.get() != NULL)
if (m_DirectInput.get() != nullptr)
{
return m_DirectInput->ButtonAssignment(Button);
}
@ -115,7 +115,7 @@ std::wstring CProject64Input::ButtonAssignment(BUTTON & Button)
std::wstring CProject64Input::ControllerDevices(const N64CONTROLLER & Controller)
{
if (m_DirectInput.get() != NULL)
if (m_DirectInput.get() != nullptr)
{
return m_DirectInput->ControllerDevices(Controller);
}

View File

@ -4,7 +4,7 @@
DeviceNotification::DeviceNotification()
{
Create(NULL);
Create(nullptr);
}
DeviceNotification::~DeviceNotification()

View File

@ -19,9 +19,9 @@ CDirectInput::CDirectInput(HINSTANCE hinst) :
typedef HRESULT(WINAPI *tylpGetDIHandle)(HINSTANCE, DWORD, REFIID, LPVOID*, LPUNKNOWN);
tylpGetDIHandle lpGetDIHandle = (tylpGetDIHandle)GetProcAddress(m_hDirectInputDLL, "DirectInput8Create");
if (lpGetDIHandle != NULL)
if (lpGetDIHandle != nullptr)
{
HRESULT hr = lpGetDIHandle(m_hinst, DIRECTINPUT_VERSION, IID_IDirectInput8, (LPVOID*)&m_pDIHandle, NULL);
HRESULT hr = lpGetDIHandle(m_hinst, DIRECTINPUT_VERSION, IID_IDirectInput8, (LPVOID*)&m_pDIHandle, nullptr);
if (FAILED(hr))
{
return;
@ -41,7 +41,7 @@ CDirectInput::~CDirectInput()
if (itr->second.didHandle != nullptr)
{
itr->second.didHandle->Release();
itr->second.didHandle = NULL;
itr->second.didHandle = nullptr;
}
}
}
@ -118,13 +118,13 @@ BOOL CDirectInput::EnumMakeDeviceList(LPCDIDEVICEINSTANCE lpddi)
Device.dwDevType = lpddi->dwDevType;
Device.ProductName = stdstr().FromUTF16(lpddi->tszProductName);
Device.InstanceName = stdstr().FromUTF16(lpddi->tszInstanceName);
HRESULT hResult = m_pDIHandle->CreateDevice(lpddi->guidInstance, &Device.didHandle, NULL);
HRESULT hResult = m_pDIHandle->CreateDevice(lpddi->guidInstance, &Device.didHandle, nullptr);
if (!SUCCEEDED(hResult))
{
return DIENUM_CONTINUE;
}
LPCDIDATAFORMAT ppDiDataFormat = NULL;
LPCDIDATAFORMAT ppDiDataFormat = nullptr;
if (DeviceType == DI8DEVTYPE_KEYBOARD)
{
ppDiDataFormat = &c_dfDIKeyboard;

View File

@ -197,7 +197,7 @@ extern "C" int WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID /*lpReser
else if (fdwReason == DLL_PROCESS_DETACH)
{
delete g_InputPlugin;
g_InputPlugin = NULL;
g_InputPlugin = nullptr;
}
return TRUE;
}

View File

@ -1,7 +1,7 @@
#include "wtl-BitmapPicture.h"
CBitmapPicture::CBitmapPicture() :
m_hBitmap(NULL),
m_hBitmap(nullptr),
m_nResourceID(-1),
m_ResourceIcon(false)
{
@ -23,7 +23,7 @@ LRESULT CBitmapPicture::OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPara
CIcon hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), m_nResourceID > 0 ? MAKEINTRESOURCE(m_nResourceID) : m_strResourceName.c_str(), IMAGE_ICON, m_IconWidth, m_IconHeight, LR_DEFAULTCOLOR | LR_DEFAULTSIZE);
if (!hIcon.IsNull())
{
dc.DrawIconEx(0, 0, hIcon, rect.Width(), rect.Height(), 0, NULL, DI_NORMAL);
dc.DrawIconEx(0, 0, hIcon, rect.Width(), rect.Height(), 0, nullptr, DI_NORMAL);
}
}
else

View File

@ -45,7 +45,7 @@ void CScanButton::DetectKey(void)
time(&m_ScanStart);
g_InputPlugin->StartScanDevices(m_DisplayCtrlId);
m_DisplayCtrl.Invalidate();
m_ScanBtn.SetTimer(DETECT_KEY_TIMER, SACN_INTERVAL, NULL);
m_ScanBtn.SetTimer(DETECT_KEY_TIMER, SACN_INTERVAL, nullptr);
MakeOverlay();
}
@ -118,10 +118,10 @@ void CScanButton::OnTimer(UINT_PTR nIDEvent)
CWindow Dialog = m_ScanBtn.GetParent().GetParent();
Dialog.SetWindowText(L"Configure Input");
if (m_Overlay.m_hWnd != NULL)
if (m_Overlay.m_hWnd != nullptr)
{
m_Overlay.DestroyWindow();
m_Overlay = NULL;
m_Overlay = nullptr;
}
g_InputPlugin->EndScanDevices();
@ -143,8 +143,8 @@ void CScanButton::MakeOverlay(void)
CRect size;
ControllerDlg.GetWindowRect(&size);
#ifndef _DEBUG
m_Overlay = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TRANSPARENT, L"BlockerClass", L"Blocker", WS_POPUP, size.left, size.top, size.Width(), size.Height(), ControllerDlg, nullptr, g_InputPlugin->hInst(), NULL);
if (m_Overlay == NULL)
m_Overlay = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TRANSPARENT, L"BlockerClass", L"Blocker", WS_POPUP, size.left, size.top, size.Width(), size.Height(), ControllerDlg, nullptr, g_InputPlugin->hInst(), nullptr);
if (m_Overlay == nullptr)
{
return;
}

View File

@ -46,7 +46,7 @@ class CProject64VideoWtlModule :
public:
CProject64VideoWtlModule(HINSTANCE hinst)
{
Init(NULL, hinst);
Init(nullptr, hinst);
}
virtual ~CProject64VideoWtlModule(void)
{
@ -54,7 +54,7 @@ public:
}
};
CProject64VideoWtlModule * WtlModule = NULL;
CProject64VideoWtlModule * WtlModule = nullptr;
void ConfigInit(void * hinst)
{
@ -66,7 +66,7 @@ void ConfigCleanup(void)
if (WtlModule)
{
delete WtlModule;
WtlModule = NULL;
WtlModule = nullptr;
}
}
@ -88,7 +88,7 @@ protected:
UINT m_uToolFlags;
// Construction
CToolTipDialog(UINT uTTSTyle = TTS_NOPREFIX | TTS_BALLOON, UINT uToolFlags = TTF_IDISHWND | TTF_SUBCLASS)
: m_TT(NULL), m_uTTStyle(uTTSTyle),
: m_TT(nullptr), m_uTTStyle(uTTSTyle),
m_uToolFlags(uToolFlags | TTF_SUBCLASS)
{}
@ -96,7 +96,7 @@ protected:
{
T* pT = (T*)this;
ATLASSERT(::IsWindow(*pT));
m_TT.Create(*pT, NULL, NULL, m_uTTStyle);
m_TT.Create(*pT, nullptr, nullptr, m_uTTStyle);
CToolInfo ToolInfo(pT->m_uToolFlags, *pT, 0, 0, MAKEINTRESOURCE(pT->IDD));
m_TT.AddTool(&ToolInfo);
::EnumChildWindows(*pT, SetTool, (LPARAM)pT);
@ -203,7 +203,7 @@ class COptionsSheet : public CPropertySheetImpl < COptionsSheet >
{
public:
// Construction
COptionsSheet(_U_STRINGorID /*title*/ = (LPCTSTR)NULL, UINT /*uStartPage*/ = 0, HWND /*hWndParent*/ = NULL);
COptionsSheet(_U_STRINGorID /*title*/ = (LPCTSTR)nullptr, UINT /*uStartPage*/ = 0, HWND /*hWndParent*/ = nullptr);
~COptionsSheet();
void UpdateTextureSettings(void);
@ -819,7 +819,7 @@ COptionsSheet::COptionsSheet(_U_STRINGorID /*title*/, UINT /*uStartPage*/, HWND
m_pgBasicPage(new CConfigBasicPage(this)),
m_pgEmuSettings(new CConfigEmuSettings),
m_pgDebugSettings(new CDebugSettings),
m_pgTextureEnhancement(NULL),
m_pgTextureEnhancement(nullptr),
m_hTextureEnhancement(0)
{
AddPage(&m_pgBasicPage->m_psp);
@ -846,19 +846,19 @@ void COptionsSheet::UpdateTextureSettings(void)
{
if (g_settings->texenh_options())
{
if (m_hTextureEnhancement == NULL)
if (m_hTextureEnhancement == nullptr)
{
m_pgTextureEnhancement = new CConfigTextureEnhancement;
m_hTextureEnhancement = m_pgTextureEnhancement->Create();
AddPage(m_hTextureEnhancement);
}
}
else if (m_hTextureEnhancement != NULL)
else if (m_hTextureEnhancement != nullptr)
{
RemovePage(m_hTextureEnhancement);
m_hTextureEnhancement = NULL;
m_hTextureEnhancement = nullptr;
delete m_pgTextureEnhancement;
m_pgTextureEnhancement = NULL;
m_pgTextureEnhancement = nullptr;
}
}
#endif

View File

@ -95,7 +95,7 @@ extern "C" {
typedef struct
{
void * hWnd; /* Render window */
void * hStatusBar; /* if render window does not have a status bar then this is NULL */
void * hStatusBar; /* if render window does not have a status bar then this is nullptr */
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre
// bswap on a dword (32 bits) boundry

View File

@ -51,7 +51,7 @@ extern int g_viewport_offset;
extern int g_width, g_height;
#ifdef _WIN32
HINSTANCE hinstDLL = NULL;
HINSTANCE hinstDLL = nullptr;
#endif
uint32_t region = 0;
@ -60,7 +60,7 @@ unsigned int BMASK = 0x7FFFFF;
// Reality display processor structure
CRDP rdp;
CSettings * g_settings = NULL;
CSettings * g_settings = nullptr;
VOODOO voodoo = { 0, 0, 0,
0, 0, 0, 0,
@ -362,14 +362,14 @@ void SetWindowDisplaySize(HWND hWnd)
}
g_windowedMenu = GetMenu(hWnd);
if (g_windowedMenu) SetMenu(hWnd, NULL);
if (g_windowedMenu) SetMenu(hWnd, nullptr);
HWND hStatusBar = FindWindowEx(hWnd, NULL, L"msctls_statusbar32", NULL); // 1964
HWND hStatusBar = FindWindowEx(hWnd, nullptr, L"msctls_statusbar32", nullptr); // 1964
if (hStatusBar) ShowWindow(hStatusBar, SW_HIDE);
SetWindowLong(hWnd, GWL_STYLE, 0);
SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_TOPMOST);
SetWindowPos(hWnd, NULL, 0, 0, g_width, g_height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW);
SetWindowPos(hWnd, nullptr, 0, 0, g_width, g_height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW);
g_viewport_offset = 0;
g_fullscreen = true;
@ -377,21 +377,21 @@ void SetWindowDisplaySize(HWND hWnd)
else
{
RECT clientRect = { 0 }, toolbarRect = { 0 }, statusbarRect = { 0 }, windowedRect = { 0 };
HWND hToolBar = FindWindowEx(hWnd, NULL, REBARCLASSNAME, NULL);
HWND hStatusBar = FindWindowEx(hWnd, NULL, STATUSCLASSNAME, NULL);
if (hStatusBar == NULL)
HWND hToolBar = FindWindowEx(hWnd, nullptr, REBARCLASSNAME, nullptr);
HWND hStatusBar = FindWindowEx(hWnd, nullptr, STATUSCLASSNAME, nullptr);
if (hStatusBar == nullptr)
{
hStatusBar = FindWindowEx(hWnd, NULL, L"msctls_statusbar32", NULL);
hStatusBar = FindWindowEx(hWnd, nullptr, L"msctls_statusbar32", nullptr);
}
if (hStatusBar != nullptr && !IsWindowVisible(hStatusBar))
{
hStatusBar = nullptr;
}
if (hToolBar != NULL)
if (hToolBar != nullptr)
{
GetWindowRect(hToolBar, &toolbarRect);
}
if (hStatusBar != NULL)
if (hStatusBar != nullptr)
{
GetWindowRect(hStatusBar, &statusbarRect);
}
@ -400,7 +400,7 @@ void SetWindowDisplaySize(HWND hWnd)
GetClientRect(hWnd, &clientRect);
g_windowedRect.right += (g_width - (clientRect.right - clientRect.left));
g_windowedRect.bottom += (g_height + (toolbarRect.bottom - toolbarRect.top) + (statusbarRect.bottom - statusbarRect.top) - (clientRect.bottom - clientRect.top));
SetWindowPos(hWnd, NULL, 0, 0, g_windowedRect.right - g_windowedRect.left, g_windowedRect.bottom - g_windowedRect.top, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
SetWindowPos(hWnd, nullptr, 0, 0, g_windowedRect.right - g_windowedRect.left, g_windowedRect.bottom - g_windowedRect.top, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
g_fullscreen = false;
}
@ -410,8 +410,8 @@ void ExitFullScreen(void)
{
if (g_fullscreen)
{
ChangeDisplaySettings(NULL, 0);
SetWindowPos((HWND)gfx.hWnd, NULL, g_windowedRect.left, g_windowedRect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
ChangeDisplaySettings(nullptr, 0);
SetWindowPos((HWND)gfx.hWnd, nullptr, g_windowedRect.left, g_windowedRect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
SetWindowLong((HWND)gfx.hWnd, GWL_STYLE, g_windowedStyle);
SetWindowLong((HWND)gfx.hWnd, GWL_EXSTYLE, g_windowedExStyle);
if (g_windowedMenu) SetMenu((HWND)gfx.hWnd, g_windowedMenu);
@ -577,14 +577,14 @@ void ReleaseGfx()
}
#ifdef _WIN32
CriticalSection * g_ProcessDListCS = NULL;
CriticalSection * g_ProcessDListCS = nullptr;
extern "C" int WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID /*lpReserved*/)
{
if (fdwReason == DLL_PROCESS_ATTACH)
{
hinstDLL = hinst;
if (g_ProcessDListCS == NULL)
if (g_ProcessDListCS == nullptr)
{
g_ProcessDListCS = new CriticalSection();
}
@ -658,7 +658,7 @@ void CALL CloseDLL(void)
if (g_settings)
{
delete g_settings;
g_settings = NULL;
g_settings = nullptr;
}
ReleaseGfx();
@ -786,7 +786,7 @@ void CALL MoveScreen(int xpos, int ypos)
void CALL PluginLoaded(void)
{
SetupTrace();
if (g_settings == NULL)
if (g_settings == nullptr)
{
g_settings = new CSettings;
}
@ -1035,8 +1035,8 @@ void write_png_file(const char* file_name, int width, int height, uint8_t *buffe
}
/* initialize stuff */
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (png_ptr == NULL)
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
if (png_ptr == nullptr)
{
WriteTrace(TracePNG, TraceError, "png_create_write_struct failed");
fclose(fp);
@ -1044,10 +1044,10 @@ void write_png_file(const char* file_name, int width, int height, uint8_t *buffe
}
png_infop info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL)
if (info_ptr == nullptr)
{
WriteTrace(TracePNG, TraceError, "png_create_info_struct failed");
png_destroy_read_struct(&png_ptr, NULL, NULL);
png_destroy_read_struct(&png_ptr, nullptr, nullptr);
fclose(fp);
return;
}
@ -1055,7 +1055,7 @@ void write_png_file(const char* file_name, int width, int height, uint8_t *buffe
if (setjmp(png_jmpbuf(png_ptr)))
{
WriteTrace(TracePNG, TraceError, "Error during init_io");
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
fclose(fp);
return;
}
@ -1066,7 +1066,7 @@ void write_png_file(const char* file_name, int width, int height, uint8_t *buffe
if (setjmp(png_jmpbuf(png_ptr)))
{
WriteTrace(TracePNG, TraceError, "Error during writing header");
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
fclose(fp);
return;
}
@ -1081,7 +1081,7 @@ void write_png_file(const char* file_name, int width, int height, uint8_t *buffe
if (setjmp(png_jmpbuf(png_ptr)))
{
WriteTrace(TracePNG, TraceError, "Error during writing bytes");
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
fclose(fp);
return;
}
@ -1112,11 +1112,11 @@ void write_png_file(const char* file_name, int width, int height, uint8_t *buffe
if (setjmp(png_jmpbuf(png_ptr)))
{
WriteTrace(TracePNG, TraceError, "Error during end of write");
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
fclose(fp);
return;
}
png_write_end(png_ptr, NULL);
png_write_end(png_ptr, nullptr);
fclose(fp);
}

View File

@ -195,7 +195,7 @@ GLuint CompileShader(GLenum type, const std::string &source)
GLuint shader = glCreateShader(type);
const char *sourceArray[1] = { source.c_str() };
glShaderSource(shader, 1, sourceArray, NULL);
glShaderSource(shader, 1, sourceArray, nullptr);
glCompileShader(shader);
GLint compileResult;
@ -207,7 +207,7 @@ GLuint CompileShader(GLenum type, const std::string &source)
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);
std::vector<GLchar> infoLog(infoLogLength);
glGetShaderInfoLog(shader, (GLsizei)infoLog.size(), NULL, infoLog.data());
glGetShaderInfoLog(shader, (GLsizei)infoLog.size(), nullptr, infoLog.data());
WriteTrace(TraceGlitch, TraceError, "Shader compilation failed: %s", std::string(infoLog.begin(), infoLog.end()).c_str());
return 0;
@ -223,7 +223,7 @@ void check_link(GLuint program)
if (!success)
{
char log[1024];
glGetProgramInfoLog(program, 1024, NULL, log);
glGetProgramInfoLog(program, 1024, nullptr, log);
//LOGINFO(log);
}
}

View File

@ -80,11 +80,11 @@ PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT;
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT;
PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT;
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL;
PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL;
PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT = NULL;
PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT = NULL;
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = NULL;
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = nullptr;
PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = nullptr;
PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT = nullptr;
PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT = nullptr;
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = nullptr;
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
@ -148,9 +148,9 @@ int lfb_color_fmt;
float invtex[2];
#ifdef _WIN32
static HDC hDC = NULL;
static HGLRC hGLRC = NULL;
static HWND hToolBar = NULL;
static HDC hDC = nullptr;
static HGLRC hGLRC = nullptr;
static HWND hToolBar = nullptr;
#endif // _WIN32
static unsigned long fullscreen;
@ -239,7 +239,7 @@ void gfxColorMask(bool rgb, bool a)
int isExtensionSupported(const char *extension)
{
return 0;
const GLubyte *extensions = NULL;
const GLubyte *extensions = nullptr;
const GLubyte *start;
GLubyte *where, *terminator;
@ -270,7 +270,7 @@ int isExtensionSupported(const char *extension)
#ifdef _WIN32
int isWglExtensionSupported(const char *extension)
{
const GLubyte *extensions = NULL;
const GLubyte *extensions = nullptr;
const GLubyte *start;
GLubyte *where, *terminator;
@ -397,7 +397,7 @@ bool gfxSstWinOpen(gfxColorFormat_t color_format, gfxOriginLocation_t origin_loc
glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)wglGetProcAddress("glGenRenderbuffersEXT");
glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)wglGetProcAddress("glRenderbufferStorageEXT");
glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)wglGetProcAddress("glFramebufferRenderbufferEXT");
use_fbo = g_settings->wrpFBO() && (glFramebufferRenderbufferEXT != NULL);
use_fbo = g_settings->wrpFBO() && (glFramebufferRenderbufferEXT != nullptr);
#else
use_fbo = g_settings->wrpFBO();
#endif // _WIN32
@ -543,9 +543,9 @@ bool gfxSstWinClose()
#ifdef _WIN32
if (hGLRC)
{
wglMakeCurrent(hDC, NULL);
wglMakeCurrent(hDC, nullptr);
wglDeleteContext(hGLRC);
hGLRC = NULL;
hGLRC = nullptr;
}
ExitFullScreen();
#endif
@ -759,7 +759,7 @@ void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, gfxLOD_t lodmin
add_tex(fbs[nb_fb].texid);
glBindTexture(GL_TEXTURE_2D, fbs[nb_fb].texid);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, g_width, g_height, 0,
GL_RGB, GL_UNSIGNED_BYTE, NULL);
GL_RGB, GL_UNSIGNED_BYTE, nullptr);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@ -1002,7 +1002,7 @@ void updateTexture()
void gfxRenderBuffer(gfxBuffer_t buffer)
{
#ifdef _WIN32
static HANDLE region = NULL;
static HANDLE region = nullptr;
int realWidth = pBufferWidth, realHeight = pBufferHeight;
#endif // _WIN32
WriteTrace(TraceGlitch, TraceDebug, "buffer: %d", buffer);

View File

@ -15,7 +15,7 @@
#include <Project64-video/Renderer/Renderer.h>
int TMU_SIZE = 8 * 2048 * 2048;
static unsigned char* texture = NULL;
static unsigned char* texture = nullptr;
int packed_pixels_support = -1;
int ati_sucks = -1;
@ -40,7 +40,7 @@ typedef struct _texlist
} texlist;
static int nbTex = 0;
static texlist *list = NULL;
static texlist *list = nullptr;
#ifdef _WIN32
extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT;
@ -53,7 +53,7 @@ void remove_tex(unsigned int idmin, unsigned int idmax)
int n = 0;
texlist *aux = list;
int sz = nbTex;
if (aux == NULL) return;
if (aux == nullptr) return;
t = (unsigned int*)malloc(sz * sizeof(int));
while (aux && aux->id >= idmin && aux->id < idmax)
{
@ -65,7 +65,7 @@ void remove_tex(unsigned int idmin, unsigned int idmax)
list = aux;
nbTex--;
}
while (aux != NULL && aux->next != NULL)
while (aux != nullptr && aux->next != nullptr)
{
if (aux->next->id >= idmin && aux->next->id < idmax)
{
@ -89,7 +89,7 @@ void add_tex(unsigned int id)
texlist *aux = list;
texlist *aux2;
//printf("ADDTEX nbtex is now %d (%06x)\n", nbTex, id);
if (list == NULL || id < list->id)
if (list == nullptr || id < list->id)
{
nbTex++;
list = (texlist*)malloc(sizeof(texlist));
@ -97,9 +97,9 @@ void add_tex(unsigned int id)
list->id = id;
return;
}
while (aux->next != NULL && aux->next->id < id) aux = aux->next;
while (aux->next != nullptr && aux->next->id < id) aux = aux->next;
// ZIGGY added this test so that add_tex now accept re-adding an existing texture
if (aux->next != NULL && aux->next->id == id) return;
if (aux->next != nullptr && aux->next->id == id) return;
nbTex++;
aux2 = aux->next;
aux->next = (texlist*)malloc(sizeof(texlist));
@ -112,7 +112,7 @@ void init_textures()
tex0_width = tex0_height = tex1_width = tex1_height = 2;
// ZIGGY because remove_tex isn't called (Pj64 doesn't like it), it's better
// to leave these so that they'll be reused (otherwise we have a memory leak)
// list = NULL;
// list = nullptr;
// nbTex = 0;
if (!texture) texture = (unsigned char*)malloc(2048 * 2048 * 4);
@ -124,9 +124,9 @@ void free_textures()
// ZIGGY for some reasons, Pj64 doesn't like remove_tex on exit
remove_tex(0x00000000, 0xFFFFFFFF);
#endif
if (texture != NULL) {
if (texture != nullptr) {
free(texture);
texture = NULL;
texture = nullptr;
}
}

Some files were not shown because too many files have changed in this diff Show More