From cf58754414b4ff2ec6e45069cfeab996b9ae1948 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 12 Apr 2021 21:05:39 +0930 Subject: [PATCH] Change NULL to nullptr --- Source/Common/Common.vcxproj | 2 +- Source/Common/DateTimeClass.cpp | 4 +- Source/Common/FileClass.cpp | 32 +-- Source/Common/IniFileClass.cpp | 38 ++-- Source/Common/LogClass.cpp | 4 +- Source/Common/MemTest.cpp | 22 +- Source/Common/MemoryManagement.cpp | 8 +- Source/Common/Platform.cpp | 2 +- Source/Common/Random.cpp | 2 +- Source/Common/StdString.cpp | 14 +- Source/Common/StdString.h | 4 +- Source/Common/SyncEvent.cpp | 6 +- Source/Common/Thread.cpp | 14 +- Source/Common/Trace.cpp | 16 +- Source/Common/Util.cpp | 16 +- Source/Common/md5.cpp | 2 +- Source/Common/path.cpp | 106 +++++----- Source/Common/path.h | 10 +- Source/JoinSettings/main.cpp | 30 +-- Source/Project64-audio/AudioMain.cpp | 16 +- Source/Project64-audio/AudioSettings.cpp | 22 +- Source/Project64-audio/Driver/DirectSound.cpp | 42 ++-- Source/Project64-audio/Driver/OpenSLES.cpp | 76 +++---- Source/Project64-audio/Driver/SoundBase.cpp | 14 +- Source/Project64-audio/trace.cpp | 14 +- Source/Project64-core/3rdParty/7zip.cpp | 30 +-- Source/Project64-core/3rdParty/7zip.h | 2 +- Source/Project64-core/AppInit.cpp | 110 +++++----- Source/Project64-core/Logging.cpp | 8 +- .../Project64-core/MemoryExceptionFilter.cpp | 12 +- .../Multilanguage/LanguageClass.cpp | 6 +- .../N64System/EmulationThread.cpp | 8 +- .../N64System/Enhancement/Enhancement.cpp | 10 +- .../N64System/Enhancement/EnhancementFile.cpp | 10 +- .../N64System/Enhancement/Enhancements.cpp | 8 +- .../N64System/Interpreter/InterpreterCPU.cpp | 4 +- .../N64System/Interpreter/InterpreterOps.cpp | 2 +- .../Project64-core/N64System/Mips/Audio.cpp | 2 +- Source/Project64-core/N64System/Mips/Disk.cpp | 6 +- .../N64System/Mips/FlashRam.cpp | 2 +- .../Project64-core/N64System/Mips/GBCart.cpp | 44 ++-- .../N64System/Mips/MemoryVirtualMem.cpp | 80 +++---- .../Project64-core/N64System/Mips/PifRam.cpp | 4 +- .../N64System/Mips/RegisterClass.cpp | 18 +- .../N64System/Mips/Rumblepak.cpp | 2 +- Source/Project64-core/N64System/Mips/Sram.cpp | 2 +- .../N64System/Mips/Transferpak.cpp | 8 +- Source/Project64-core/N64System/N64Class.cpp | 106 +++++----- .../Project64-core/N64System/N64DiskClass.cpp | 20 +- .../Project64-core/N64System/N64RomClass.cpp | 30 +-- Source/Project64-core/N64System/N64RomClass.h | 2 +- .../N64System/Recompiler/Arm/ArmOps.cpp | 24 +-- .../N64System/Recompiler/Arm/ArmOps.h | 10 +- .../Recompiler/Arm/ArmRecompilerOps.cpp | 148 ++++++------- .../N64System/Recompiler/CodeBlock.cpp | 58 ++--- .../N64System/Recompiler/CodeSection.cpp | 114 +++++----- .../N64System/Recompiler/FunctionInfo.cpp | 2 +- .../N64System/Recompiler/FunctionMapClass.cpp | 18 +- .../N64System/Recompiler/LoopAnalysis.cpp | 32 +-- .../N64System/Recompiler/RecompilerClass.cpp | 96 ++++----- .../Recompiler/RecompilerCodeLog.cpp | 14 +- .../N64System/Recompiler/RecompilerMemory.cpp | 14 +- .../N64System/Recompiler/SectionInfo.cpp | 14 +- .../Recompiler/x86/x86RecompilerOps.cpp | 198 +++++++++--------- .../N64System/Recompiler/x86/x86ops.cpp | 8 +- .../N64System/SpeedLimiterClass.cpp | 2 +- .../N64System/SystemGlobals.cpp | 46 ++-- Source/Project64-core/Plugins/AudioPlugin.cpp | 56 ++--- .../Plugins/ControllerPlugin.cpp | 52 ++--- Source/Project64-core/Plugins/GFXPlugin.cpp | 118 +++++------ Source/Project64-core/Plugins/PluginBase.cpp | 62 +++--- Source/Project64-core/Plugins/PluginClass.cpp | 68 +++--- Source/Project64-core/Plugins/RSPPlugin.cpp | 54 ++--- Source/Project64-core/RomList/RomList.cpp | 26 +-- Source/Project64-core/Settings.cpp | 14 +- .../Settings/LoggingSettings.cpp | 102 ++++----- .../Settings/N64SystemSettings.cpp | 22 +- .../SettingType/SettingsType-Application.cpp | 16 +- .../SettingsType-ApplicationIndex.cpp | 2 +- .../SettingType/SettingsType-GameSetting.cpp | 12 +- .../SettingType/SettingsType-RDBCpuType.cpp | 2 +- .../SettingType/SettingsType-RDBOnOff.cpp | 2 +- .../SettingType/SettingsType-RDBRamSize.cpp | 2 +- .../SettingType/SettingsType-RDBSaveChip.cpp | 2 +- .../SettingType/SettingsType-RDBYesNo.cpp | 2 +- .../SettingType/SettingsType-RomDatabase.cpp | 36 ++-- .../SettingsType-RomDatabaseIndex.cpp | 2 +- .../SettingType/SettingsType-TempBool.h | 2 +- Source/Project64-input/CProject64Input.cpp | 8 +- Source/Project64-input/DeviceNotification.cpp | 2 +- Source/Project64-input/DirectInput.cpp | 10 +- Source/Project64-input/InputMain.cpp | 2 +- Source/Project64-input/wtl-BitmapPicture.cpp | 4 +- Source/Project64-input/wtl-ScanButton.cpp | 10 +- Source/Project64-video/Config.cpp | 22 +- Source/Project64-video/Gfx_1.3.h | 2 +- Source/Project64-video/Main.cpp | 54 ++--- .../Renderer/OGLEScombiner.cpp | 6 +- .../Renderer/OGLESglitchmain.cpp | 30 +-- .../Renderer/OGLEStextures.cpp | 20 +- .../Project64-video/Renderer/OGLcombiner.cpp | 14 +- .../Renderer/OGLglitchmain.cpp | 122 +++++------ .../Project64-video/Renderer/OGLtextures.cpp | 20 +- Source/Project64-video/ScreenResolution.cpp | 22 +- Source/Project64-video/Settings.cpp | 36 ++-- Source/Project64-video/TexCache.cpp | 2 +- .../TextureEnhancer/TxCache.cpp | 6 +- .../Project64-video/TextureEnhancer/TxDbg.cpp | 2 +- .../TextureEnhancer/TxFilter.cpp | 22 +- .../TextureEnhancer/TxFilterExport.cpp | 4 +- .../TextureEnhancer/TxHiResCache.cpp | 40 ++-- .../TextureEnhancer/TxImage.cpp | 62 +++--- .../TextureEnhancer/TxUtil.cpp | 6 +- Source/Project64-video/rdp.cpp | 40 ++-- Source/Project64-video/trace.cpp | 14 +- Source/Project64-video/ucode09.cpp | 12 +- Source/Project64/Plugins/PluginList.cpp | 14 +- Source/Project64/Settings/GuiSettings.cpp | 10 +- Source/Project64/UserInterface/About.cpp | 10 +- .../Project64/UserInterface/CheatClassUI.cpp | 40 ++-- .../UserInterface/Debugger/Assembler.cpp | 84 ++++---- .../UserInterface/Debugger/CPULog.cpp | 30 +-- .../UserInterface/Debugger/DMALog.cpp | 18 +- .../UserInterface/Debugger/DebugDialog.h | 21 +- .../UserInterface/Debugger/DebugMMU.cpp | 24 +-- .../UserInterface/Debugger/DebugMMU.h | 2 +- .../Debugger/Debugger-AddBreakpoint.cpp | 2 +- .../Debugger/Debugger-AddSymbol.cpp | 2 +- .../Debugger/Debugger-CPULogView.cpp | 32 +-- .../Debugger/Debugger-Commands.cpp | 48 ++--- .../Debugger/Debugger-DMALogView.cpp | 12 +- .../Debugger/Debugger-MemoryDump.cpp | 2 +- .../Debugger/Debugger-MemorySearch.cpp | 88 ++++---- .../Debugger/Debugger-RegisterTabs.cpp | 62 +++--- .../Debugger/Debugger-Scripts.cpp | 24 +-- .../Debugger/Debugger-StackView.cpp | 4 +- .../Debugger/Debugger-Symbols.cpp | 10 +- .../UserInterface/Debugger/Debugger-TLB.cpp | 2 +- .../Debugger/Debugger-ViewMemory.cpp | 30 +-- .../UserInterface/Debugger/Debugger.cpp | 126 +++++------ .../UserInterface/Debugger/MemoryScanner.cpp | 42 ++-- .../UserInterface/Debugger/ScriptInstance.cpp | 94 ++++----- .../UserInterface/Debugger/ScriptInstance.h | 4 +- .../UserInterface/Debugger/ScriptSystem.cpp | 8 +- .../UserInterface/Debugger/Symbols.cpp | 46 ++-- .../UserInterface/Debugger/Symbols.h | 34 +-- Source/Project64/UserInterface/DiscordRPC.cpp | 4 +- .../Project64/UserInterface/EnhancementUI.cpp | 22 +- Source/Project64/UserInterface/LoggingUI.cpp | 16 +- Source/Project64/UserInterface/MainMenu.cpp | 174 +++++++-------- Source/Project64/UserInterface/MainWindow.cpp | 54 ++--- Source/Project64/UserInterface/MenuClass.h | 4 +- .../Project64/UserInterface/MenuShortCuts.cpp | 4 +- .../Project64/UserInterface/Notification.cpp | 26 +-- .../UserInterface/ProjectSupport.cpp | 20 +- .../UserInterface/RomBrowserClass.cpp | 76 +++---- .../UserInterface/RomInformationClass.cpp | 16 +- .../Settings/SettingsPage-Directories.cpp | 10 +- .../Settings/SettingsPage-Game-Plugin.cpp | 24 +-- .../Settings/SettingsPage-Game-Status.cpp | 4 +- .../SettingsPage-KeyboardShortcuts.cpp | 20 +- .../Settings/SettingsPage-Plugin.cpp | 24 +-- .../UserInterface/Settings/SettingsPage.cpp | 2 +- .../UserInterface/Settings/SettingsPage.h | 22 +- .../UserInterface/SettingsConfig.cpp | 18 +- .../UserInterface/SupportEnterCode.cpp | 32 +-- .../Project64/UserInterface/SupportWindow.cpp | 28 +-- .../WTLControls/ClistCtrl/DataArray.h | 20 +- .../WTLControls/ClistCtrl/DragDrop.h | 124 +++++------ .../WTLControls/ClistCtrl/DropArrows.h | 4 +- .../WTLControls/ClistCtrl/ListCombo.h | 10 +- .../WTLControls/ClistCtrl/ListCtrl.h | 52 ++--- .../WTLControls/ClistCtrl/ListDate.h | 6 +- .../WTLControls/ClistCtrl/ListEdit.h | 6 +- .../WTLControls/ClistCtrl/ListTypes.h | 2 +- .../WTLControls/ClistCtrl/TitleTip.h | 14 +- .../WTLControls/EditNumber32.cpp | 6 +- .../UserInterface/WTLControls/HexEditCtrl.cpp | 54 ++--- .../WTLControls/ModifiedCheckBox.h | 12 +- .../WTLControls/ModifiedComboBox.h | 18 +- .../WTLControls/ModifiedEditBox.cpp | 18 +- .../WTLControls/ModifiedEditBox.h | 2 +- .../WTLControls/PartialGroupBox.cpp | 4 +- .../UserInterface/WTLControls/TooltipDialog.h | 2 +- .../WTLControls/wtl-BitmapPicture.cpp | 4 +- .../Project64/UserInterface/WelcomeScreen.cpp | 4 +- Source/Project64/WTLApp.h | 2 +- Source/Project64/main.cpp | 6 +- Source/Settings/Settings.cpp | 18 +- 189 files changed, 2506 insertions(+), 2505 deletions(-) diff --git a/Source/Common/Common.vcxproj b/Source/Common/Common.vcxproj index c084b78bc..210547abd 100644 --- a/Source/Common/Common.vcxproj +++ b/Source/Common/Common.vcxproj @@ -31,7 +31,7 @@ - + NotUsing diff --git a/Source/Common/DateTimeClass.cpp b/Source/Common/DateTimeClass.cpp index 327df4a06..e6015a2bb 100644 --- a/Source/Common/DateTimeClass.cpp +++ b/Source/Common/DateTimeClass.cpp @@ -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; } diff --git a/Source/Common/FileClass.cpp b/Source/Common/FileClass.cpp index b26400b2c..c38842cf4 100644 --- a/Source/Common/FileClass.cpp +++ b/Source/Common/FileClass.cpp @@ -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 diff --git a/Source/Common/IniFileClass.cpp b/Source/Common/IniFileClass.cpp index 16d644345..7f71b4765 100644 --- a/Source/Common/IniFileClass.cpp +++ b/Source/Common/IniFileClass.cpp @@ -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 &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 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 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 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 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 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; diff --git a/Source/Common/LogClass.cpp b/Source/Common/LogClass.cpp index cb1da38b5..06055225a 100644 --- a/Source/Common/LogClass.cpp +++ b/Source/Common/LogClass.cpp @@ -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); diff --git a/Source/Common/MemTest.cpp b/Source/Common/MemTest.cpp index cfe32f2c2..448d46133 100644 --- a/Source/Common/MemTest.cpp +++ b/Source/Common/MemTest.cpp @@ -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; } diff --git a/Source/Common/MemoryManagement.cpp b/Source/Common/MemoryManagement.cpp index f644c24d3..f160a71ed 100644 --- a/Source/Common/MemoryManagement.cpp +++ b/Source/Common/MemoryManagement.cpp @@ -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; diff --git a/Source/Common/Platform.cpp b/Source/Common/Platform.cpp index 4f02a2b4d..a2ef16c86 100644 --- a/Source/Common/Platform.cpp +++ b/Source/Common/Platform.cpp @@ -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; } diff --git a/Source/Common/Random.cpp b/Source/Common/Random.cpp index 9815479df..c2175ce42 100644 --- a/Source/Common/Random.cpp +++ b/Source/Common/Random.cpp @@ -6,7 +6,7 @@ CRandom::CRandom() { - m_state = (uint32_t)time(NULL); + m_state = (uint32_t)time(nullptr); } CRandom::CRandom(uint32_t state_value) diff --git a/Source/Common/StdString.cpp b/Source/Common/StdString.cpp index a3ab1d614..f885d207d 100644 --- a/Source/Common/StdString.cpp +++ b/Source/Common/StdString.cpp @@ -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)); diff --git a/Source/Common/StdString.h b/Source/Common/StdString.h index 7ef15da42..b37ebd43a 100644 --- a/Source/Common/StdString.h +++ b/Source/Common/StdString.h @@ -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); diff --git a/Source/Common/SyncEvent.cpp b/Source/Common/SyncEvent.cpp index 5a7deebe0..78a9bed5e 100644 --- a/Source/Common/SyncEvent.cpp +++ b/Source/Common/SyncEvent.cpp @@ -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 } diff --git a/Source/Common/Thread.cpp b/Source/Common/Thread.cpp index cc732e45e..c492c0058 100644 --- a/Source/Common/Thread.cpp +++ b/Source/Common/Thread.cpp @@ -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; diff --git a/Source/Common/Trace.cpp b/Source/Common/Trace.cpp index f87f5bc03..f434011fb 100644 --- a/Source/Common/Trace.cpp +++ b/Source/Common/Trace.cpp @@ -12,7 +12,7 @@ typedef std::map 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(<ime, &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()); diff --git a/Source/Common/Util.cpp b/Source/Common/Util.cpp index cb844fef1..5aeb7b7a8 100644 --- a/Source/Common/Util.cpp +++ b/Source/Common/Util.cpp @@ -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); } diff --git a/Source/Common/md5.cpp b/Source/Common/md5.cpp index a98896bff..9a9f368eb 100644 --- a/Source/Common/md5.cpp +++ b/Source/Common/md5.cpp @@ -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. diff --git a/Source/Common/path.cpp b/Source/Common/path.cpp index 81ca95df6..70042b9ce 100644 --- a/Source/Common/path.cpp +++ b/Source/Common/path.cpp @@ -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 != '*')) { diff --git a/Source/Common/path.h b/Source/Common/path.h index d10cb6c22..25b4cd09d 100644 --- a/Source/Common/path.h +++ b/Source/Common/path.h @@ -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 diff --git a/Source/JoinSettings/main.cpp b/Source/JoinSettings/main.cpp index 3d509d377..6fb491f81 100644 --- a/Source/JoinSettings/main.cpp +++ b/Source/JoinSettings/main.cpp @@ -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; } diff --git a/Source/Project64-audio/AudioMain.cpp b/Source/Project64-audio/AudioMain.cpp index c6bbf2434..33ff66318 100644 --- a/Source/Project64-audio/AudioMain.cpp +++ b/Source/Project64-audio/AudioMain.cpp @@ -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"); diff --git a/Source/Project64-audio/AudioSettings.cpp b/Source/Project64-audio/AudioSettings.cpp index ef7cc0b96..9e09786e6 100644 --- a/Source/Project64-audio/AudioSettings.cpp +++ b/Source/Project64-audio/AudioSettings.cpp @@ -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; } } diff --git a/Source/Project64-audio/Driver/DirectSound.cpp b/Source/Project64-audio/Driver/DirectSound.cpp index 2e5cede47..47356fd27 100644 --- a/Source/Project64-audio/Driver/DirectSound.cpp +++ b/Source/Project64-audio/Driver/DirectSound.cpp @@ -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; diff --git a/Source/Project64-audio/Driver/OpenSLES.cpp b/Source/Project64-audio/Driver/OpenSLES.cpp index 7501c185c..ed22a33f1 100644 --- a/Source/Project64-audio/Driver/OpenSLES.cpp +++ b/Source/Project64-audio/Driver/OpenSLES.cpp @@ -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 }; diff --git a/Source/Project64-audio/Driver/SoundBase.cpp b/Source/Project64-audio/Driver/SoundBase.cpp index 4c5901b6e..7a04f6aa6 100644 --- a/Source/Project64-audio/Driver/SoundBase.cpp +++ b/Source/Project64-audio/Driver/SoundBase.cpp @@ -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; diff --git a/Source/Project64-audio/trace.cpp b/Source/Project64-audio/trace.cpp index da7dd9f2e..ee2eb91b6 100644 --- a/Source/Project64-audio/trace.cpp +++ b/Source/Project64-audio/trace.cpp @@ -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; } } diff --git a/Source/Project64-core/3rdParty/7zip.cpp b/Source/Project64-core/3rdParty/7zip.cpp index b9b51f95e..c34e767d9 100644 --- a/Source/Project64-core/3rdParty/7zip.cpp +++ b/Source/Project64-core/3rdParty/7zip.cpp @@ -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 */ diff --git a/Source/Project64-core/3rdParty/7zip.h b/Source/Project64-core/3rdParty/7zip.h index 6f64673a1..41e1cfb5f 100644 --- a/Source/Project64-core/3rdParty/7zip.h +++ b/Source/Project64-core/3rdParty/7zip.h @@ -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; } diff --git a/Source/Project64-core/AppInit.cpp b/Source/Project64-core/AppInit.cpp index d16803bfa..9954b249f 100644 --- a/Source/Project64-core/AppInit.cpp +++ b/Source/Project64-core/AppInit.cpp @@ -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(); diff --git a/Source/Project64-core/Logging.cpp b/Source/Project64-core/Logging.cpp index 71dac4fd5..1ac95ce6e 100644 --- a/Source/Project64-core/Logging.cpp +++ b/Source/Project64-core/Logging.cpp @@ -9,7 +9,7 @@ #include #include -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; } } \ No newline at end of file diff --git a/Source/Project64-core/MemoryExceptionFilter.cpp b/Source/Project64-core/MemoryExceptionFilter.cpp index 73bf39245..5fb73035d 100644 --- a/Source/Project64-core/MemoryExceptionFilter.cpp +++ b/Source/Project64-core/MemoryExceptionFilter.cpp @@ -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()) { diff --git a/Source/Project64-core/Multilanguage/LanguageClass.cpp b/Source/Project64-core/Multilanguage/LanguageClass.cpp index bda8c49f2..80a020565 100644 --- a/Source/Project64-core/Multilanguage/LanguageClass.cpp +++ b/Source/Project64-core/Multilanguage/LanguageClass.cpp @@ -3,7 +3,7 @@ #include #include -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 ""; } diff --git a/Source/Project64-core/N64System/EmulationThread.cpp b/Source/Project64-core/N64System/EmulationThread.cpp index f816cd8be..e779b01ed 100644 --- a/Source/Project64-core/N64System/EmulationThread.cpp +++ b/Source/Project64-core/N64System/EmulationThread.cpp @@ -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; diff --git a/Source/Project64-core/N64System/Enhancement/Enhancement.cpp b/Source/Project64-core/N64System/Enhancement/Enhancement.cpp index 263658aff..a34b3cf1b 100644 --- a/Source/Project64-core/N64System/Enhancement/Enhancement.cpp +++ b/Source/Project64-core/N64System/Enhancement/Enhancement.cpp @@ -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; } diff --git a/Source/Project64-core/N64System/Enhancement/EnhancementFile.cpp b/Source/Project64-core/N64System/Enhancement/EnhancementFile.cpp index 3407b30c6..d812dd5cc 100644 --- a/Source/Project64-core/N64System/Enhancement/EnhancementFile.cpp +++ b/Source/Project64-core/N64System/Enhancement/EnhancementFile.cpp @@ -164,7 +164,7 @@ bool CEnhancmentFile::MoveToSection(const char * Section, bool ChangeCurrentSect } std::unique_ptr 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 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 & //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] == '/') { diff --git a/Source/Project64-core/N64System/Enhancement/Enhancements.cpp b/Source/Project64-core/N64System/Enhancement/Enhancements.cpp index 123c97110..f0c527464 100644 --- a/Source/Project64-core/N64System/Enhancement/Enhancements.cpp +++ b/Source/Project64-core/N64System/Enhancement/Enhancements.cpp @@ -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; diff --git a/Source/Project64-core/N64System/Interpreter/InterpreterCPU.cpp b/Source/Project64-core/N64System/Interpreter/InterpreterCPU.cpp index 3215d4cb2..62dd2ca61 100644 --- a/Source/Project64-core/N64System/Interpreter/InterpreterCPU.cpp +++ b/Source/Project64-core/N64System/Interpreter/InterpreterCPU.cpp @@ -11,7 +11,7 @@ #include #include -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(); } diff --git a/Source/Project64-core/N64System/Interpreter/InterpreterOps.cpp b/Source/Project64-core/N64System/Interpreter/InterpreterOps.cpp index 7e350867b..a0e00c1a9 100644 --- a/Source/Project64-core/N64System/Interpreter/InterpreterOps.cpp +++ b/Source/Project64-core/N64System/Interpreter/InterpreterOps.cpp @@ -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(); diff --git a/Source/Project64-core/N64System/Mips/Audio.cpp b/Source/Project64-core/N64System/Mips/Audio.cpp index 5954935a9..b7c8daa9b 100644 --- a/Source/Project64-core/N64System/Mips/Audio.cpp +++ b/Source/Project64-core/N64System/Mips/Audio.cpp @@ -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(); diff --git a/Source/Project64-core/N64System/Mips/Disk.cpp b/Source/Project64-core/N64System/Mips/Disk.cpp index f30a8b0e6..ad1d5fdf7 100644 --- a/Source/Project64-core/N64System/Mips/Disk.cpp +++ b/Source/Project64-core/N64System/Mips/Disk.cpp @@ -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) diff --git a/Source/Project64-core/N64System/Mips/FlashRam.cpp b/Source/Project64-core/N64System/Mips/FlashRam.cpp index f21e641b4..15c3398a9 100644 --- a/Source/Project64-core/N64System/Mips/FlashRam.cpp +++ b/Source/Project64-core/N64System/Mips/FlashRam.cpp @@ -5,7 +5,7 @@ #include CFlashram::CFlashram(bool ReadOnly) : -m_FlashRamPointer(NULL), +m_FlashRamPointer(nullptr), m_FlashFlag(FLASHRAM_MODE_NOPES), m_FlashStatus(0), m_FlashRAM_Offset(0), diff --git a/Source/Project64-core/N64System/Mips/GBCart.cpp b/Source/Project64-core/N64System/Mips/GBCart.cpp index 21cabc9eb..a47b0670f 100644 --- a/Source/Project64-core/N64System/Mips/GBCart.cpp +++ b/Source/Project64-core/N64System/Mips/GBCart.cpp @@ -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)); diff --git a/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp b/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp index 9c2da13da..5de4a6239 100755 --- a/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp +++ b/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp @@ -12,8 +12,8 @@ #include #include -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(); } diff --git a/Source/Project64-core/N64System/Mips/PifRam.cpp b/Source/Project64-core/N64System/Mips/PifRam.cpp index 70fc0a2d2..698dd40f9 100644 --- a/Source/Project64-core/N64System/Mips/PifRam.cpp +++ b/Source/Project64-core/N64System/Mips/PifRam.cpp @@ -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); } } diff --git a/Source/Project64-core/N64System/Mips/RegisterClass.cpp b/Source/Project64-core/N64System/Mips/RegisterClass.cpp index 1f847f86f..c14ca9f7f 100644 --- a/Source/Project64-core/N64System/Mips/RegisterClass.cpp +++ b/Source/Project64-core/N64System/Mips/RegisterClass.cpp @@ -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]), diff --git a/Source/Project64-core/N64System/Mips/Rumblepak.cpp b/Source/Project64-core/N64System/Mips/Rumblepak.cpp index bd5820ae0..ed612d6fb 100644 --- a/Source/Project64-core/N64System/Mips/Rumblepak.cpp +++ b/Source/Project64-core/N64System/Mips/Rumblepak.cpp @@ -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); } diff --git a/Source/Project64-core/N64System/Mips/Sram.cpp b/Source/Project64-core/N64System/Mips/Sram.cpp index 910b3e0be..5e0177566 100644 --- a/Source/Project64-core/N64System/Mips/Sram.cpp +++ b/Source/Project64-core/N64System/Mips/Sram.cpp @@ -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); diff --git a/Source/Project64-core/N64System/Mips/Transferpak.cpp b/Source/Project64-core/N64System/Mips/Transferpak.cpp index edc9d8676..f73c1342d 100644 --- a/Source/Project64-core/N64System/Mips/Transferpak.cpp +++ b/Source/Project64-core/N64System/Mips/Transferpak.cpp @@ -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(); } diff --git a/Source/Project64-core/N64System/N64Class.cpp b/Source/Project64-core/N64System/N64Class.cpp index 6a541008f..52e9d4d01 100644 --- a/Source/Project64-core/N64System/N64Class.cpp +++ b/Source/Project64-core/N64System/N64Class.cpp @@ -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(); } diff --git a/Source/Project64-core/N64System/N64DiskClass.cpp b/Source/Project64-core/N64System/N64DiskClass.cpp index dd8e4dc80..46c72b729 100644 --- a/Source/Project64-core/N64System/N64DiskClass.cpp +++ b/Source/Project64-core/N64System/N64DiskClass.cpp @@ -8,10 +8,10 @@ #include 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 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 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() diff --git a/Source/Project64-core/N64System/N64RomClass.cpp b/Source/Project64-core/N64System/N64RomClass.cpp index 240790263..4eb800231 100644 --- a/Source/Project64-core/N64System/N64RomClass.cpp +++ b/Source/Project64-core/N64System/N64RomClass.cpp @@ -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 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(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(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; } \ No newline at end of file diff --git a/Source/Project64-core/N64System/N64RomClass.h b/Source/Project64-core/N64System/N64RomClass.h index f866a6123..78df16621 100644 --- a/Source/Project64-core/N64System/N64RomClass.h +++ b/Source/Project64-core/N64System/N64RomClass.h @@ -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: diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.cpp b/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.cpp index ac18df629..ce26c8dc9 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.cpp @@ -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; diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.h b/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.h index 980672e38..47c8e90f3 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.h +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.h @@ -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); diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp index a769bee82..920478643 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp @@ -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"); diff --git a/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp b/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp index 879eae6ce..c5643c23b 100644 --- a/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp +++ b/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp @@ -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; } diff --git a/Source/Project64-core/N64System/Recompiler/CodeSection.cpp b/Source/Project64-core/N64System/Recompiler/CodeSection.cpp index 41c3341a8..90e7018f3 100644 --- a/Source/Project64-core/N64System/Recompiler/CodeSection.cpp +++ b/Source/Project64-core/N64System/Recompiler/CodeSection.cpp @@ -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 diff --git a/Source/Project64-core/N64System/Recompiler/FunctionInfo.cpp b/Source/Project64-core/N64System/Recompiler/FunctionInfo.cpp index f9d2a066b..87ef17ba7 100644 --- a/Source/Project64-core/N64System/Recompiler/FunctionInfo.cpp +++ b/Source/Project64-core/N64System/Recompiler/FunctionInfo.cpp @@ -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); diff --git a/Source/Project64-core/N64System/Recompiler/FunctionMapClass.cpp b/Source/Project64-core/N64System/Recompiler/FunctionMapClass.cpp index a3eb631d1..87788ce65 100644 --- a/Source/Project64-core/N64System/Recompiler/FunctionMapClass.cpp +++ b/Source/Project64-core/N64System/Recompiler/FunctionMapClass.cpp @@ -4,8 +4,8 @@ #include 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; } } diff --git a/Source/Project64-core/N64System/Recompiler/LoopAnalysis.cpp b/Source/Project64-core/N64System/Recompiler/LoopAnalysis.cpp index 17fe1bd4d..1914d0084 100644 --- a/Source/Project64-core/N64System/Recompiler/LoopAnalysis.cpp +++ b/Source/Project64-core/N64System/Recompiler/LoopAnalysis.cpp @@ -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__); diff --git a/Source/Project64-core/N64System/Recompiler/RecompilerClass.cpp b/Source/Project64-core/N64System/Recompiler/RecompilerClass.cpp index d98dbaf25..826225ca4 100644 --- a/Source/Project64-core/N64System/Recompiler/RecompilerClass.cpp +++ b/Source/Project64-core/N64System/Recompiler/RecompilerClass.cpp @@ -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); } diff --git a/Source/Project64-core/N64System/Recompiler/RecompilerCodeLog.cpp b/Source/Project64-core/N64System/Recompiler/RecompilerCodeLog.cpp index 91283a858..0677c3015 100644 --- a/Source/Project64-core/N64System/Recompiler/RecompilerCodeLog.cpp +++ b/Source/Project64-core/N64System/Recompiler/RecompilerCodeLog.cpp @@ -7,7 +7,7 @@ #include #include -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(); } diff --git a/Source/Project64-core/N64System/Recompiler/RecompilerMemory.cpp b/Source/Project64-core/N64System/Recompiler/RecompilerMemory.cpp index f0dd6a409..628988e85 100644 --- a/Source/Project64-core/N64System/Recompiler/RecompilerMemory.cpp +++ b/Source/Project64-core/N64System/Recompiler/RecompilerMemory.cpp @@ -5,10 +5,10 @@ #include 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); diff --git a/Source/Project64-core/N64System/Recompiler/SectionInfo.cpp b/Source/Project64-core/N64System/Recompiler/SectionInfo.cpp index 12c2da8d9..5b74acde4 100644 --- a/Source/Project64-core/N64System/Recompiler/SectionInfo.cpp +++ b/Source/Project64-core/N64System/Recompiler/SectionInfo.cpp @@ -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; } } diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp index fcf88576c..19236277b 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp @@ -20,7 +20,7 @@ #include #include -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"); diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp index 160873b85..b52d6edb6 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp @@ -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__); } diff --git a/Source/Project64-core/N64System/SpeedLimiterClass.cpp b/Source/Project64-core/N64System/SpeedLimiterClass.cpp index 6db39ceda..a5b90f64e 100644 --- a/Source/Project64-core/N64System/SpeedLimiterClass.cpp +++ b/Source/Project64-core/N64System/SpeedLimiterClass.cpp @@ -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; diff --git a/Source/Project64-core/N64System/SystemGlobals.cpp b/Source/Project64-core/N64System/SystemGlobals.cpp index bcd5a338e..1fed8895f 100644 --- a/Source/Project64-core/N64System/SystemGlobals.cpp +++ b/Source/Project64-core/N64System/SystemGlobals.cpp @@ -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; \ No newline at end of file diff --git a/Source/Project64-core/Plugins/AudioPlugin.cpp b/Source/Project64-core/Plugins/AudioPlugin.cpp index b8d88c6f4..3d55f6466 100644 --- a/Source/Project64-core/Plugins/AudioPlugin.cpp +++ b/Source/Project64-core/Plugins/AudioPlugin.cpp @@ -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) diff --git a/Source/Project64-core/Plugins/ControllerPlugin.cpp b/Source/Project64-core/Plugins/ControllerPlugin.cpp index c49bf8935..012f696e5 100644 --- a/Source/Project64-core/Plugins/ControllerPlugin.cpp +++ b/Source/Project64-core/Plugins/ControllerPlugin.cpp @@ -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; diff --git a/Source/Project64-core/Plugins/GFXPlugin.cpp b/Source/Project64-core/Plugins/GFXPlugin.cpp index e1d677101..f221f0914 100644 --- a/Source/Project64-core/Plugins/GFXPlugin.cpp +++ b/Source/Project64-core/Plugins/GFXPlugin.cpp @@ -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(); } diff --git a/Source/Project64-core/Plugins/PluginBase.cpp b/Source/Project64-core/Plugins/PluginBase.cpp index b7dec9ef4..9501dee23 100644 --- a/Source/Project64-core/Plugins/PluginBase.cpp +++ b/Source/Project64-core/Plugins/PluginBase.cpp @@ -3,16 +3,16 @@ #include 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()); } diff --git a/Source/Project64-core/Plugins/PluginClass.cpp b/Source/Project64-core/Plugins/PluginClass.cpp index cf31d292a..9480daf6f 100644 --- a/Source/Project64-core/Plugins/PluginClass.cpp +++ b/Source/Project64-core/Plugins/PluginClass.cpp @@ -5,14 +5,14 @@ #include 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 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; } diff --git a/Source/Project64-core/Plugins/RSPPlugin.cpp b/Source/Project64-core/Plugins/RSPPlugin.cpp index b3bc7cf37..3027791a4 100644 --- a/Source/Project64-core/Plugins/RSPPlugin.cpp +++ b/Source/Project64-core/Plugins/RSPPlugin.cpp @@ -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) diff --git a/Source/Project64-core/RomList/RomList.cpp b/Source/Project64-core/RomList/RomList.cpp index 88f864407..f4f885e3c 100644 --- a/Source/Project64-core/RomList/RomList.cpp +++ b/Source/Project64-core/RomList/RomList.cpp @@ -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; diff --git a/Source/Project64-core/Settings.cpp b/Source/Project64-core/Settings.cpp index 0c66ad9d5..f03da2e85 100644 --- a/Source/Project64-core/Settings.cpp +++ b/Source/Project64-core/Settings.cpp @@ -23,7 +23,7 @@ #include #include -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; diff --git a/Source/Project64-core/Settings/LoggingSettings.cpp b/Source/Project64-core/Settings/LoggingSettings.cpp index c6b7694c0..939fc72d2 100644 --- a/Source/Project64-core/Settings/LoggingSettings.cpp +++ b/Source/Project64-core/Settings/LoggingSettings.cpp @@ -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); } } diff --git a/Source/Project64-core/Settings/N64SystemSettings.cpp b/Source/Project64-core/Settings/N64SystemSettings.cpp index a91c7f85b..72ff1b31b 100644 --- a/Source/Project64-core/Settings/N64SystemSettings.cpp +++ b/Source/Project64-core/Settings/N64SystemSettings.cpp @@ -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); } } diff --git a/Source/Project64-core/Settings/SettingType/SettingsType-Application.cpp b/Source/Project64-core/Settings/SettingType/SettingsType-Application.cpp index f56714b5c..8bcf404dc 100644 --- a/Source/Project64-core/Settings/SettingType/SettingsType-Application.cpp +++ b/Source/Project64-core/Settings/SettingType/SettingsType-Application.cpp @@ -2,7 +2,7 @@ #include "SettingsType-Application.h" #include -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); } \ No newline at end of file diff --git a/Source/Project64-core/Settings/SettingType/SettingsType-ApplicationIndex.cpp b/Source/Project64-core/Settings/SettingType/SettingsType-ApplicationIndex.cpp index 258d15308..81945b805 100644 --- a/Source/Project64-core/Settings/SettingType/SettingsType-ApplicationIndex.cpp +++ b/Source/Project64-core/Settings/SettingType/SettingsType-ApplicationIndex.cpp @@ -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); } \ No newline at end of file diff --git a/Source/Project64-core/Settings/SettingType/SettingsType-GameSetting.cpp b/Source/Project64-core/Settings/SettingType/SettingsType-GameSetting.cpp index abeef0003..adad8ab98 100644 --- a/Source/Project64-core/Settings/SettingType/SettingsType-GameSetting.cpp +++ b/Source/Project64-core/Settings/SettingType/SettingsType-GameSetting.cpp @@ -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; } diff --git a/Source/Project64-core/Settings/SettingType/SettingsType-RDBCpuType.cpp b/Source/Project64-core/Settings/SettingType/SettingsType-RDBCpuType.cpp index 84e36ff0d..52a78859a 100644 --- a/Source/Project64-core/Settings/SettingType/SettingsType-RDBCpuType.cpp +++ b/Source/Project64-core/Settings/SettingType/SettingsType-RDBCpuType.cpp @@ -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); } diff --git a/Source/Project64-core/Settings/SettingType/SettingsType-RDBOnOff.cpp b/Source/Project64-core/Settings/SettingType/SettingsType-RDBOnOff.cpp index 29378ba93..859bbcb62 100644 --- a/Source/Project64-core/Settings/SettingType/SettingsType-RDBOnOff.cpp +++ b/Source/Project64-core/Settings/SettingType/SettingsType-RDBOnOff.cpp @@ -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); } diff --git a/Source/Project64-core/Settings/SettingType/SettingsType-RDBRamSize.cpp b/Source/Project64-core/Settings/SettingType/SettingsType-RDBRamSize.cpp index 17d06f057..3de1b15da 100644 --- a/Source/Project64-core/Settings/SettingType/SettingsType-RDBRamSize.cpp +++ b/Source/Project64-core/Settings/SettingType/SettingsType-RDBRamSize.cpp @@ -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); } diff --git a/Source/Project64-core/Settings/SettingType/SettingsType-RDBSaveChip.cpp b/Source/Project64-core/Settings/SettingType/SettingsType-RDBSaveChip.cpp index 5be18e4b1..8032008fe 100644 --- a/Source/Project64-core/Settings/SettingType/SettingsType-RDBSaveChip.cpp +++ b/Source/Project64-core/Settings/SettingType/SettingsType-RDBSaveChip.cpp @@ -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); } diff --git a/Source/Project64-core/Settings/SettingType/SettingsType-RDBYesNo.cpp b/Source/Project64-core/Settings/SettingType/SettingsType-RDBYesNo.cpp index 912eaea51..74d6ea8be 100644 --- a/Source/Project64-core/Settings/SettingType/SettingsType-RDBYesNo.cpp +++ b/Source/Project64-core/Settings/SettingType/SettingsType-RDBYesNo.cpp @@ -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); } \ No newline at end of file diff --git a/Source/Project64-core/Settings/SettingType/SettingsType-RomDatabase.cpp b/Source/Project64-core/Settings/SettingType/SettingsType-RomDatabase.cpp index ce691f66f..759267ae7 100644 --- a/Source/Project64-core/Settings/SettingType/SettingsType-RomDatabase.cpp +++ b/Source/Project64-core/Settings/SettingType/SettingsType-RomDatabase.cpp @@ -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); } } diff --git a/Source/Project64-core/Settings/SettingType/SettingsType-RomDatabaseIndex.cpp b/Source/Project64-core/Settings/SettingType/SettingsType-RomDatabaseIndex.cpp index 5b63f15c4..2d3ccec21 100644 --- a/Source/Project64-core/Settings/SettingType/SettingsType-RomDatabaseIndex.cpp +++ b/Source/Project64-core/Settings/SettingType/SettingsType-RomDatabaseIndex.cpp @@ -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); } diff --git a/Source/Project64-core/Settings/SettingType/SettingsType-TempBool.h b/Source/Project64-core/Settings/SettingType/SettingsType-TempBool.h index 361539cd6..3941da6e2 100644 --- a/Source/Project64-core/Settings/SettingType/SettingsType-TempBool.h +++ b/Source/Project64-core/Settings/SettingType/SettingsType-TempBool.h @@ -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; } diff --git a/Source/Project64-input/CProject64Input.cpp b/Source/Project64-input/CProject64Input.cpp index 37f7c5950..5569e0e1f 100644 --- a/Source/Project64-input/CProject64Input.cpp +++ b/Source/Project64-input/CProject64Input.cpp @@ -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); } diff --git a/Source/Project64-input/DeviceNotification.cpp b/Source/Project64-input/DeviceNotification.cpp index 6f67e74b4..1364668bb 100644 --- a/Source/Project64-input/DeviceNotification.cpp +++ b/Source/Project64-input/DeviceNotification.cpp @@ -4,7 +4,7 @@ DeviceNotification::DeviceNotification() { - Create(NULL); + Create(nullptr); } DeviceNotification::~DeviceNotification() diff --git a/Source/Project64-input/DirectInput.cpp b/Source/Project64-input/DirectInput.cpp index 327bf184b..d22a413e1 100644 --- a/Source/Project64-input/DirectInput.cpp +++ b/Source/Project64-input/DirectInput.cpp @@ -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; diff --git a/Source/Project64-input/InputMain.cpp b/Source/Project64-input/InputMain.cpp index f074501a5..aa08fea3b 100644 --- a/Source/Project64-input/InputMain.cpp +++ b/Source/Project64-input/InputMain.cpp @@ -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; } \ No newline at end of file diff --git a/Source/Project64-input/wtl-BitmapPicture.cpp b/Source/Project64-input/wtl-BitmapPicture.cpp index 8eca655c8..b4353f62e 100644 --- a/Source/Project64-input/wtl-BitmapPicture.cpp +++ b/Source/Project64-input/wtl-BitmapPicture.cpp @@ -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 diff --git a/Source/Project64-input/wtl-ScanButton.cpp b/Source/Project64-input/wtl-ScanButton.cpp index 3fe575309..a4403bd93 100644 --- a/Source/Project64-input/wtl-ScanButton.cpp +++ b/Source/Project64-input/wtl-ScanButton.cpp @@ -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; } diff --git a/Source/Project64-video/Config.cpp b/Source/Project64-video/Config.cpp index b9052a12b..412ec937a 100644 --- a/Source/Project64-video/Config.cpp +++ b/Source/Project64-video/Config.cpp @@ -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 diff --git a/Source/Project64-video/Gfx_1.3.h b/Source/Project64-video/Gfx_1.3.h index f5e4bb509..4ce4fad2e 100644 --- a/Source/Project64-video/Gfx_1.3.h +++ b/Source/Project64-video/Gfx_1.3.h @@ -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 diff --git a/Source/Project64-video/Main.cpp b/Source/Project64-video/Main.cpp index 739aec5ae..05c7c3390 100644 --- a/Source/Project64-video/Main.cpp +++ b/Source/Project64-video/Main.cpp @@ -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); } diff --git a/Source/Project64-video/Renderer/OGLEScombiner.cpp b/Source/Project64-video/Renderer/OGLEScombiner.cpp index 826501db9..7a0f52589 100644 --- a/Source/Project64-video/Renderer/OGLEScombiner.cpp +++ b/Source/Project64-video/Renderer/OGLEScombiner.cpp @@ -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 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); } } diff --git a/Source/Project64-video/Renderer/OGLESglitchmain.cpp b/Source/Project64-video/Renderer/OGLESglitchmain.cpp index 87efd7939..0f6e41fd9 100644 --- a/Source/Project64-video/Renderer/OGLESglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLESglitchmain.cpp @@ -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); diff --git a/Source/Project64-video/Renderer/OGLEStextures.cpp b/Source/Project64-video/Renderer/OGLEStextures.cpp index c6dfc8e2b..dec4bfd48 100644 --- a/Source/Project64-video/Renderer/OGLEStextures.cpp +++ b/Source/Project64-video/Renderer/OGLEStextures.cpp @@ -15,7 +15,7 @@ #include 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; } } diff --git a/Source/Project64-video/Renderer/OGLcombiner.cpp b/Source/Project64-video/Renderer/OGLcombiner.cpp index 08cf34afb..ea21c9e74 100644 --- a/Source/Project64-video/Renderer/OGLcombiner.cpp +++ b/Source/Project64-video/Renderer/OGLcombiner.cpp @@ -216,7 +216,7 @@ void init_combiner() strcpy(fragment_shader, fragment_shader_header); strcat(fragment_shader, s); strcat(fragment_shader, fragment_shader_end); - glShaderSourceARB(fragment_depth_shader_object, 1, (const GLcharARB**)&fragment_shader, NULL); + glShaderSourceARB(fragment_depth_shader_object, 1, (const GLcharARB**)&fragment_shader, nullptr); free(fragment_shader); glCompileShaderARB(fragment_depth_shader_object); @@ -230,13 +230,13 @@ void init_combiner() strcpy(fragment_shader, fragment_shader_header); strcat(fragment_shader, fragment_shader_default); strcat(fragment_shader, fragment_shader_end); - glShaderSourceARB(fragment_shader_object, 1, (const GLcharARB**)&fragment_shader, NULL); + glShaderSourceARB(fragment_shader_object, 1, (const GLcharARB**)&fragment_shader, nullptr); free(fragment_shader); glCompileShaderARB(fragment_shader_object); vertex_shader_object = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); - glShaderSourceARB(vertex_shader_object, 1, &vertex_shader, NULL); + glShaderSourceARB(vertex_shader_object, 1, &vertex_shader, nullptr); glCompileShaderARB(vertex_shader_object); // depth program @@ -363,7 +363,7 @@ typedef struct _shader_program_key GLhandleARB program_object; } shader_program_key; -static shader_program_key* shader_programs = NULL; +static shader_program_key* shader_programs = nullptr; static int number_of_programs = 0; static int color_combiner_key; static int alpha_combiner_key; @@ -431,7 +431,7 @@ void compile_shader() } } - if (shader_programs != NULL) + if (shader_programs != nullptr) shader_programs = (shader_program_key*)realloc(shader_programs, (number_of_programs + 1) * sizeof(shader_program_key)); else shader_programs = (shader_program_key*)malloc(sizeof(shader_program_key)); @@ -478,7 +478,7 @@ void compile_shader() if (chroma_enabled) strcat(fragment_shader, fragment_shader_chroma); shader_programs[number_of_programs].fragment_shader_object = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); - glShaderSourceARB(shader_programs[number_of_programs].fragment_shader_object, 1, (const GLcharARB**)&fragment_shader, NULL); + glShaderSourceARB(shader_programs[number_of_programs].fragment_shader_object, 1, (const GLcharARB**)&fragment_shader, nullptr); free(fragment_shader); glCompileShaderARB(shader_programs[number_of_programs].fragment_shader_object); @@ -537,7 +537,7 @@ void compile_shader() void free_combiners() { free(shader_programs); - shader_programs = NULL; + shader_programs = nullptr; number_of_programs = 0; } diff --git a/Source/Project64-video/Renderer/OGLglitchmain.cpp b/Source/Project64-video/Renderer/OGLglitchmain.cpp index dc04c2671..7e6dda588 100644 --- a/Source/Project64-video/Renderer/OGLglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLglitchmain.cpp @@ -106,17 +106,17 @@ PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB; const char * APIENTRY dummy_wglGetExtensionsString(HDC) { g_Notify->DisplayError("wglGetExtensionsString"); - return NULL; + return nullptr; } 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; void APIENTRY dummy_glGenRenderbuffers(GLsizei/*n*/, GLuint* /*renderbuffers*/) @@ -184,7 +184,7 @@ void APIENTRY dummy_glSecondaryColor3f(GLfloat/*red*/, GLfloat/*green*/, GLfloat GLuint APIENTRY dummy_glCreateShader(GLenum/*type*/) { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ g_Notify->DisplayError("glCreateShader"); - return ((GLuint)(NULL)); + return ((GLuint)(nullptr)); } void APIENTRY dummy_glShaderSource(GLuint, GLsizei, const GLchar **, GLint *) { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ @@ -197,7 +197,7 @@ void APIENTRY dummy_glCompileShader(GLuint/*shader*/) GLuint APIENTRY dummy_glCreateProgram(void) { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ g_Notify->DisplayError("glCreateProgram"); - return ((GLuint)(NULL)); + return ((GLuint)(nullptr)); } void APIENTRY dummy_glAttachObject(GLhandleARB, GLhandleARB) { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ @@ -292,9 +292,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 int savedWidtho, savedHeighto; @@ -371,7 +371,7 @@ void gfxColorMask(bool rgb, bool a) int isExtensionSupported(const char *extension) { - const GLubyte *extensions = NULL; + const GLubyte *extensions = nullptr; const GLubyte *start; GLubyte *where, *terminator; @@ -402,7 +402,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; @@ -471,11 +471,11 @@ bool gfxSstWinOpen(gfxColorFormat_t color_format, gfxOriginLocation_t origin_loc screen_width = g_width; screen_height = g_height; - if ((HWND)gfx.hWnd != NULL) + if ((HWND)gfx.hWnd != nullptr) { hDC = GetDC((HWND)gfx.hWnd); } - if (hDC == NULL) + if (hDC == nullptr) { WriteTrace(TraceGlitch, TraceWarning, "GetDC on main window failed"); return false; @@ -506,7 +506,7 @@ bool gfxSstWinOpen(gfxColorFormat_t color_format, gfxOriginLocation_t origin_loc HGLRC CurrenthGLRC = wglGetCurrentContext(); - if (CurrenthGLRC == NULL || CurrenthGLRC == hGLRC) + if (CurrenthGLRC == nullptr || CurrenthGLRC == hGLRC) { if (!wglMakeCurrent(hDC, hGLRC)) { @@ -535,9 +535,9 @@ bool gfxSstWinOpen(gfxColorFormat_t color_format, gfxOriginLocation_t origin_loc glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress("glActiveTextureARB"); glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)wglGetProcAddress("glMultiTexCoord2fARB"); - if (glActiveTextureARB == NULL) + if (glActiveTextureARB == nullptr) glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)dummy_glActiveTexture; - if (glMultiTexCoord2fARB == NULL) + if (glMultiTexCoord2fARB == nullptr) glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)dummy_glMultiTexCoord2f; #endif // _WIN32 @@ -571,7 +571,7 @@ bool gfxSstWinOpen(gfxColorFormat_t color_format, gfxOriginLocation_t origin_loc #ifdef _WIN32 glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC)wglGetProcAddress("glBlendFuncSeparateEXT"); - if (glBlendFuncSeparateEXT == NULL) + if (glBlendFuncSeparateEXT == nullptr) glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC)dummy_glBlendFuncSeparate; #endif // _WIN32 @@ -582,13 +582,13 @@ bool gfxSstWinOpen(gfxColorFormat_t color_format, gfxOriginLocation_t origin_loc #ifdef _WIN32 glFogCoordfEXT = (PFNGLFOGCOORDFPROC)wglGetProcAddress("glFogCoordfEXT"); - if (glFogCoordfEXT == NULL) + if (glFogCoordfEXT == nullptr) glFogCoordfEXT = (PFNGLFOGCOORDFPROC)dummy_glFogCoordf; #endif // _WIN32 #ifdef _WIN32 wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB"); - if (wglGetExtensionsStringARB == NULL) + if (wglGetExtensionsStringARB == nullptr) wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)dummy_wglGetExtensionsString; #endif // _WIN32 @@ -599,15 +599,15 @@ bool gfxSstWinOpen(gfxColorFormat_t color_format, gfxOriginLocation_t origin_loc glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)wglGetProcAddress("glCheckFramebufferStatusEXT"); glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)wglGetProcAddress("glDeleteFramebuffersEXT"); - if (glBindFramebufferEXT == NULL) + if (glBindFramebufferEXT == nullptr) glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)dummy_glBindFramebuffer; - if (glFramebufferTexture2DEXT == NULL) + if (glFramebufferTexture2DEXT == nullptr) glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)dummy_glFramebufferTexture2D; - if (glGenFramebuffersEXT == NULL) + if (glGenFramebuffersEXT == nullptr) glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)dummy_glGenFramebuffers; - if (glCheckFramebufferStatusEXT == NULL) + if (glCheckFramebufferStatusEXT == nullptr) glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)dummy_glCheckFramebufferStatus; - if (glDeleteFramebuffersEXT == NULL) + if (glDeleteFramebuffersEXT == nullptr) glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)dummy_glDeleteFramebuffers; glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC)wglGetProcAddress("glBindRenderbufferEXT"); @@ -616,15 +616,15 @@ bool gfxSstWinOpen(gfxColorFormat_t color_format, gfxOriginLocation_t origin_loc glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)wglGetProcAddress("glRenderbufferStorageEXT"); glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)wglGetProcAddress("glFramebufferRenderbufferEXT"); - if (glBindRenderbufferEXT == NULL) + if (glBindRenderbufferEXT == nullptr) glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC)dummy_glBindRenderbuffer; - if (glDeleteRenderbuffersEXT == NULL) + if (glDeleteRenderbuffersEXT == nullptr) glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC)dummy_glDeleteRenderbuffers; - if (glGenRenderbuffersEXT == NULL) + if (glGenRenderbuffersEXT == nullptr) glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)dummy_glGenRenderbuffers; - if (glRenderbufferStorageEXT == NULL) + if (glRenderbufferStorageEXT == nullptr) glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)dummy_glRenderbufferStorage; - if (glFramebufferRenderbufferEXT == NULL) + if (glFramebufferRenderbufferEXT == nullptr) glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)dummy_glFramebufferRenderbuffer; #endif // _WIN32 @@ -666,40 +666,40 @@ bool gfxSstWinOpen(gfxColorFormat_t color_format, gfxOriginLocation_t origin_loc #ifdef _WIN32 glCompressedTexImage2DARB = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)wglGetProcAddress("glCompressedTexImage2DARB"); - if (glCreateShaderObjectARB == NULL) + if (glCreateShaderObjectARB == nullptr) glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)dummy_glCreateShader; - if (glShaderSourceARB == NULL) + if (glShaderSourceARB == nullptr) glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)dummy_glShaderSource; - if (glCompileShaderARB == NULL) + if (glCompileShaderARB == nullptr) glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)dummy_glCompileShader; - if (glCreateProgramObjectARB == NULL) + if (glCreateProgramObjectARB == nullptr) glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)dummy_glCreateProgram; - if (glAttachObjectARB == NULL) + if (glAttachObjectARB == nullptr) glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)dummy_glAttachObject; - if (glLinkProgramARB == NULL) + if (glLinkProgramARB == nullptr) glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)dummy_glLinkProgram; - if (glUseProgramObjectARB == NULL) + if (glUseProgramObjectARB == nullptr) glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)dummy_glUseProgram; - if (glGetUniformLocationARB == NULL) + if (glGetUniformLocationARB == nullptr) glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)dummy_glGetUniformLocation; - if (glUniform1iARB == NULL) + if (glUniform1iARB == nullptr) glUniform1iARB = (PFNGLUNIFORM1IARBPROC)dummy_glUniform1i; - if (glUniform4iARB == NULL) + if (glUniform4iARB == nullptr) glUniform4iARB = (PFNGLUNIFORM4IARBPROC)dummy_glUniform4i; - if (glUniform4fARB == NULL) + if (glUniform4fARB == nullptr) glUniform4fARB = (PFNGLUNIFORM4FARBPROC)dummy_glUniform4f; - if (glUniform1fARB == NULL) + if (glUniform1fARB == nullptr) glUniform1fARB = (PFNGLUNIFORM1FARBPROC)dummy_glUniform1f; - if (glDeleteObjectARB == NULL) + if (glDeleteObjectARB == nullptr) glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)dummy_glDeleteObject; - if (glGetInfoLogARB == NULL) + if (glGetInfoLogARB == nullptr) glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)dummy_glGetInfoLog; - if (glGetObjectParameterivARB == NULL) + if (glGetObjectParameterivARB == nullptr) glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)dummy_glGetObjectParameteriv; - if (glSecondaryColor3f == NULL) + if (glSecondaryColor3f == nullptr) glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)dummy_glSecondaryColor3f; - if (glCompressedTexImage2DARB == NULL) + if (glCompressedTexImage2DARB == nullptr) glCompressedTexImage2DARB = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)dummy_glCompressedTexImage2D; #endif @@ -769,7 +769,7 @@ bool gfxSstWinOpen(gfxColorFormat_t color_format, gfxOriginLocation_t origin_loc // Hmm, perhaps the internal format need to be specified explicitly... { GLint ifmt; - glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL); + glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, nullptr); glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &ifmt); if (ifmt != GL_RGB5_A1) { WriteTrace(TraceGlitch, TraceWarning, "ATI SUCKS %x\n", ifmt); @@ -832,15 +832,15 @@ bool gfxSstWinClose() #ifdef _WIN32 if (hGLRC) { - wglMakeCurrent(hDC, NULL); + wglMakeCurrent(hDC, nullptr); wglDeleteContext(hGLRC); - hGLRC = NULL; + hGLRC = nullptr; } ExitFullScreen(); #else //SDL_QuitSubSystem(SDL_INIT_VIDEO); //sleep(2); - //m_pScreen = NULL; + //m_pScreen = nullptr; #endif return true; } @@ -1055,7 +1055,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); @@ -1274,7 +1274,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); @@ -1744,12 +1744,12 @@ bool gfxLfbWriteRegion(gfxBuffer_t dst_buffer, uint32_t dst_x, uint32_t dst_y, g #ifdef _WIN32 static void CorrectGamma(LPVOID apGammaRamp) { - HDC hdc = GetDC(NULL); - if (hdc != NULL) + HDC hdc = GetDC(nullptr); + if (hdc != nullptr) { if (to_fullscreen) SetDeviceGammaRamp(hdc, apGammaRamp); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); } } #else @@ -1782,12 +1782,12 @@ void gfxGetGammaTableExt(uint32_t /*nentries*/, uint32_t *red, uint32_t *green, WriteTrace(TraceGlitch, TraceDebug, "-"); uint16_t aGammaRamp[3][256]; #ifdef _WIN32 - HDC hdc = GetDC(NULL); - if (hdc == NULL) + HDC hdc = GetDC(nullptr); + if (hdc == nullptr) return; if (GetDeviceGammaRamp(hdc, aGammaRamp) == TRUE) { - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); #else fputs("ERROR: Replacement for SDL_GetGammaRamp unimplemented.\n", stderr); /* if (SDL_GetGammaRamp(aGammaRamp[0], aGammaRamp[1], aGammaRamp[2]) != -1) */ @@ -1864,7 +1864,7 @@ int grDisplayGLError(const char* message) #endif #ifdef _WIN32 - MessageBoxA(NULL, message, GL_errors[error_index], MB_ICONERROR); + MessageBoxA(nullptr, message, GL_errors[error_index], MB_ICONERROR); #else fprintf(stderr, "%s\n%s\n\n", GL_errors[error_index], message); #endif diff --git a/Source/Project64-video/Renderer/OGLtextures.cpp b/Source/Project64-video/Renderer/OGLtextures.cpp index ff0e21da0..d51aaebf1 100644 --- a/Source/Project64-video/Renderer/OGLtextures.cpp +++ b/Source/Project64-video/Renderer/OGLtextures.cpp @@ -16,7 +16,7 @@ #include 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; @@ -41,7 +41,7 @@ typedef struct _texlist } texlist; static int nbTex = 0; -static texlist *list = NULL; +static texlist *list = nullptr; #if !defined(__ANDROID__) && !defined(ANDROID) extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT; @@ -54,7 +54,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) { @@ -66,7 +66,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) { @@ -90,7 +90,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)); @@ -98,9 +98,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)); @@ -113,7 +113,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); @@ -125,9 +125,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; } } diff --git a/Source/Project64-video/ScreenResolution.cpp b/Source/Project64-video/ScreenResolution.cpp index a64235985..01c0a33fc 100644 --- a/Source/Project64-video/ScreenResolution.cpp +++ b/Source/Project64-video/ScreenResolution.cpp @@ -11,7 +11,7 @@ struct ResolutionInfo { - ResolutionInfo(const char * name = NULL, uint32_t width = 0, uint32_t height = 0, uint32_t frequency = 0, bool default_res = false) : + ResolutionInfo(const char * name = nullptr, uint32_t width = 0, uint32_t height = 0, uint32_t frequency = 0, bool default_res = false) : m_name(name ? name : ""), m_width(width), m_height(height), @@ -219,17 +219,17 @@ FullScreenResolutions::~FullScreenResolutions() for (unsigned int i = 0; i < m_dwNumResolutions; i++) { delete[] m_aResolutionsStr[i]; - m_aResolutionsStr[i] = NULL; + m_aResolutionsStr[i] = nullptr; } if (m_aResolutionsStr) { delete[] m_aResolutionsStr; - m_aResolutionsStr = NULL; + m_aResolutionsStr = nullptr; } if (m_aResolutions) { delete[] m_aResolutions; - m_aResolutions = NULL; + m_aResolutions = nullptr; } } @@ -241,10 +241,10 @@ void FullScreenResolutions::init() int iModeNum = 0; memset(&enumMode, 0, sizeof(DEVMODE)); - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, ¤tMode); + EnumDisplaySettings(nullptr, ENUM_CURRENT_SETTINGS, ¤tMode); ResolutionInfo prevInfo; - while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0) + while (EnumDisplaySettings(nullptr, iModeNum++, &enumMode) != 0) { ResolutionInfo curInfo("", enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency); if (enumMode.dmBitsPerPel == 32 && curInfo != prevInfo) @@ -261,9 +261,9 @@ void FullScreenResolutions::init() char smode[256]; memset(&enumMode, 0, sizeof(DEVMODE)); prevInfo = ResolutionInfo(); - while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0) + while (EnumDisplaySettings(nullptr, iModeNum++, &enumMode) != 0) { - ResolutionInfo curInfo(NULL, enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency); + ResolutionInfo curInfo(nullptr, enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency); if (enumMode.dmBitsPerPel == 32 && curInfo != prevInfo) { if (enumMode.dmPelsHeight == currentMode.dmPelsHeight && enumMode.dmPelsWidth == currentMode.dmPelsWidth) @@ -286,13 +286,13 @@ bool FullScreenResolutions::changeDisplaySettings(uint32_t _resolution) #ifdef _WIN32 uint32_t width, height, frequency; getResolution(_resolution, &width, &height, &frequency); - ResolutionInfo info(NULL, width, height, frequency); + ResolutionInfo info(nullptr, width, height, frequency); DEVMODE enumMode; int iModeNum = 0; memset(&enumMode, 0, sizeof(DEVMODE)); - while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0) + while (EnumDisplaySettings(nullptr, iModeNum++, &enumMode) != 0) { - ResolutionInfo curInfo(NULL, enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency); + ResolutionInfo curInfo(nullptr, enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency); if (enumMode.dmBitsPerPel == 32 && curInfo == info) { bool bRes = ChangeDisplaySettings(&enumMode, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL; WriteTrace(TraceGlitch, TraceDebug, "width=%d, height=%d, freq=%d %s\r\n", enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency, bRes ? "Success" : "Failed"); diff --git a/Source/Project64-video/Settings.cpp b/Source/Project64-video/Settings.cpp index 3d62be9ae..26fc376bd 100644 --- a/Source/Project64-video/Settings.cpp +++ b/Source/Project64-video/Settings.cpp @@ -172,20 +172,20 @@ void CSettings::RegisterSettings(void) general_setting(Set_fb_get_info_default, "fb_get_info", false); general_setting(Set_fb_render_default, "fb_render", false); - 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_Settings, Data_DWORD_General, "Settings", "Logging", g_ModuleLogLevel[TraceSettings], NULL); - RegisterSetting(Set_Logging_Unknown, Data_DWORD_General, "Unknown", "Logging", g_ModuleLogLevel[TraceUnknown], NULL); - RegisterSetting(Set_Logging_Glide64, Data_DWORD_General, "Glide64", "Logging", g_ModuleLogLevel[TraceGlide64], NULL); - RegisterSetting(Set_Logging_Interface, Data_DWORD_General, "Interface", "Logging", g_ModuleLogLevel[TraceInterface], NULL); - RegisterSetting(Set_Logging_Resolution, Data_DWORD_General, "Resolution", "Logging", g_ModuleLogLevel[TraceResolution], NULL); - RegisterSetting(Set_Logging_Glitch, Data_DWORD_General, "Glitch", "Logging", g_ModuleLogLevel[TraceGlitch], NULL); - RegisterSetting(Set_Logging_VideoRDP, Data_DWORD_General, "VideoRDP", "Logging", g_ModuleLogLevel[TraceRDP], NULL); - RegisterSetting(Set_Logging_TLUT, Data_DWORD_General, "TLUT", "Logging", g_ModuleLogLevel[TraceTLUT], NULL); - RegisterSetting(Set_Logging_PNG, Data_DWORD_General, "PNG", "Logging", g_ModuleLogLevel[TracePNG], NULL); - RegisterSetting(Set_Logging_OGLWrapper, Data_DWORD_General, "OGLWrapper", "Logging", g_ModuleLogLevel[TraceOGLWrapper], NULL); - RegisterSetting(Set_Logging_RDPCommands, Data_DWORD_General, "RDPCommands", "Logging", g_ModuleLogLevel[TraceRDPCommands], NULL); + 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_Settings, Data_DWORD_General, "Settings", "Logging", g_ModuleLogLevel[TraceSettings], nullptr); + RegisterSetting(Set_Logging_Unknown, Data_DWORD_General, "Unknown", "Logging", g_ModuleLogLevel[TraceUnknown], nullptr); + RegisterSetting(Set_Logging_Glide64, Data_DWORD_General, "Glide64", "Logging", g_ModuleLogLevel[TraceGlide64], nullptr); + RegisterSetting(Set_Logging_Interface, Data_DWORD_General, "Interface", "Logging", g_ModuleLogLevel[TraceInterface], nullptr); + RegisterSetting(Set_Logging_Resolution, Data_DWORD_General, "Resolution", "Logging", g_ModuleLogLevel[TraceResolution], nullptr); + RegisterSetting(Set_Logging_Glitch, Data_DWORD_General, "Glitch", "Logging", g_ModuleLogLevel[TraceGlitch], nullptr); + RegisterSetting(Set_Logging_VideoRDP, Data_DWORD_General, "VideoRDP", "Logging", g_ModuleLogLevel[TraceRDP], nullptr); + RegisterSetting(Set_Logging_TLUT, Data_DWORD_General, "TLUT", "Logging", g_ModuleLogLevel[TraceTLUT], nullptr); + RegisterSetting(Set_Logging_PNG, Data_DWORD_General, "PNG", "Logging", g_ModuleLogLevel[TracePNG], nullptr); + RegisterSetting(Set_Logging_OGLWrapper, Data_DWORD_General, "OGLWrapper", "Logging", g_ModuleLogLevel[TraceOGLWrapper], nullptr); + RegisterSetting(Set_Logging_RDPCommands, Data_DWORD_General, "RDPCommands", "Logging", g_ModuleLogLevel[TraceRDPCommands], nullptr); #ifndef ANDROID general_setting(Set_FullScreenRes, "FullScreenRes", GetCurrentResIndex()); @@ -521,7 +521,7 @@ void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove) CSettings::ucode_t CSettings::DetectUCode(uint32_t uc_crc) { - RegisterSetting(Set_ucodeLookup, Data_DWORD_RDB_Setting, stdstr_f("%08lx", uc_crc).c_str(), "ucode", (unsigned int)-2, NULL); + RegisterSetting(Set_ucodeLookup, Data_DWORD_RDB_Setting, stdstr_f("%08lx", uc_crc).c_str(), "ucode", (unsigned int)-2, nullptr); CSettings::ucode_t uc = (CSettings::ucode_t)GetSetting(Set_ucodeLookup); if (uc == CSettings::uCode_NotFound || uc == CSettings::uCode_Unsupported) { @@ -894,17 +894,17 @@ void CSettings::WriteSettings(void) void CSettings::general_setting(short setting_ID, const char * name, unsigned int value) { - RegisterSetting(setting_ID, Data_DWORD_General, name, NULL, value, NULL); + RegisterSetting(setting_ID, Data_DWORD_General, name, nullptr, value, nullptr); } void CSettings::game_setting(short setting_ID, const char * name, unsigned int value) { - RegisterSetting(setting_ID, Data_DWORD_Game, name, NULL, value, NULL); + RegisterSetting(setting_ID, Data_DWORD_Game, name, nullptr, value, nullptr); } void CSettings::game_setting_default(short setting_ID, const char * name, short default_setting) { - RegisterSetting2(setting_ID, Data_DWORD_Game, name, NULL, default_setting); + RegisterSetting2(setting_ID, Data_DWORD_Game, name, nullptr, default_setting); } void CSettings::SettingsChanged(void) diff --git a/Source/Project64-video/TexCache.cpp b/Source/Project64-video/TexCache.cpp index c487cdfa4..2dd3e0ee3 100644 --- a/Source/Project64-video/TexCache.cpp +++ b/Source/Project64-video/TexCache.cpp @@ -94,7 +94,7 @@ void TexCacheInit() { for (int i = 0; i < 65536; i++) { - cachelut[i] = NULL; + cachelut[i] = nullptr; } } diff --git a/Source/Project64-video/TextureEnhancer/TxCache.cpp b/Source/Project64-video/TextureEnhancer/TxCache.cpp index 1c247f74d..8300f3cc9 100644 --- a/Source/Project64-video/TextureEnhancer/TxCache.cpp +++ b/Source/Project64-video/TextureEnhancer/TxCache.cpp @@ -60,8 +60,8 @@ TxCache::TxCache(int options, int cachesize, const char *path, const char *ident if (!_gzdest0 || !_gzdest1 || !_gzdestLen) { _options &= ~(GZ_TEXCACHE | GZ_HIRESTEXCACHE); - _gzdest0 = NULL; - _gzdest1 = NULL; + _gzdest0 = nullptr; + _gzdest1 = nullptr; _gzdestLen = 0; } } @@ -267,7 +267,7 @@ bool TxCache::save(const char *path, const char *filename, int config) destLen = _gzdestLen; if (dest && destLen) { if (uncompress(dest, &destLen, (*itMap).second->info.data, (*itMap).second->size) != Z_OK) { - dest = NULL; + dest = nullptr; destLen = 0; } format &= ~GFX_TEXFMT_GZ; diff --git a/Source/Project64-video/TextureEnhancer/TxDbg.cpp b/Source/Project64-video/TextureEnhancer/TxDbg.cpp index 04bb92eb1..c34502e9c 100644 --- a/Source/Project64-video/TextureEnhancer/TxDbg.cpp +++ b/Source/Project64-video/TextureEnhancer/TxDbg.cpp @@ -17,7 +17,7 @@ TxDbg::TxDbg() { const char * log_dir = g_settings->log_dir(); - if (log_dir != NULL && log_dir[0] != '\0') + if (log_dir != nullptr && log_dir[0] != '\0') { _level = DBG_LEVEL; diff --git a/Source/Project64-video/TextureEnhancer/TxFilter.cpp b/Source/Project64-video/TextureEnhancer/TxFilter.cpp index 12b2741cc..2d080a830 100644 --- a/Source/Project64-video/TextureEnhancer/TxFilter.cpp +++ b/Source/Project64-video/TextureEnhancer/TxFilter.cpp @@ -41,18 +41,18 @@ TxFilter::TxFilter(int maxwidth, int maxheight, int maxbpp, int options, int cachesize, const char *path, const char *ident, dispInfoFuncExt callback) : _numcore(0), - _tex1(NULL), - _tex2(NULL), + _tex1(nullptr), + _tex2(nullptr), _maxwidth(0), _maxheight(0), _maxbpp(0), _options(0), _cacheSize(0), - _txQuantize(NULL), - _txTexCache(NULL), - _txHiResCache(NULL), - _txUtil(NULL), - _txImage(NULL), + _txQuantize(nullptr), + _txTexCache(nullptr), + _txHiResCache(nullptr), + _txUtil(nullptr), + _txImage(nullptr), _initialized(false) { /* HACKALERT: the emulator misbehaves and sometimes forgets to shutdown */ @@ -90,8 +90,8 @@ TxFilter::TxFilter(int maxwidth, int maxheight, int maxbpp, int options, _initialized = 0; - _tex1 = NULL; - _tex2 = NULL; + _tex1 = nullptr; + _tex2 = nullptr; /* XXX: anything larger than 1024 * 1024 is overkill */ _maxwidth = maxwidth > 1024 ? 1024 : maxwidth; @@ -600,7 +600,7 @@ TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gf if (!_path.empty() && !_ident.empty()) { /* dump it to disk */ - FILE *fp = NULL; + FILE *fp = nullptr; CPath tmpbuf(_path.c_str(), ""); /* create directories */ @@ -631,7 +631,7 @@ TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gf { tmpbuf.SetNameExtension(stdstr_f("%ls#%08X#%01X#%01X_all.png", _ident.c_str(), (uint32)(r_crc64 & 0xffffffff), (n64fmt >> 8), (n64fmt & 0xf)).c_str()); } - if ((fp = fopen(tmpbuf, "wb")) != NULL) + if ((fp = fopen(tmpbuf, "wb")) != nullptr) { _txImage->writePNG(src, fp, width, height, (rowStridePixel << 2), 0x0003, 0); fclose(fp); diff --git a/Source/Project64-video/TextureEnhancer/TxFilterExport.cpp b/Source/Project64-video/TextureEnhancer/TxFilterExport.cpp index 1556c9b6a..9836461b9 100644 --- a/Source/Project64-video/TextureEnhancer/TxFilterExport.cpp +++ b/Source/Project64-video/TextureEnhancer/TxFilterExport.cpp @@ -11,7 +11,7 @@ #include "TxFilter.h" -TxFilter *txFilter = NULL; +TxFilter *txFilter = nullptr; #ifdef __cplusplus extern "C" { @@ -34,7 +34,7 @@ extern "C" { { if (txFilter) delete txFilter; - txFilter = NULL; + txFilter = nullptr; } TAPI bool TAPIENTRY diff --git a/Source/Project64-video/TextureEnhancer/TxHiResCache.cpp b/Source/Project64-video/TextureEnhancer/TxHiResCache.cpp index 34ef88b44..2a17a53ea 100644 --- a/Source/Project64-video/TextureEnhancer/TxHiResCache.cpp +++ b/Source/Project64-video/TextureEnhancer/TxHiResCache.cpp @@ -187,19 +187,19 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) int width = 0, height = 0; uint16 format = 0; - uint8 *tex = NULL; + uint8 *tex = nullptr; int tmpwidth = 0, tmpheight = 0; uint16 tmpformat = 0; - uint8 *tmptex = NULL; + uint8 *tmptex = nullptr; int untiled_width = 0, untiled_height = 0; uint16 destformat = 0; /* Rice hi-res textures: begin */ uint32 chksum = 0, fmt = 0, siz = 0, palchksum = 0; - char *pfname = NULL, fname[260]; + char *pfname = nullptr, fname[260]; std::string ident; - FILE *fp = NULL; + FILE *fp = nullptr; strcpy(fname, _ident.c_str()); /* XXX case sensitivity fiasco! @@ -326,7 +326,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) /* _a.png */ strcpy(pfname, "_a.png"); TargetFile = CPath(dir_path, fname); - if ((fp = fopen(TargetFile, "rb")) != NULL) { + if ((fp = fopen(TargetFile, "rb")) != nullptr) { tmptex = _txImage->readPNG(fp, &tmpwidth, &tmpheight, &tmpformat); fclose(fp); } @@ -334,7 +334,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) /* _a.bmp */ strcpy(pfname, "_a.bmp"); TargetFile = CPath(dir_path, fname); - if ((fp = fopen(TargetFile, "rb")) != NULL) { + if ((fp = fopen(TargetFile, "rb")) != nullptr) { tmptex = _txImage->readBMP(fp, &tmpwidth, &tmpheight, &tmpformat); fclose(fp); } @@ -342,7 +342,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) /* _rgb.png */ strcpy(pfname, "_rgb.png"); TargetFile = CPath(dir_path, fname); - if ((fp = fopen(TargetFile, "rb")) != NULL) { + if ((fp = fopen(TargetFile, "rb")) != nullptr) { tex = _txImage->readPNG(fp, &width, &height, &format); fclose(fp); } @@ -350,7 +350,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) /* _rgb.bmp */ strcpy(pfname, "_rgb.bmp"); TargetFile = CPath(dir_path, fname); - if ((fp = fopen(TargetFile, "rb")) != NULL) { + if ((fp = fopen(TargetFile, "rb")) != nullptr) { tex = _txImage->readBMP(fp, &width, &height, &format); fclose(fp); } @@ -375,8 +375,8 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) } if (tex) free(tex); if (tmptex) free(tmptex); - tex = NULL; - tmptex = NULL; + tex = nullptr; + tmptex = nullptr; continue; } } @@ -410,7 +410,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) #endif } free(tmptex); - tmptex = NULL; + tmptex = nullptr; } else { /* clobber A comp. never a question of alpha. only RGB used. */ @@ -448,7 +448,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) #endif pfname == strstr(fname, "_ci.bmp")) { CPath TargetFile(dir_path, fname); - if ((fp = fopen(TargetFile, "rb")) != NULL) { + if ((fp = fopen(TargetFile, "rb")) != nullptr) { if (strstr(fname, ".png")) tex = _txImage->readPNG(fp, &width, &height, &format); else if (strstr(fname, ".dds")) tex = _txImage->readDDS(fp, &width, &height, &format); else tex = _txImage->readBMP(fp, &width, &height, &format); @@ -462,7 +462,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) aspectratio == 4.0 || aspectratio == 8.0)) { free(tex); - tex = NULL; + tex = nullptr; #if !DEBUG INFO(80, "-----\n"); INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str()); @@ -474,7 +474,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) if (width != _txReSample->nextPow2(width) || height != _txReSample->nextPow2(height)) { free(tex); - tex = NULL; + tex = nullptr; #if !DEBUG INFO(80, "-----\n"); INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str()); @@ -506,7 +506,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) format == GFX_TEXFMT_ARGB_CMP_DXT5) || (width * height) < 4) { /* TxQuantize requirement: width * height must be 4 or larger. */ free(tex); - tex = NULL; + tex = nullptr; #if !DEBUG INFO(80, "-----\n"); INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str()); @@ -710,7 +710,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) if (ratio > 1) { if (!_txReSample->minify(&tex, &width, &height, ratio)) { free(tex); - tex = NULL; + tex = nullptr; DBG_INFO(80, "Error: minification failed!\n"); continue; } @@ -807,7 +807,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) } if (!_txReSample->minify(&tex, &width, &height, ratio)) { free(tex); - tex = NULL; + tex = nullptr; DBG_INFO(80, "Error: minification failed!\n"); continue; } @@ -840,7 +840,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) if (!_txReSample->nextPow2(&tex, &width, &height, 32, 0)) { #endif free(tex); - tex = NULL; + tex = nullptr; DBG_INFO(80, "Error: aspect ratio adjustment failed!\n"); continue; } @@ -924,7 +924,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) if (!_txReSample->nextPow2(&tex, &width, &height, 32, 0)) { #endif free(tex); - tex = NULL; + tex = nullptr; DBG_INFO(80, "Error: aspect ratio adjustment failed!\n"); continue; } @@ -987,7 +987,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) #endif if (tex) { free(tex); - tex = NULL; + tex = nullptr; INFO(80, "Error: bad format or size! %d x %d gfmt:%x\n", width, height, format); } else { diff --git a/Source/Project64-video/TextureEnhancer/TxImage.cpp b/Source/Project64-video/TextureEnhancer/TxImage.cpp index 5fd3beee0..18d145071 100644 --- a/Source/Project64-video/TextureEnhancer/TxImage.cpp +++ b/Source/Project64-video/TextureEnhancer/TxImage.cpp @@ -34,19 +34,19 @@ bool TxImage::getPNGInfo(FILE *fp, png_structp *png_ptr, png_infop *info_ptr) return 0; /* get PNG file info */ - *png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + *png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); if (!*png_ptr) return 0; *info_ptr = png_create_info_struct(*png_ptr); if (!*info_ptr) { - png_destroy_read_struct(png_ptr, NULL, NULL); + png_destroy_read_struct(png_ptr, nullptr, nullptr); return 0; } if (setjmp(png_jmpbuf(*png_ptr))) { DBG_INFO(80, "error reading png!\n"); - png_destroy_read_struct(png_ptr, info_ptr, NULL); + png_destroy_read_struct(png_ptr, info_ptr, nullptr); return 0; } @@ -64,7 +64,7 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format) png_structp png_ptr; png_infop info_ptr; - uint8 *image = NULL; + uint8 *image = nullptr; int bit_depth, color_type, interlace_type, compression_type, filter_type, row_bytes, o_width, o_height, num_pas; @@ -75,12 +75,12 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format) /* check if we have a valid png file */ if (!fp) - return NULL; + return nullptr; if (!getPNGInfo(fp, &png_ptr, &info_ptr)) { INFO(80, "error reading png file! png image is corrupt.\n"); - return NULL; + return nullptr; } png_get_IHDR(png_ptr, info_ptr, @@ -142,9 +142,9 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format) /* punt invalid formats */ if (color_type != PNG_COLOR_TYPE_RGB_ALPHA) { - png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); DBG_INFO(80, "Error: not PNG_COLOR_TYPE_RGB_ALPHA format!\n"); - return NULL; + return nullptr; } /*png_color_8p sig_bit; @@ -177,7 +177,7 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format) for (i = 0; i < o_height; i++) { /* copy row */ - png_read_rows(png_ptr, &tmpimage, NULL, 1); + png_read_rows(png_ptr, &tmpimage, nullptr, 1); tmpimage += row_bytes; } } @@ -204,7 +204,7 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format) #endif if (image) { free(image); - image = NULL; + image = nullptr; } *width = 0; *height = 0; @@ -217,7 +217,7 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format) } /* clean up */ - png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); #ifdef DEBUG if (!image) { @@ -243,13 +243,13 @@ TxImage::writePNG(uint8* src, FILE* fp, int width, int height, int rowStride, ui if (!src || !fp) return 0; - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (png_ptr == NULL) + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); + if (png_ptr == nullptr) return 0; info_ptr = png_create_info_struct(png_ptr); - if (info_ptr == NULL) { - png_destroy_write_struct(&png_ptr, NULL); + if (info_ptr == nullptr) { + png_destroy_write_struct(&png_ptr, nullptr); return 0; } @@ -478,9 +478,9 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format) * 24, 32bit bmp -> GFX_TEXFMT_ARGB_8888 */ - uint8 *image = NULL; - uint8 *image_row = NULL; - uint8 *tmpimage = NULL; + uint8 *image = nullptr; + uint8 *image_row = nullptr; + uint8 *tmpimage = nullptr; unsigned int row_bytes, pos; int i, j; /* Windows Bitmap */ @@ -494,11 +494,11 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format) /* check if we have a valid bmp file */ if (!fp) - return NULL; + return nullptr; if (!getBMPInfo(fp, &bmp_fhdr, &bmp_ihdr)) { INFO(80, "error reading bitmap file! bitmap image is corrupt.\n"); - return NULL; + return nullptr; } DBG_INFO(80, "bmp format %d x %d bitdepth:%d compression:%x offset:%d\n", @@ -514,7 +514,7 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format) if (!(bmp_ihdr.biBitCount == 8 || bmp_ihdr.biBitCount == 4 || bmp_ihdr.biBitCount == 32 || bmp_ihdr.biBitCount == 24) || bmp_ihdr.biCompression != 0) { DBG_INFO(80, "Error: incompatible bitmap format!\n"); - return NULL; + return nullptr; } switch (bmp_ihdr.biBitCount) { @@ -558,7 +558,7 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format) else { if (image_row) free(image_row); if (image) free(image); - image = NULL; + image = nullptr; } break; case 24: @@ -587,7 +587,7 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format) else { if (image_row) free(image_row); if (image) free(image); - image = NULL; + image = nullptr; } } @@ -620,7 +620,7 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format) #endif if (image) { free(image); - image = NULL; + image = nullptr; } *width = 0; *height = 0; @@ -718,7 +718,7 @@ TxImage::getDDSInfo(FILE *fp, DDSFILEHEADER *dds_fhdr) uint8* TxImage::readDDS(FILE* fp, int* width, int* height, uint16* format) { - uint8 *image = NULL; + uint8 *image = nullptr; DDSFILEHEADER dds_fhdr; uint16 tmpformat = 0; @@ -729,11 +729,11 @@ TxImage::readDDS(FILE* fp, int* width, int* height, uint16* format) /* check if we have a valid dds file */ if (!fp) - return NULL; + return nullptr; if (!getDDSInfo(fp, &dds_fhdr)) { INFO(80, "error reading dds file! dds image is corrupt.\n"); - return NULL; + return nullptr; } DBG_INFO(80, "dds format %d x %d HeaderSize %d LinearSize %d\n", @@ -741,17 +741,17 @@ TxImage::readDDS(FILE* fp, int* width, int* height, uint16* format) if (!(dds_fhdr.dwFlags & (DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_LINEARSIZE))) { DBG_INFO(80, "Error: incompatible dds format!\n"); - return NULL; + return nullptr; } if ((dds_fhdr.dwFlags & DDSD_MIPMAPCOUNT) && dds_fhdr.dwMipMapCount != 1) { DBG_INFO(80, "Error: mipmapped dds not supported!\n"); - return NULL; + return nullptr; } if (!((dds_fhdr.ddpf.dwFlags & DDPF_FOURCC) && dds_fhdr.dwCaps2 == 0)) { DBG_INFO(80, "Error: not fourcc standard texture!\n"); - return NULL; + return nullptr; } if (memcmp(&dds_fhdr.ddpf.dwFourCC, "DXT1", 4) == 0) { @@ -772,7 +772,7 @@ TxImage::readDDS(FILE* fp, int* width, int* height, uint16* format) } else { DBG_INFO(80, "Error: not DXT1 or DXT3 or DXT5 format!\n"); - return NULL; + return nullptr; } /* read in image */ diff --git a/Source/Project64-video/TextureEnhancer/TxUtil.cpp b/Source/Project64-video/TextureEnhancer/TxUtil.cpp index 02c8b5b49..4456db270 100644 --- a/Source/Project64-video/TextureEnhancer/TxUtil.cpp +++ b/Source/Project64-video/TextureEnhancer/TxUtil.cpp @@ -429,7 +429,7 @@ TxMemBuf::TxMemBuf() { int i; for (i = 0; i < 2; i++) { - _tex[i] = NULL; + _tex[i] = nullptr; _size[i] = 0; } } @@ -464,14 +464,14 @@ void TxMemBuf::shutdown() int i; for (i = 0; i < 2; i++) { if (_tex[i]) free(_tex[i]); - _tex[i] = NULL; + _tex[i] = nullptr; _size[i] = 0; } } uint8* TxMemBuf::get(unsigned int num) { - return ((num < 2) ? _tex[num] : NULL); + return ((num < 2) ? _tex[num] : nullptr); } uint32 TxMemBuf::size_of(unsigned int num) diff --git a/Source/Project64-video/rdp.cpp b/Source/Project64-video/rdp.cpp index 1fad21032..8dfd5464a 100644 --- a/Source/Project64-video/rdp.cpp +++ b/Source/Project64-video/rdp.cpp @@ -142,8 +142,8 @@ static int reset = 0; static CSettings::ucode_t g_old_ucode = CSettings::uCode_Unsupported; CRDP::CRDP() : - vtx1(NULL), - vtx2(NULL) + vtx1(nullptr), + vtx2(nullptr) { free(); } @@ -155,20 +155,20 @@ CRDP::~CRDP() bool CRDP::init() { - if (vtx1 != NULL) + if (vtx1 != nullptr) { return true; } vtx1 = new gfxVERTEX[256]; - if (vtx1 == NULL) + if (vtx1 == nullptr) { free(); return false; } memset(vtx1, 0, sizeof(gfxVERTEX) * 256); vtx2 = new gfxVERTEX[256]; - if (vtx2 == NULL) + if (vtx2 == nullptr) { free(); return false; @@ -178,14 +178,14 @@ bool CRDP::init() for (int i = 0; i < MAX_TMU; i++) { cache[i] = new CACHE_LUT[MAX_CACHE]; - if (cache[i] == NULL) + if (cache[i] == nullptr) { free(); return false; } }; m_vtx = new gfxVERTEX[MAX_VTX]; - if (m_vtx == NULL) + if (m_vtx == nullptr) { free(); return false; @@ -198,7 +198,7 @@ bool CRDP::init() } frame_buffers = new COLOR_IMAGE[NUMTEXBUF + 2]; - if (frame_buffers == NULL) + if (frame_buffers == nullptr) { free(); return false; @@ -211,37 +211,37 @@ void CRDP::free() if (vtx1) { delete vtx1; - vtx1 = NULL; + vtx1 = nullptr; } if (vtx2) { delete vtx2; - vtx2 = NULL; + vtx2 = nullptr; } clip = 0; - vtxbuf = NULL; - vtxbuf2 = NULL; + vtxbuf = nullptr; + vtxbuf2 = nullptr; for (int i = 0; i < MAX_TMU; i++) { - if (cache[i] != NULL) + if (cache[i] != nullptr) { delete cache[i]; - cache[i] = NULL; + cache[i] = nullptr; } cur_cache[i] = 0; cur_cache_n[i] = 0; } - if (m_vtx != NULL) + if (m_vtx != nullptr) { delete[] m_vtx; - m_vtx = NULL; + m_vtx = nullptr; } - if (frame_buffers != NULL) + if (frame_buffers != nullptr) { delete[] frame_buffers; - frame_buffers = NULL; + frame_buffers = nullptr; } n_global = 0; @@ -433,8 +433,8 @@ void CRDP::free() read_previous_ci = 0; read_whole_frame = 0; ci_status = ci_main; - cur_image = NULL; - tbuff_tex = NULL; + cur_image = nullptr; + tbuff_tex = nullptr; memset(aTBuffTex, 0, sizeof(aTBuffTex)); cur_tex_buf = 0; acc_tex_buf = 0; diff --git a/Source/Project64-video/trace.cpp b/Source/Project64-video/trace.cpp index c5589b728..e277dc41d 100644 --- a/Source/Project64-video/trace.cpp +++ b/Source/Project64-video/trace.cpp @@ -30,20 +30,20 @@ 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(); } @@ -73,8 +73,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; } @@ -94,6 +94,6 @@ void StopTrace(void) { TraceRemoveModule(g_LogFile); delete g_LogFile; - g_LogFile = NULL; + g_LogFile = nullptr; } } diff --git a/Source/Project64-video/ucode09.cpp b/Source/Project64-video/ucode09.cpp index d9df5257c..2a33b2ec4 100644 --- a/Source/Project64-video/ucode09.cpp +++ b/Source/Project64-video/ucode09.cpp @@ -232,7 +232,7 @@ void uc9_fmlight() uint32_t a = -1024 + (rdp.cmd1 & 0xFFF); WriteTrace(TraceRDP, TraceDebug, "uc9:fmlight matrix: %d, num: %d, dmem: %04lx", mid, rdp.num_lights, a); - M44 *m = NULL; + M44 *m = nullptr; switch (mid) { case 4: m = (M44*)rdp.model; @@ -244,7 +244,7 @@ void uc9_fmlight() m = (M44*)rdp.combined; break; default: - m = NULL; /* allowing segfaults to debug in case of PJGlide64 bugs */ + m = nullptr; /* allowing segfaults to debug in case of PJGlide64 bugs */ WriteTrace(TraceRDP, TraceWarning, "Invalid FM light matrix ID %u.", mid); break; } @@ -365,8 +365,8 @@ void uc9_mtxtrnsp() void uc9_mtxcat() { WriteTrace(TraceRDP, TraceDebug, "uc9:mtxcat "); - M44 *s = NULL; - M44 *t = NULL; + M44 *s = nullptr; + M44 *t = nullptr; uint32_t S = rdp.cmd0 & 0xF; uint32_t T = (rdp.cmd1 >> 16) & 0xF; uint32_t D = rdp.cmd1 & 0xF; @@ -385,7 +385,7 @@ void uc9_mtxcat() break; default: WriteTrace(TraceRDP, TraceWarning, "Invalid mutex S-coordinate: %u", S); - s = NULL; /* intentional segfault to alert for bugs in PJGlide64 (cxd4) */ + s = nullptr; /* intentional segfault to alert for bugs in PJGlide64 (cxd4) */ break; } switch (T) { @@ -403,7 +403,7 @@ void uc9_mtxcat() break; default: WriteTrace(TraceRDP, TraceWarning, "Invalid mutex T-coordinate: %u", T); - t = NULL; /* intentional segfault to alert for bugs in PJGlide64 (cxd4) */ + t = nullptr; /* intentional segfault to alert for bugs in PJGlide64 (cxd4) */ break; } DECLAREALIGN16VAR(m[4][4]); diff --git a/Source/Project64/Plugins/PluginList.cpp b/Source/Project64/Plugins/PluginList.cpp index 8d3ae6dba..807b31ecb 100644 --- a/Source/Project64/Plugins/PluginList.cpp +++ b/Source/Project64/Plugins/PluginList.cpp @@ -25,7 +25,7 @@ const CPluginList::PLUGIN * CPluginList::GetPluginInfo(int indx) const { if (indx < 0 || indx >= (int)m_PluginList.size()) { - return NULL; + return nullptr; } return &m_PluginList[indx]; } @@ -54,13 +54,13 @@ void CPluginList::AddPluginFromDir(CPath Dir) Dir.SetNameExtension("*.dll"); if (Dir.FindFirst()) { - HMODULE hLib = NULL; + HMODULE hLib = nullptr; do { if (hLib) { FreeLibrary(hLib); - hLib = NULL; + hLib = nullptr; } //UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS ); @@ -68,7 +68,7 @@ void CPluginList::AddPluginFromDir(CPath Dir) hLib = LoadLibrary(stdstr((LPCSTR)Dir).ToUTF16().c_str()); //SetErrorMode(LastErrorMode); - if (hLib == NULL) + if (hLib == nullptr) { DWORD LoadError = GetLastError(); WriteTrace(TraceUserInterface, TraceDebug, "failed to load %s (error: %d)", (LPCSTR)Dir, LoadError); @@ -77,7 +77,7 @@ void CPluginList::AddPluginFromDir(CPath Dir) void(CALL *GetDllInfo) (PLUGIN_INFO * PluginInfo); GetDllInfo = (void(CALL *)(PLUGIN_INFO *))GetProcAddress(hLib, "GetDllInfo"); - if (GetDllInfo == NULL) + if (GetDllInfo == nullptr) { continue; } @@ -93,7 +93,7 @@ void CPluginList::AddPluginFromDir(CPath Dir) Plugin.FullPath = Dir; Plugin.FileName = stdstr((const char *)Dir).substr(strlen(m_PluginDir)); - if (GetProcAddress(hLib, "DllAbout") != NULL) + if (GetProcAddress(hLib, "DllAbout") != nullptr) { Plugin.AboutFunction = true; } @@ -103,7 +103,7 @@ void CPluginList::AddPluginFromDir(CPath Dir) if (hLib) { FreeLibrary(hLib); - hLib = NULL; + hLib = nullptr; } } } diff --git a/Source/Project64/Settings/GuiSettings.cpp b/Source/Project64/Settings/GuiSettings.cpp index e270ef974..3cb962d93 100644 --- a/Source/Project64/Settings/GuiSettings.cpp +++ b/Source/Project64/Settings/GuiSettings.cpp @@ -9,9 +9,9 @@ CGuiSettings::CGuiSettings() m_RefCount += 1; if (m_RefCount == 1) { - g_Settings->RegisterChangeCB(GameRunning_CPU_Running,NULL,RefreshSettings); - g_Settings->RegisterChangeCB((SettingID)Setting_AutoSleep,NULL,RefreshSettings); - RefreshSettings(NULL); + g_Settings->RegisterChangeCB(GameRunning_CPU_Running,nullptr,RefreshSettings); + g_Settings->RegisterChangeCB((SettingID)Setting_AutoSleep,nullptr,RefreshSettings); + RefreshSettings(nullptr); } } @@ -20,8 +20,8 @@ CGuiSettings::~CGuiSettings() m_RefCount -= 1; if (m_RefCount == 0) { - g_Settings->UnregisterChangeCB(GameRunning_CPU_Running,NULL,RefreshSettings); - g_Settings->UnregisterChangeCB((SettingID)Setting_AutoSleep,NULL,RefreshSettings); + g_Settings->UnregisterChangeCB(GameRunning_CPU_Running,nullptr,RefreshSettings); + g_Settings->UnregisterChangeCB((SettingID)Setting_AutoSleep,nullptr,RefreshSettings); } } diff --git a/Source/Project64/UserInterface/About.cpp b/Source/Project64/UserInterface/About.cpp index 53c7fdf4c..0b238ce61 100644 --- a/Source/Project64/UserInterface/About.cpp +++ b/Source/Project64/UserInterface/About.cpp @@ -50,20 +50,20 @@ void CAboutDlg::SetWindowDetais(int nIDDlgItem, int nAboveIDDlgItem, const wchar CRect rcWin; Wnd.GetWindowRect(&rcWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&rcWin, 2); if (hDC.DrawText(Text, -1, &rcWin, DT_LEFT | DT_CALCRECT | DT_WORDBREAK | DT_NOCLIP) > 0) { - Wnd.SetWindowPos(NULL, 0, 0, rcWin.Width(), rcWin.Height(), SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER); + Wnd.SetWindowPos(nullptr, 0, 0, rcWin.Width(), rcWin.Height(), SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER); } CWindow AboveWnd = GetDlgItem(nAboveIDDlgItem); AboveWnd.GetWindowRect(&rcWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&rcWin, 2); LONG Top = rcWin.bottom + (LONG)(8 * DPIScale); Wnd.GetWindowRect(&rcWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); - Wnd.SetWindowPos(NULL, rcWin.left, Top, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&rcWin, 2); + Wnd.SetWindowPos(nullptr, rcWin.left, Top, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); } diff --git a/Source/Project64/UserInterface/CheatClassUI.cpp b/Source/Project64/UserInterface/CheatClassUI.cpp index 30b4bfe0a..79fb54390 100644 --- a/Source/Project64/UserInterface/CheatClassUI.cpp +++ b/Source/Project64/UserInterface/CheatClassUI.cpp @@ -25,7 +25,7 @@ void CCheatsUI::Display(HWND hParent, bool BlockExecution) m_bModal = true; DoModal(hParent); } - else if (m_hWnd != NULL) + else if (m_hWnd != nullptr) { SetFocus(); } @@ -90,7 +90,7 @@ LRESULT CCheatsUI::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPara int32_t DlgHeight = rcDlg.Height(); int32_t X = (((rcParent.Width()) - DlgWidth) / 2) + rcParent.left; int32_t Y = (((rcParent.Height()) - DlgHeight) / 2) + rcParent.top; - SetWindowPos(NULL, X, Y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + SetWindowPos(nullptr, X, Y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); m_SelectCheat.RefreshItems(); ShowWindow(SW_SHOW); return 0; @@ -160,7 +160,7 @@ LRESULT CCheatsUI::OnStateChange(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWnd CCheatList::CCheatList(CEnhancementList & Cheats, CEditCheat & EditCheat) : m_Cheats(Cheats), m_EditCheat(EditCheat), - m_hSelectedItem(NULL), + m_hSelectedItem(nullptr), m_DeleteingEntries(false) { } @@ -277,7 +277,7 @@ LRESULT CCheatList::OnTreeClicked(NMHDR* lpnmh) { case TV_STATE_CLEAR: case TV_STATE_INDETERMINATE: - if (m_hCheatTree.GetChildItem(ht.hItem) == NULL) + if (m_hCheatTree.GetChildItem(ht.hItem) == nullptr) { TVITEM item = { 0 }; item.mask = TVIF_PARAM; @@ -336,19 +336,19 @@ LRESULT CCheatList::OnTreeRClicked(NMHDR* lpnmh) m_hSelectedItem = ht.hItem; // Show menu - HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_CHEAT_MENU)); + HMENU hMenu = LoadMenu(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDR_CHEAT_MENU)); HMENU hPopupMenu = GetSubMenu(hMenu, 0); POINT Mouse; GetCursorPos(&Mouse); - MenuSetText(hPopupMenu, 0, wGS(CHEAT_ADDNEW).c_str(), NULL); - MenuSetText(hPopupMenu, 1, wGS(CHEAT_EDIT).c_str(), NULL); - MenuSetText(hPopupMenu, 3, wGS(CHEAT_DELETE).c_str(), NULL); + MenuSetText(hPopupMenu, 0, wGS(CHEAT_ADDNEW).c_str(), nullptr); + MenuSetText(hPopupMenu, 1, wGS(CHEAT_EDIT).c_str(), nullptr); + MenuSetText(hPopupMenu, 3, wGS(CHEAT_DELETE).c_str(), nullptr); - if (m_hSelectedItem != NULL && m_hCheatTree.GetChildItem(m_hSelectedItem) == NULL) + if (m_hSelectedItem != nullptr && m_hCheatTree.GetChildItem(m_hSelectedItem) == nullptr) { - TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0, m_hWnd, NULL); + TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0, m_hWnd, nullptr); } DestroyMenu(hMenu); return true; @@ -375,7 +375,7 @@ LRESULT CCheatList::OnTreeSelChanged(NMHDR * /*lpnmh*/) { HTREEITEM hItem = m_hCheatTree.GetSelectedItem(); GetDlgItem(IDC_NOTES).SetWindowText(L""); - if (m_hCheatTree.GetChildItem(hItem) == NULL) + if (m_hCheatTree.GetChildItem(hItem) == nullptr) { TVITEM item = { 0 }; item.mask = TVIF_PARAM; @@ -385,7 +385,7 @@ LRESULT CCheatList::OnTreeSelChanged(NMHDR * /*lpnmh*/) { CEnhancement * Enhancement = (CEnhancement *)item.lParam; GetDlgItem(IDC_NOTES).SetWindowText(stdstr(Enhancement->GetNote()).ToUTF16().c_str()); - if (m_EditCheat.m_hWnd != NULL) + if (m_EditCheat.m_hWnd != nullptr) { m_EditCheat.SendMessage(CEditCheat::WM_EDITCHEAT, item.lParam, 0); } @@ -396,7 +396,7 @@ LRESULT CCheatList::OnTreeSelChanged(NMHDR * /*lpnmh*/) void CCheatList::RefreshItems() { - if (m_hWnd == NULL) { return; } + if (m_hWnd == nullptr) { return; } m_DeleteingEntries = true; m_hCheatTree.DeleteAllItems(); @@ -463,7 +463,7 @@ void CCheatList::AddCodeLayers(LPARAM Enhancement, const std::wstring &Name, HTR void CCheatList::ChangeChildrenStatus(HTREEITEM hParent, bool Checked) { HTREEITEM hItem = m_hCheatTree.GetChildItem(hParent);; - if (hItem == NULL) + if (hItem == nullptr) { if (hParent == TVI_ROOT) { return; } @@ -490,7 +490,7 @@ void CCheatList::ChangeChildrenStatus(HTREEITEM hParent, bool Checked) return; } TV_CHECK_STATE state = TV_STATE_UNKNOWN; - while (hItem != NULL) + while (hItem != nullptr) { TV_CHECK_STATE ChildState = TV_GetCheckState(hItem); if ((ChildState != TV_STATE_CHECKED || !Checked) && @@ -511,14 +511,14 @@ void CCheatList::ChangeChildrenStatus(HTREEITEM hParent, bool Checked) void CCheatList::CheckParentStatus(HTREEITEM hParent) { - if (hParent == NULL) + if (hParent == nullptr) { return; } HTREEITEM hItem = m_hCheatTree.GetChildItem(hParent); TV_CHECK_STATE InitialState = TV_GetCheckState(hParent); TV_CHECK_STATE CurrentState = TV_GetCheckState(hItem); - while (hItem != NULL) + while (hItem != nullptr) { if (TV_GetCheckState(hItem) != CurrentState) { @@ -586,7 +586,7 @@ bool CCheatList::TV_SetCheckState(HTREEITEM hItem, TV_CHECK_STATE state) void CCheatList::MenuSetText(HMENU hMenu, int MenuPos, const wchar_t * Title, const wchar_t * ShortCut) { - if (Title == NULL || wcslen(Title) == 0) + if (Title == nullptr || wcslen(Title) == 0) { return; } @@ -602,7 +602,7 @@ void CCheatList::MenuSetText(HMENU hMenu, int MenuPos, const wchar_t * Title, co GetMenuItemInfo(hMenu, MenuPos, true, &MenuInfo); wcscpy(String, Title); - if (wcschr(String, '\t') != NULL) { *(wcschr(String, '\t')) = '\0'; } + if (wcschr(String, '\t') != nullptr) { *(wcschr(String, '\t')) = '\0'; } if (ShortCut) { _swprintf(String, L"%s\t%s", String, ShortCut); } SetMenuItemInfo(hMenu, MenuPos, true, &MenuInfo); } @@ -640,7 +640,7 @@ LRESULT CEditCheat::OnEditCheat(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, } m_EditEnhancement = (CEnhancement *)wParam; - if (m_EditEnhancement == NULL) + if (m_EditEnhancement == nullptr) { return 0; } diff --git a/Source/Project64/UserInterface/Debugger/Assembler.cpp b/Source/Project64/UserInterface/Debugger/Assembler.cpp index d9745a3d6..4fa761576 100644 --- a/Source/Project64/UserInterface/Debugger/Assembler.cpp +++ b/Source/Project64/UserInterface/Debugger/Assembler.cpp @@ -11,29 +11,29 @@ ASM_PARSE_ERROR CAssembler::m_ParseError = ERR_NONE; uint32_t CAssembler::m_Address = 0; -char* CAssembler::m_TokContext = NULL; +char* CAssembler::m_TokContext = nullptr; -const ASM_SYNTAX_FN CAssembler::syn_jump[] = { arg_jump, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_loadstore[] = { arg_reg_t, arg_imm16, arg_reg_s, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_arith[] = { arg_reg_d, arg_reg_s, arg_reg_t, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_arith2[] = { arg_reg_s, arg_reg_t, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_shiftv[] = { arg_reg_d, arg_reg_t, arg_reg_s, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_arith_i[] = { arg_reg_t, arg_reg_s, arg_imm16, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_load_i[] = { arg_reg_t, arg_imm16, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_branch_z[] = { arg_reg_s, arg_bra_target, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_branch[] = { arg_reg_s, arg_reg_t, arg_bra_target, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_branch_unc[] = { arg_bra_target, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_trap_i[] = { arg_reg_s, arg_imm16, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_shift[] = { arg_reg_d, arg_reg_t, arg_shamt, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_mf[] = { arg_reg_d, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_jr[] = { arg_reg_s, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_jalr[] = { arg_reg_d, arg_reg_s, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_cop1_arith[] = { arg_reg_fd, arg_reg_fs, arg_reg_ft, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_cop1[] = { arg_reg_fd, arg_reg_fs, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_cop1_cmp[] = { arg_reg_fs, arg_reg_ft, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_cop_mv[] = { arg_reg_t, arg_reg_d, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_cache[] = { arg_cache_op, arg_imm16, arg_reg_s, NULL }; -const ASM_SYNTAX_FN CAssembler::syn_syscall[] = { arg_syscall_code, NULL }; +const ASM_SYNTAX_FN CAssembler::syn_jump[] = { arg_jump, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_loadstore[] = { arg_reg_t, arg_imm16, arg_reg_s, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_arith[] = { arg_reg_d, arg_reg_s, arg_reg_t, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_arith2[] = { arg_reg_s, arg_reg_t, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_shiftv[] = { arg_reg_d, arg_reg_t, arg_reg_s, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_arith_i[] = { arg_reg_t, arg_reg_s, arg_imm16, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_load_i[] = { arg_reg_t, arg_imm16, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_branch_z[] = { arg_reg_s, arg_bra_target, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_branch[] = { arg_reg_s, arg_reg_t, arg_bra_target, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_branch_unc[] = { arg_bra_target, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_trap_i[] = { arg_reg_s, arg_imm16, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_shift[] = { arg_reg_d, arg_reg_t, arg_shamt, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_mf[] = { arg_reg_d, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_jr[] = { arg_reg_s, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_jalr[] = { arg_reg_d, arg_reg_s, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_cop1_arith[] = { arg_reg_fd, arg_reg_fs, arg_reg_ft, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_cop1[] = { arg_reg_fd, arg_reg_fs, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_cop1_cmp[] = { arg_reg_fs, arg_reg_ft, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_cop_mv[] = { arg_reg_t, arg_reg_d, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_cache[] = { arg_cache_op, arg_imm16, arg_reg_s, nullptr }; +const ASM_SYNTAX_FN CAssembler::syn_syscall[] = { arg_syscall_code, nullptr }; const ASM_INSTRUCTION CAssembler::m_Instructions[] = { @@ -91,7 +91,7 @@ const ASM_INSTRUCTION CAssembler::m_Instructions[] = { "sd", R4300i_SD, base_op, syn_loadstore }, { "sll", R4300i_SPECIAL_SLL, base_spec, syn_shift }, - { "nop", R4300i_SPECIAL_SLL, base_spec, NULL }, + { "nop", R4300i_SPECIAL_SLL, base_spec, nullptr }, { "srl", R4300i_SPECIAL_SRL, base_spec, syn_shift }, { "sra", R4300i_SPECIAL_SRA, base_spec, syn_shift }, { "sllv", R4300i_SPECIAL_SLLV, base_spec, syn_shiftv }, @@ -102,7 +102,7 @@ const ASM_INSTRUCTION CAssembler::m_Instructions[] = { "jalr", R4300i_SPECIAL_JALR, base_spec_jalr_ra, syn_jr }, { "syscall", R4300i_SPECIAL_SYSCALL, base_spec, syn_syscall }, { "break", R4300i_SPECIAL_BREAK, base_spec, syn_syscall }, - { "sync", R4300i_SPECIAL_SYNC, base_spec, NULL }, + { "sync", R4300i_SPECIAL_SYNC, base_spec, nullptr }, { "mfhi", R4300i_SPECIAL_MFHI, base_spec, syn_mf }, { "mthi", R4300i_SPECIAL_MTHI, base_spec, syn_mf }, { "mflo", R4300i_SPECIAL_MFLO, base_spec, syn_mf }, @@ -164,11 +164,11 @@ const ASM_INSTRUCTION CAssembler::m_Instructions[] = { "mfc0", R4300i_COP0_MF , base_cop0_mv, syn_cop_mv }, { "mtc0", R4300i_COP0_MT , base_cop0_mv, syn_cop_mv }, - { "tlbr", R4300i_COP0_CO_TLBR, base_cop0_co, NULL }, - { "tlbwi", R4300i_COP0_CO_TLBWI, base_cop0_co, NULL }, - { "tlbwr", R4300i_COP0_CO_TLBWR, base_cop0_co, NULL }, - { "tlbp", R4300i_COP0_CO_TLBP, base_cop0_co, NULL }, - { "eret", R4300i_COP0_CO_ERET, base_cop0_co, NULL }, + { "tlbr", R4300i_COP0_CO_TLBR, base_cop0_co, nullptr }, + { "tlbwi", R4300i_COP0_CO_TLBWI, base_cop0_co, nullptr }, + { "tlbwr", R4300i_COP0_CO_TLBWR, base_cop0_co, nullptr }, + { "tlbp", R4300i_COP0_CO_TLBP, base_cop0_co, nullptr }, + { "eret", R4300i_COP0_CO_ERET, base_cop0_co, nullptr }, { "mfc1", R4300i_COP1_MF, base_cop1_mv, syn_cop_mv }, { "dmfc1", R4300i_COP1_DMF, base_cop1_mv, syn_cop_mv }, @@ -260,7 +260,7 @@ const ASM_INSTRUCTION CAssembler::m_Instructions[] = { "cvt.d.w", R4300i_COP1_FUNCT_CVT_D, base_cop1_w, syn_cop1 }, { "cvt.s.l", R4300i_COP1_FUNCT_CVT_S, base_cop1_l, syn_cop1 }, { "cvt.d.l", R4300i_COP1_FUNCT_CVT_D, base_cop1_l, syn_cop1 }, - { NULL } + { nullptr } }; const ASM_REGISTER CAssembler::m_Registers[] = @@ -290,7 +290,7 @@ const ASM_REGISTER CAssembler::m_Registers[] = { "watchhi", 19 },{ "xcontext", 20 },{ "ecc", 26 },{ "cacheerr", 27 },{ "taglo", 28 },{ "taghi", 29 }, { "errepc", 30 }, - { NULL } + { nullptr } }; bool CAssembler::AssembleLine(const char* line, uint32_t* opcode, uint32_t address) @@ -317,7 +317,7 @@ bool CAssembler::AssembleLine(const char* line, uint32_t* opcode, uint32_t addre { const ASM_INSTRUCTION* instruction = LookupInstruction(name, nFallback); - if (instruction == NULL) + if (instruction == nullptr) { m_ParseError = ERR_UNKNOWN_CMD; return false; @@ -335,7 +335,7 @@ bool CAssembler::AssembleLine(const char* line, uint32_t* opcode, uint32_t addre *opcode = instruction->base(instruction->val); - if (instruction->syntax == NULL) + if (instruction->syntax == nullptr) { // No parameters return true; @@ -360,7 +360,7 @@ bool CAssembler::AssembleLine(const char* line, uint32_t* opcode, uint32_t addre const ASM_INSTRUCTION* CAssembler::LookupInstruction(char* name, int nFallback) { - for (int i = 0; m_Instructions[i].name != NULL; i++) + for (int i = 0; m_Instructions[i].name != nullptr; i++) { if (strcmp(name, m_Instructions[i].name) == 0) { @@ -372,19 +372,19 @@ const ASM_INSTRUCTION* CAssembler::LookupInstruction(char* name, int nFallback) return &m_Instructions[i]; } } - return NULL; + return nullptr; } const ASM_REGISTER* CAssembler::LookupRegister(char* name) { - for (int i = 0; m_Registers[i].name != NULL; i++) + for (int i = 0; m_Registers[i].name != nullptr; i++) { if (strcmp(name, m_Registers[i].name) == 0) { return &m_Registers[i]; } } - return NULL; + return nullptr; } void CAssembler::StrToLower(char* str) @@ -401,9 +401,9 @@ void CAssembler::StrToLower(char* str) uint32_t CAssembler::pop_reg() { - char* r = strtok_s(NULL, " \t,()", &m_TokContext); + char* r = strtok_s(nullptr, " \t,()", &m_TokContext); - if (r == NULL) + if (r == nullptr) { m_ParseError = ERR_EXPECTED_REG; return 0; @@ -411,7 +411,7 @@ uint32_t CAssembler::pop_reg() const ASM_REGISTER* reg = LookupRegister(r); - if (reg == NULL) + if (reg == nullptr) { m_ParseError = ERR_INVALID_REG; return 0; @@ -422,9 +422,9 @@ uint32_t CAssembler::pop_reg() uint32_t CAssembler::pop_val() { - char* v = strtok_s(NULL, " \t,()", &m_TokContext); + char* v = strtok_s(nullptr, " \t,()", &m_TokContext); - if (v == NULL) + if (v == nullptr) { m_ParseError = ERR_EXPECTED_VAL; return 0; diff --git a/Source/Project64/UserInterface/Debugger/CPULog.cpp b/Source/Project64/UserInterface/Debugger/CPULog.cpp index 790518f74..8f62597b3 100644 --- a/Source/Project64/UserInterface/Debugger/CPULog.cpp +++ b/Source/Project64/UserInterface/Debugger/CPULog.cpp @@ -21,7 +21,7 @@ CCPULog::CCPULog(size_t size) : if (m_Size == 0) { - m_Array = NULL; + m_Array = nullptr; return; } @@ -30,16 +30,16 @@ CCPULog::CCPULog(size_t size) : CCPULog::~CCPULog(void) { - if (m_Array != NULL) + if (m_Array != nullptr) { delete[] m_Array; - m_Array = NULL; + m_Array = nullptr; } } void CCPULog::PushState() { - if (m_Array == NULL) + if (m_Array == nullptr) { return; } @@ -83,23 +83,23 @@ size_t CCPULog::GetSize(void) CPUState* CCPULog::GetEntry(size_t index) { - if (m_Array == NULL) + if (m_Array == nullptr) { - return NULL; + return nullptr; } if (m_bMaxed) { if (index >= m_Size) { - return NULL; + return nullptr; } return &m_Array[(m_Index + index) % m_Size]; } if (index >= m_Index) { - return NULL; + return nullptr; } return &m_Array[index]; @@ -125,10 +125,10 @@ void CCPULog::Reset() { m_Size = newSize; - if (m_Array != NULL) + if (m_Array != nullptr) { delete[] m_Array; - m_Array = NULL; + m_Array = nullptr; } if (m_Size != 0) @@ -140,9 +140,9 @@ void CCPULog::Reset() CCPULog* CCPULog::Clone(void) { - if (m_Array == NULL) + if (m_Array == nullptr) { - return NULL; + return nullptr; } CCPULog *clone = new CCPULog(m_Size); @@ -156,7 +156,7 @@ void CCPULog::DumpToFile(const char* path) { FILE* fp = fopen(path, "wb"); - if (fp == NULL) + if (fp == nullptr) { return; } @@ -171,9 +171,9 @@ void CCPULog::DumpToFile(const char* path) char* szCommand = (char*)R4300iOpcodeName(state->opcode.Hex, state->pc); char* szCmdName = strtok_s((char*)szCommand, "\t", &tokctx); - char* szCmdArgs = strtok_s(NULL, "\t", &tokctx); + char* szCmdArgs = strtok_s(nullptr, "\t", &tokctx); - if (szCmdArgs == NULL) + if (szCmdArgs == nullptr) { szCmdArgs = ""; } diff --git a/Source/Project64/UserInterface/Debugger/DMALog.cpp b/Source/Project64/UserInterface/Debugger/DMALog.cpp index 924d29300..f44343e86 100644 --- a/Source/Project64/UserInterface/Debugger/DMALog.cpp +++ b/Source/Project64/UserInterface/Debugger/DMALog.cpp @@ -23,7 +23,7 @@ DMALOGENTRY* CDMALog::GetEntryByIndex(uint32_t index) { return &m_Log[index]; } - return NULL; + return nullptr; } DMALOGENTRY* CDMALog::GetEntryByRamAddress(uint32_t ramAddr) @@ -32,7 +32,7 @@ DMALOGENTRY* CDMALog::GetEntryByRamAddress(uint32_t ramAddr) if (nEntries == 0) { - return NULL; + return nullptr; } for (uint32_t i = nEntries - 1; i-- > 0;) @@ -45,16 +45,16 @@ DMALOGENTRY* CDMALog::GetEntryByRamAddress(uint32_t ramAddr) return &m_Log[i]; } } - return NULL; + return nullptr; } DMALOGENTRY* CDMALog::GetEntryByRamAddress(uint32_t ramAddr, uint32_t* lpRomAddr, uint32_t* lpOffset) { DMALOGENTRY* lpEntry = GetEntryByRamAddress(ramAddr); - if (lpEntry == NULL) + if (lpEntry == nullptr) { - return NULL; + return nullptr; } *lpOffset = ramAddr - lpEntry->ramAddr; @@ -69,7 +69,7 @@ DMALOGENTRY* CDMALog::GetEntryByRomAddress(uint32_t romAddr) if (nEntries == 0) { - return NULL; + return nullptr; } for (uint32_t i = nEntries - 1; i-- > 0; ) @@ -82,16 +82,16 @@ DMALOGENTRY* CDMALog::GetEntryByRomAddress(uint32_t romAddr) return &m_Log[i]; } } - return NULL; + return nullptr; } DMALOGENTRY* CDMALog::GetEntryByRomAddress(uint32_t romAddr, uint32_t* lpRamAddr, uint32_t* lpOffset) { DMALOGENTRY* lpEntry = GetEntryByRomAddress(romAddr); - if (lpEntry == NULL) + if (lpEntry == nullptr) { - return NULL; + return nullptr; } *lpOffset = romAddr - lpEntry->romAddr; diff --git a/Source/Project64/UserInterface/Debugger/DebugDialog.h b/Source/Project64/UserInterface/Debugger/DebugDialog.h index f5c400ca0..f0a716819 100644 --- a/Source/Project64/UserInterface/Debugger/DebugDialog.h +++ b/Source/Project64/UserInterface/Debugger/DebugDialog.h @@ -14,7 +14,7 @@ protected: static DWORD CreateDebuggerWindow(CDebugDialog * pThis) { - pThis->DoModal(NULL); + pThis->DoModal(nullptr); pThis->WindowCreated(); return 0; } @@ -44,11 +44,11 @@ protected: int nParams = sscanf(str.c_str(), "%d,%d,%d,%d", &left, &top, &width, &height); if (nParams == 4) { - pT->SetWindowPos(NULL, left, top, width, height, 0); + pT->SetWindowPos(nullptr, left, top, width, height, 0); pT->RedrawWindow(); } if (nParams == 2) { - pT->SetWindowPos(NULL, left, top, width, height, 1); + pT->SetWindowPos(nullptr, left, top, width, height, 1); pT->RedrawWindow(); } } @@ -74,8 +74,8 @@ protected: public: CDebugDialog(CDebuggerUI * debugger) : m_Debugger(debugger), - m_CreatedEvent(CreateEvent(NULL, true, false, NULL)), - m_DialogThread(NULL) + m_CreatedEvent(CreateEvent(nullptr, true, false, nullptr)), + m_DialogThread(nullptr) { } virtual ~CDebugDialog(void) @@ -85,7 +85,7 @@ public: if (m_DialogThread) { CloseHandle(m_DialogThread); - m_DialogThread = NULL; + m_DialogThread = nullptr; } } @@ -104,17 +104,17 @@ public: TerminateThread(m_DialogThread, 1); } CloseHandle(m_DialogThread); - m_DialogThread = NULL; + m_DialogThread = nullptr; } } void ShowWindow(void) { - if (m_hWnd == NULL) + if (m_hWnd == nullptr) { DWORD ThreadID; ResetEvent(m_CreatedEvent); - m_DialogThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CreateDebuggerWindow, (LPVOID)this, 0, &ThreadID); + m_DialogThread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)CreateDebuggerWindow, (LPVOID)this, 0, &ThreadID); if (WaitForSingleObject(m_CreatedEvent, 20000) == WAIT_TIMEOUT) { WriteTrace(TraceUserInterface, TraceError, "Failed to get window create notification"); @@ -122,7 +122,8 @@ public: } if (m_hWnd) { - if (::IsIconic((HWND)m_hWnd)) { + if (::IsIconic((HWND)m_hWnd)) + { SendMessage(m_hWnd, WM_SYSCOMMAND, SC_RESTORE, NULL); } SetForegroundWindow((HWND)m_hWnd); diff --git a/Source/Project64/UserInterface/Debugger/DebugMMU.cpp b/Source/Project64/UserInterface/Debugger/DebugMMU.cpp index ea7391a65..4b51860aa 100644 --- a/Source/Project64/UserInterface/Debugger/DebugMMU.cpp +++ b/Source/Project64/UserInterface/Debugger/DebugMMU.cpp @@ -8,12 +8,12 @@ uint8_t* CDebugMMU::GetPhysicalPtr(uint32_t paddr, WORD* flags) { - if (g_MMU == NULL) + if (g_MMU == nullptr) { - return NULL; + return nullptr; } - uint8_t* ptr = NULL; + uint8_t* ptr = nullptr; int nbyte = paddr & 3; paddr = paddr & ~3; @@ -33,7 +33,7 @@ uint8_t* CDebugMMU::GetPhysicalPtr(uint32_t paddr, WORD* flags) { uint32_t iplRomOffset = paddr - 0x06000000; - if (g_DDRom != NULL && iplRomOffset < g_DDRom->GetRomSize()) + if (g_DDRom != nullptr && iplRomOffset < g_DDRom->GetRomSize()) { ptr = (uint8_t*)(g_MMU->Rdram() + paddr); } @@ -41,7 +41,7 @@ uint8_t* CDebugMMU::GetPhysicalPtr(uint32_t paddr, WORD* flags) else if (paddr >= 0x10000000 && paddr <= 0x1FBFFFFF) // Cartridge ROM { uint32_t cartRomOffset = paddr - 0x10000000; - if (g_Rom != NULL && cartRomOffset < g_Rom->GetRomSize()) + if (g_Rom != nullptr && cartRomOffset < g_Rom->GetRomSize()) { ptr = (uint8_t*)(g_Rom->GetRomAddress() + cartRomOffset); bCartRom = true; @@ -140,12 +140,12 @@ uint8_t* CDebugMMU::GetPhysicalPtr(uint32_t paddr, WORD* flags) } } - if (ptr == NULL) + if (ptr == nullptr) { - return NULL; + return nullptr; } - if (flags != NULL) + if (flags != nullptr) { *flags = (bCartRom ? PJMEM_CARTROM : 0); } @@ -162,9 +162,9 @@ uint8_t* CDebugMMU::GetPhysicalPtr(uint32_t paddr, WORD* flags) bool CDebugMMU::GetPhysicalByte(uint32_t paddr, uint8_t* value) { - uint8_t* ptr = GetPhysicalPtr(paddr, NULL); + uint8_t* ptr = GetPhysicalPtr(paddr, nullptr); - if (ptr != NULL) + if (ptr != nullptr) { *value = *ptr; return true; @@ -206,7 +206,7 @@ bool CDebugMMU::GetPhysicalByte(uint32_t paddr, uint8_t* value) else { CAudioPlugin* audioPlg = g_Plugins->Audio(); - audioLength = audioPlg->AiReadLength != NULL ? audioPlg->AiReadLength() : 0; + audioLength = audioPlg->AiReadLength != nullptr ? audioPlg->AiReadLength() : 0; } *value = (audioLength >> (24 - nByte * 8)) & 0xFF; @@ -229,7 +229,7 @@ bool CDebugMMU::SetPhysicalByte(uint32_t paddr, uint8_t value) uint8_t* ptr = GetPhysicalPtr(paddr, &flags); bool bCartRom = flags & PJMEM_CARTROM; - if (ptr != NULL) + if (ptr != nullptr) { if (!bCartRom) { diff --git a/Source/Project64/UserInterface/Debugger/DebugMMU.h b/Source/Project64/UserInterface/Debugger/DebugMMU.h index 82f9bf51f..72a7691af 100644 --- a/Source/Project64/UserInterface/Debugger/DebugMMU.h +++ b/Source/Project64/UserInterface/Debugger/DebugMMU.h @@ -66,7 +66,7 @@ public: } private: - uint8_t* GetPhysicalPtr(uint32_t paddr, WORD* flags = NULL); + uint8_t* GetPhysicalPtr(uint32_t paddr, WORD* flags = nullptr); bool GetPhysicalByte(uint32_t paddr, uint8_t* value); bool SetPhysicalByte(uint32_t paddr, uint8_t value); diff --git a/Source/Project64/UserInterface/Debugger/Debugger-AddBreakpoint.cpp b/Source/Project64/UserInterface/Debugger/Debugger-AddBreakpoint.cpp index 8b568d6b6..28d35d59c 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-AddBreakpoint.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-AddBreakpoint.cpp @@ -20,7 +20,7 @@ LRESULT CAddBreakpointDlg::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& { wchar_t addrStr[9]; m_AddressEdit.GetWindowText(addrStr, 9); - uint32_t address = wcstoul(addrStr, NULL, 16); + uint32_t address = wcstoul(addrStr, nullptr, 16); CBreakpoints* breakpoints = m_Debugger->Breakpoints(); diff --git a/Source/Project64/UserInterface/Debugger/Debugger-AddSymbol.cpp b/Source/Project64/UserInterface/Debugger/Debugger-AddSymbol.cpp index 07baa000f..e8870570f 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-AddSymbol.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-AddSymbol.cpp @@ -16,7 +16,7 @@ LRESULT CAddSymbolDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l for (int i = 0;; i++) { const char* typeName = CSymbolTable::m_SymbolTypes[i].name; - if (typeName == NULL) + if (typeName == nullptr) { break; } diff --git a/Source/Project64/UserInterface/Debugger/Debugger-CPULogView.cpp b/Source/Project64/UserInterface/Debugger/Debugger-CPULogView.cpp index c7766267b..42cf13fca 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-CPULogView.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-CPULogView.cpp @@ -5,12 +5,12 @@ #include "Debugger-CPULogView.h" #include -CDebugCPULogView* CDebugCPULogView::_this = NULL; -HHOOK CDebugCPULogView::hWinMessageHook = NULL; +CDebugCPULogView* CDebugCPULogView::_this = nullptr; +HHOOK CDebugCPULogView::hWinMessageHook = nullptr; CDebugCPULogView::CDebugCPULogView(CDebuggerUI* debugger) : CDebugDialog(debugger), - m_CPULogCopy(NULL), + m_CPULogCopy(nullptr), m_LogStartIndex(0), m_RowHeight(13) { @@ -18,7 +18,7 @@ CDebugCPULogView::CDebugCPULogView(CDebuggerUI* debugger) : CDebugCPULogView::~CDebugCPULogView() { - if (m_CPULogCopy != NULL) + if (m_CPULogCopy != nullptr) { delete m_CPULogCopy; } @@ -59,14 +59,14 @@ LRESULT CDebugCPULogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM m_ExportBtn.EnableWindow(false); - if (!bLoggingEnabled && m_CPULogCopy != NULL) + if (!bLoggingEnabled && m_CPULogCopy != nullptr) { m_ExportBtn.EnableWindow(true); } _this = this; DWORD dwThreadID = ::GetCurrentThreadId(); - hWinMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, NULL, dwThreadID); + hWinMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, nullptr, dwThreadID); LoadWindowPos(); WindowCreated(); @@ -84,10 +84,10 @@ LRESULT CDebugCPULogView::OnDestroy(void) m_Scrollbar.Detach(); m_ExportBtn.Detach(); - if (m_CPULogCopy != NULL) + if (m_CPULogCopy != nullptr) { delete m_CPULogCopy; - m_CPULogCopy = NULL; + m_CPULogCopy = nullptr; } return 0; } @@ -154,7 +154,7 @@ LRESULT CDebugCPULogView::OnListDblClicked(NMHDR* pNMHDR) CPUState* state = m_CPULogCopy->GetEntry(m_LogStartIndex + nItem); - if (state == NULL) + if (state == nullptr) { return FALSE; } @@ -266,7 +266,7 @@ void CDebugCPULogView::ToggleLoggingEnabled(void) else { RefreshList(true); - m_ExportBtn.EnableWindow(m_CPULogCopy != NULL); + m_ExportBtn.EnableWindow(m_CPULogCopy != nullptr); } } @@ -274,7 +274,7 @@ void CDebugCPULogView::RefreshList(bool bUpdateBuffer) { if (bUpdateBuffer) { - if (m_CPULogCopy != NULL) + if (m_CPULogCopy != nullptr) { delete m_CPULogCopy; } @@ -282,7 +282,7 @@ void CDebugCPULogView::RefreshList(bool bUpdateBuffer) m_CPULogCopy = m_Debugger->CPULog()->Clone(); } - if (m_CPULogCopy == NULL) + if (m_CPULogCopy == nullptr) { return; } @@ -320,7 +320,7 @@ void CDebugCPULogView::RefreshList(bool bUpdateBuffer) { CPUState* state = m_CPULogCopy->GetEntry(i); - if (state == NULL) + if (state == nullptr) { break; } @@ -332,7 +332,7 @@ void CDebugCPULogView::RefreshList(bool bUpdateBuffer) char* szCommand = (char*)R4300iOpcodeName(state->opcode.Hex, state->pc); char* szCmdName = strtok_s((char*)szCommand, "\t", &tokctx); - char* szCmdArgs = strtok_s(NULL, "\t", &tokctx); + char* szCmdArgs = strtok_s(nullptr, "\t", &tokctx); m_CPUListView.AddItem(nItem, 0, stdstr(szPC).ToUTF16().c_str()); m_CPUListView.AddItem(nItem, 1, stdstr(szCmdName).ToUTF16().c_str()); @@ -348,7 +348,7 @@ void CDebugCPULogView::ShowRegStates(size_t stateIndex) { CPUState* state = m_CPULogCopy->GetEntry(stateIndex); - if (state == NULL) + if (state == nullptr) { return; } @@ -385,7 +385,7 @@ void CDebugCPULogView::ShowRegStates(size_t stateIndex) void CDebugCPULogView::Export(void) { - if (m_CPULogCopy == NULL) + if (m_CPULogCopy == nullptr) { return; } diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp index e7db0302b..8a9286fcf 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp @@ -31,8 +31,8 @@ void CCommandList::Attach(HWND hWndNew) SetColumnWidth(COL_SYMBOL, 180); } -CDebugCommandsView* CDebugCommandsView::_this = NULL; -HHOOK CDebugCommandsView::hWinMessageHook = NULL; +CDebugCommandsView* CDebugCommandsView::_this = nullptr; +HHOOK CDebugCommandsView::hWinMessageHook = nullptr; CDebugCommandsView::CDebugCommandsView(CDebuggerUI * debugger, SyncEvent &StepEvent) : CDebugDialog(debugger), @@ -129,7 +129,7 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA _this = this; DWORD dwThreadID = ::GetCurrentThreadId(); - hWinMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, NULL, dwThreadID); + hWinMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, nullptr, dwThreadID); LoadWindowPos(); RedrawCommandsAndRegisters(); @@ -419,7 +419,7 @@ const char* CDebugCommandsView::GetDataAddressNotes(uint32_t vAddr) case 0xB0000014: return "Header: CRC2"; } - return NULL; + return nullptr; } const char* CDebugCommandsView::GetCodeAddressNotes(uint32_t vAddr) @@ -440,9 +440,9 @@ const char* CDebugCommandsView::GetCodeAddressNotes(uint32_t vAddr) case 0xBFC00380: return "Exception: General (boot)"; } - if (g_MMU == NULL) + if (g_MMU == nullptr) { - return NULL; + return nullptr; } uint8_t* rom = g_Rom->GetRomAddress(); @@ -453,7 +453,7 @@ const char* CDebugCommandsView::GetCodeAddressNotes(uint32_t vAddr) return "Game entry point"; } - return NULL; + return nullptr; } void CDebugCommandsView::ShowAddress(uint32_t address, bool top, bool bUserInput) @@ -540,7 +540,7 @@ void CDebugCommandsView::ShowAddress(uint32_t address, bool top, bool bUserInput char* command = (char*)R4300iOpcodeName(OpCode.Hex, opAddr); char* cmdName = strtok((char*)command, "\t"); - char* cmdArgs = strtok(NULL, "\t"); + char* cmdArgs = strtok(nullptr, "\t"); CSymbol jalSymbol; @@ -556,7 +556,7 @@ void CDebugCommandsView::ShowAddress(uint32_t address, bool top, bool bUserInput } // Detect reads and writes to mapped registers, cart header data, etc. - const char* annotation = NULL; + const char* annotation = nullptr; bool bLoadStoreAnnotation = false; CSymbol memSymbol; @@ -596,7 +596,7 @@ void CDebugCommandsView::ShowAddress(uint32_t address, bool top, bool bUserInput } } - if (annotation == NULL) + if (annotation == nullptr) { annotation = GetCodeAddressNotes(opAddr); } @@ -615,7 +615,7 @@ void CDebugCommandsView::ShowAddress(uint32_t address, bool top, bool bUserInput m_CommandList.AddItem(i, CCommandList::COL_SYMBOL, stdstr(pcSymbol.m_Name).ToUTF16().c_str()); m_bvAnnotatedLines.push_back(false); } - else if (annotation != NULL) + else if (annotation != nullptr) { const char* annotationFormat = bLoadStoreAnnotation ? "// (%s)" : "// %s"; m_CommandList.AddItem(i, CCommandList::COL_SYMBOL, stdstr_f(annotationFormat, annotation).ToUTF16().c_str()); @@ -681,7 +681,7 @@ LRESULT CDebugCommandsView::OnCustomDrawList(NMHDR* pNMHDR) uint32_t nSubItem = pLVCD->iSubItem; uint32_t address = m_StartAddress + (nItem * 4); - uint32_t pc = (g_Reg != NULL) ? g_Reg->m_PROGRAM_COUNTER : 0; + uint32_t pc = (g_Reg != nullptr) ? g_Reg->m_PROGRAM_COUNTER : 0; OPCODE pcOpcode; if (!m_Debugger->DebugLoad_VAddr(pc, pcOpcode.Hex)) @@ -940,7 +940,7 @@ void CDebugCommandsView::DrawBranchArrows(HDC listDC) // Draw outline CPen hPenOutline(CreatePen(PS_SOLID, 3, bgColor)); SelectObject(listDC, hPenOutline); - MoveToEx(listDC, begX - 1, begY, NULL); + MoveToEx(listDC, begX - 1, begY, nullptr); LineTo(listDC, marginX, begY); LineTo(listDC, marginX, endY); if (bEndVisible) @@ -951,7 +951,7 @@ void CDebugCommandsView::DrawBranchArrows(HDC listDC) // Draw fill line CPen hPen(CreatePen(PS_SOLID, 1, color)); SelectObject(listDC, hPen); - MoveToEx(listDC, begX - 1, begY, NULL); + MoveToEx(listDC, begX - 1, begY, nullptr); LineTo(listDC, marginX, begY); LineTo(listDC, marginX, endY); if (bEndVisible) @@ -1100,7 +1100,7 @@ LRESULT CDebugCommandsView::OnForwardButton(WORD /*wNotifyCode*/, WORD /*wID*/, LRESULT CDebugCommandsView::OnViewPCButton(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hwnd*/, BOOL& /*bHandled*/) { - if (g_Reg != NULL && isStepping()) + if (g_Reg != nullptr && isStepping()) { ShowAddress(g_Reg->m_PROGRAM_COUNTER, TRUE); } @@ -1329,7 +1329,7 @@ LRESULT CDebugCommandsView::OnPCChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND m_bIgnorePCChange = false; return 0; } - if (g_Reg != NULL && isStepping()) + if (g_Reg != nullptr && isStepping()) { g_Reg->m_PROGRAM_COUNTER = m_PCEdit.GetValue(); } @@ -1379,7 +1379,7 @@ LRESULT CDebugCommandsView::OnCommandListRightClicked(NMHDR* pNMHDR) return 0; } - HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_OP_POPUP)); + HMENU hMenu = LoadMenu(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDR_OP_POPUP)); HMENU hPopupMenu = GetSubMenu(hMenu, 0); if (m_SelectedOpInfo.IsStaticJump()) @@ -1427,7 +1427,7 @@ LRESULT CDebugCommandsView::OnCommandListRightClicked(NMHDR* pNMHDR) POINT mouse; GetCursorPos(&mouse); - TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN, mouse.x, mouse.y, 0, m_hWnd, NULL); + TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN, mouse.x, mouse.y, 0, m_hWnd, nullptr); DestroyMenu(hMenu); @@ -1647,12 +1647,12 @@ LRESULT CDebugCommandsView::OnRegisterTabChange(NMHDR* /*pNMHDR*/) void CDebugCommandsView::ToggleHistoryButtons() { - if (m_BackButton.m_hWnd != NULL) + if (m_BackButton.m_hWnd != nullptr) { m_BackButton.EnableWindow(m_History.size() != 0 && m_HistoryIndex > 0 ? TRUE : FALSE); } - if (m_ForwardButton.m_hWnd != NULL) + if (m_ForwardButton.m_hWnd != nullptr) { m_ForwardButton.EnableWindow(m_History.size() != 0 && m_HistoryIndex < (int)m_History.size() - 1 ? TRUE : FALSE); } @@ -1704,7 +1704,7 @@ LRESULT CDebugCommandsView::OnOpEditChanged(WORD /*wNotifyCode*/, WORD /*wID*/, wchar_t* text = new wchar_t[length + 1]; m_OpEdit.GetWindowText(text, length + 1); - if (wcschr(text, L'\n') == NULL) + if (wcschr(text, L'\n') == nullptr) { delete[] text; return FALSE; @@ -1723,7 +1723,7 @@ LRESULT CDebugCommandsView::OnOpEditChanged(WORD /*wNotifyCode*/, WORD /*wID*/, wchar_t *tokctx; wchar_t *line = wcstok_s(text, L"\n", &tokctx); - while (line != NULL) + while (line != nullptr) { if (wcslen(line) != 0) { @@ -1745,7 +1745,7 @@ LRESULT CDebugCommandsView::OnOpEditChanged(WORD /*wNotifyCode*/, WORD /*wID*/, } } - line = wcstok_s(NULL, L"\n", &tokctx); + line = wcstok_s(nullptr, L"\n", &tokctx); } ShowAddress(m_StartAddress, TRUE); @@ -1756,7 +1756,7 @@ LRESULT CDebugCommandsView::OnOpEditChanged(WORD /*wNotifyCode*/, WORD /*wID*/, LRESULT CEditOp::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - if (m_CommandsWindow == NULL) + if (m_CommandsWindow == nullptr) { return FALSE; } diff --git a/Source/Project64/UserInterface/Debugger/Debugger-DMALogView.cpp b/Source/Project64/UserInterface/Debugger/Debugger-DMALogView.cpp index 77963e1d1..378a07945 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-DMALogView.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-DMALogView.cpp @@ -38,7 +38,7 @@ bool CDebugDMALogView::FilterEntry(int dmaLogIndex) void CDebugDMALogView::RefreshList() { - if (g_Rom == NULL) + if (g_Rom == nullptr) { return; } @@ -233,7 +233,7 @@ LRESULT CDebugDMALogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM void CDebugDMALogView::RefreshDMALogWindow(bool bReset) { - if (m_hWnd == NULL || m_DMAList.m_hWnd == NULL) + if (m_hWnd == nullptr || m_DMAList.m_hWnd == nullptr) { if (bReset) { @@ -305,12 +305,12 @@ LRESULT CDebugDMALogView::OnRamAddrChanged(WORD /*wNotifyCode*/, WORD /*wID*/, H char szRomAddr[9]; m_DMARamEdit.GetWindowText(szRamAddr, 9); - uint32_t ramAddr = wcstoul(szRamAddr, NULL, 16); + uint32_t ramAddr = wcstoul(szRamAddr, nullptr, 16); uint32_t romAddr, offset; DMALOGENTRY* lpEntry = m_DMALog->GetEntryByRamAddress(ramAddr, &romAddr, &offset); - if (lpEntry != NULL) + if (lpEntry != nullptr) { sprintf(szRomAddr, "%08X", romAddr); stdstr_f blockInfo("Block: %08X -> %08X [%X] +%X", romAddr, ramAddr, lpEntry->length, offset); @@ -339,12 +339,12 @@ LRESULT CDebugDMALogView::OnRomAddrChanged(WORD /*wNotifyCode*/, WORD /*wID*/, H wchar_t szRomAddr[9]; m_DMARomEdit.GetWindowText(szRomAddr, 9); - uint32_t romAddr = wcstoul(szRomAddr, NULL, 16); + uint32_t romAddr = wcstoul(szRomAddr, nullptr, 16); uint32_t ramAddr, offset; DMALOGENTRY* lpEntry = m_DMALog->GetEntryByRomAddress(romAddr, &ramAddr, &offset); - if (lpEntry != NULL) + if (lpEntry != nullptr) { wsprintf(szRamAddr, L"%08X", ramAddr); stdstr blockInfo = stdstr_f("Block: %08X -> %08X [%X] +%X", romAddr, ramAddr, lpEntry->length, offset); diff --git a/Source/Project64/UserInterface/Debugger/Debugger-MemoryDump.cpp b/Source/Project64/UserInterface/Debugger/Debugger-MemoryDump.cpp index abc7aeed4..bf4f50a0f 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-MemoryDump.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-MemoryDump.cpp @@ -158,7 +158,7 @@ bool CDumpMemory::DumpMemory(LPCTSTR FileName, DumpFormat Format, DWORD StartPC, const char* command = R4300iOpcodeName(opcode.Hex, DumpPC); char* cmdName = strtok((char*)command, "\t"); - char* cmdArgs = strtok(NULL, "\t"); + char* cmdArgs = strtok(nullptr, "\t"); cmdArgs = cmdArgs ? cmdArgs : ""; LogFile.LogF("%X: %-15s%s\r\n", DumpPC, cmdName, cmdArgs); diff --git a/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp b/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp index d7baf854b..4a2fc4cdf 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp @@ -2,8 +2,8 @@ #include "DebuggerUI.h" #include "MemoryScanner.h" -CDebugMemorySearch* CDebugMemorySearch::_this = NULL; -HHOOK CDebugMemorySearch::hWinMessageHook = NULL; +CDebugMemorySearch* CDebugMemorySearch::_this = nullptr; +HHOOK CDebugMemorySearch::hWinMessageHook = nullptr; const CSetValueDlg::ComboItem CDebugMemorySearch::ModalChangeTypeItems[] = { { "uint8", ValueType_uint8 }, @@ -17,7 +17,7 @@ const CSetValueDlg::ComboItem CDebugMemorySearch::ModalChangeTypeItems[] = { { "float", ValueType_float }, { "double", ValueType_double }, { "string", ValueType_string }, - { NULL, 0 } + { nullptr, 0 } }; CDebugMemorySearch::CDebugMemorySearch(CDebuggerUI * debugger) : @@ -97,7 +97,7 @@ LRESULT CDebugMemorySearch::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA ::GetWindowRect(GetDlgItem(IDC_SEPARATOR), &m_InitialSeparatorRect); ScreenToClient(&m_InitialSeparatorRect); - uint32_t ramSize = (g_MMU != NULL) ? g_MMU->RdramSize() : 0x00400000; + uint32_t ramSize = (g_MMU != nullptr) ? g_MMU->RdramSize() : 0x00400000; m_AddrStart.SetValue(0x80000000, DisplayMode::AllHex); m_AddrEnd.SetValue(0x80000000 + ramSize - 1, DisplayMode::AllHex); @@ -111,13 +111,13 @@ LRESULT CDebugMemorySearch::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA LoadWindowPos(); WindowCreated(); - m_hCursorSizeNS = LoadCursor(NULL, IDC_SIZENS); + m_hCursorSizeNS = LoadCursor(nullptr, IDC_SIZENS); - SetTimer(TIMER_ID_AUTO_REFRESH, 100, NULL); + SetTimer(TIMER_ID_AUTO_REFRESH, 100, nullptr); _this = this; m_ThreadId = ::GetCurrentThreadId(); - hWinMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, NULL, m_ThreadId); + hWinMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, nullptr, m_ThreadId); GameReset(); @@ -148,7 +148,7 @@ LRESULT CDebugMemorySearch::OnDestroy(void) void CDebugMemorySearch::GameReset(void) { - if (m_hWnd == NULL) + if (m_hWnd == nullptr) { return; } @@ -336,7 +336,7 @@ LRESULT CDebugMemorySearch::OnRdramButton(WORD /*wNotifyCode*/, WORD /*wID*/, HW { bool bPhysicalChecked = (m_PhysicalCheckbox.GetCheck() == BST_CHECKED); uint32_t addrStart = bPhysicalChecked ? 0 : 0x80000000; - uint32_t ramSize = (g_MMU != NULL) ? g_MMU->RdramSize() : 0x00400000; + uint32_t ramSize = (g_MMU != nullptr) ? g_MMU->RdramSize() : 0x00400000; m_AddrStart.SetValue(addrStart, DisplayMode::AllHex); m_AddrEnd.SetValue(addrStart + ramSize - 1, DisplayMode::AllHex); return FALSE; @@ -443,7 +443,7 @@ LRESULT CDebugMemorySearch::OnResultsRClick(LPNMHDR /*lpnmh*/) } // Load the menu - HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MEM_SEARCH)); + HMENU hMenu = LoadMenu(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDR_MEM_SEARCH)); HMENU hPopupMenu = GetSubMenu(hMenu, 0); // Get the current mouse location @@ -451,7 +451,7 @@ LRESULT CDebugMemorySearch::OnResultsRClick(LPNMHDR /*lpnmh*/) GetCursorPos(&Mouse); // Show the menu - TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0, m_hWnd, NULL); + TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0, m_hWnd, nullptr); DestroyMenu(hMenu); return true; } @@ -460,7 +460,7 @@ LRESULT CDebugMemorySearch::OnResultsPopupViewMemory(WORD /*wNotifyCode*/, WORD { CScanResult* presult = GetFirstSelectedScanResult(); - if (presult == NULL) + if (presult == nullptr) { return FALSE; } @@ -503,7 +503,7 @@ LRESULT CDebugMemorySearch::OnResultsPopupSetValue(WORD /*wNotifyCode*/, WORD /* { CScanResult* pFirstResult = GetFirstSelectedScanResult(); - if (pFirstResult == NULL) + if (pFirstResult == nullptr) { return FALSE; } @@ -663,7 +663,7 @@ LRESULT CDebugMemorySearch::OnWatchListDblClick(LPNMHDR /*lpnmh*/) if (m_SetValueDlg.DoModal("Change address", "New address:", stdstr_f("0x%08X", presult->m_Address).c_str())) { std::string szEnteredString = stdstr().FromUTF16(m_SetValueDlg.GetEnteredString()); - uint32_t newAddr = strtoul(szEnteredString.c_str(), NULL, 0); + uint32_t newAddr = strtoul(szEnteredString.c_str(), nullptr, 0); if (presult->SetAddressSafe(newAddr)) { m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Address, stdstr_f("0x%08X", newAddr).ToUTF16().c_str()); @@ -733,7 +733,7 @@ LRESULT CDebugMemorySearch::OnWatchListRClick(LPNMHDR /*lpnmh*/) CScanResult *presult = &m_WatchList[index]; // Load the menu - HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MEM_WATCHLIST)); + HMENU hMenu = LoadMenu(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDR_MEM_WATCHLIST)); HMENU hPopupMenu = GetSubMenu(hMenu, 0); // Get the current mouse location @@ -753,7 +753,7 @@ LRESULT CDebugMemorySearch::OnWatchListRClick(LPNMHDR /*lpnmh*/) CheckMenuItem(hPopupMenu, ID_WATCHLIST_HEXADECIMAL, bHex ? MF_CHECKED : MF_UNCHECKED); // Show the menu - TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0, m_hWnd, NULL); + TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0, m_hWnd, nullptr); DestroyMenu(hMenu); return true; } @@ -762,7 +762,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupViewMemory(WORD /*wNotifyCode*/, WOR { CScanResult* presult = GetFirstSelectedWatchListResult(); - if (presult == NULL) + if (presult == nullptr) { return FALSE; } @@ -794,7 +794,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupReadBP(WORD /*wNotifyCode*/, WORD /* { CScanResult* presult = GetFirstSelectedWatchListResult(); - if (presult == NULL) + if (presult == nullptr) { return FALSE; } @@ -807,7 +807,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupWriteBP(WORD /*wNotifyCode*/, WORD / { CScanResult* presult = GetFirstSelectedWatchListResult(); - if (presult == NULL) + if (presult == nullptr) { return FALSE; } @@ -820,7 +820,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupAddSymbol(WORD /*wNotifyCode*/, WORD { CScanResult* presult = GetFirstSelectedWatchListResult(); - if (presult == NULL) + if (presult == nullptr) { return FALSE; } @@ -877,7 +877,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeValue(WORD /*wNotifyCode*/, WO { CScanResult* pFirstResult = GetFirstSelectedWatchListResult(); - if (pFirstResult == NULL) + if (pFirstResult == nullptr) { return FALSE; } @@ -911,7 +911,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeDescription(WORD /*wNotifyCode { CScanResult* pFirstResult = GetFirstSelectedWatchListResult(); - if (pFirstResult == NULL) + if (pFirstResult == nullptr) { return FALSE; } @@ -941,7 +941,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeType(WORD /*wNotifyCode*/, WOR { CScanResult* pFirstResult = GetFirstSelectedWatchListResult(); - if (pFirstResult == NULL) + if (pFirstResult == nullptr) { return FALSE; } @@ -998,7 +998,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeAddress(WORD /*wNotifyCode*/, { CScanResult* pFirstResult = GetFirstSelectedWatchListResult(); - if (pFirstResult == NULL) + if (pFirstResult == nullptr) { return FALSE; } @@ -1006,7 +1006,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeAddress(WORD /*wNotifyCode*/, if (m_SetValueDlg.DoModal("Change address", "New address:", stdstr_f("0x%08X", pFirstResult->m_Address).c_str())) { stdstr enteredString = stdstr().FromUTF16(m_SetValueDlg.GetEnteredString()); - uint32_t newAddr = strtoul(enteredString.c_str(), NULL, 0); + uint32_t newAddr = strtoul(enteredString.c_str(), nullptr, 0); stdstr newAddrStr = stdstr_f("0x%08X", newAddr); int nItems = m_WatchListCtrl.GetItemCount(); @@ -1031,7 +1031,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeAddressBy(WORD /*wNotifyCode*/ { CScanResult* pFirstResult = GetFirstSelectedWatchListResult(); - if (pFirstResult == NULL) + if (pFirstResult == nullptr) { return FALSE; } @@ -1310,9 +1310,9 @@ void CDebugMemorySearch::OnInterceptMouseMove(WPARAM /*wParam*/, LPARAM /*lParam HWND hSeparator = GetDlgItem(IDC_SEPARATOR); ::GetWindowRect(hSeparator, &sepRect); ScreenToClient(&sepRect); - ::SetWindowPos(hSeparator, NULL, sepRect.left, cursorPos.y, 0, 0, + ::SetWindowPos(hSeparator, nullptr, sepRect.left, cursorPos.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER); - ::InvalidateRect(hSeparator, NULL, true); + ::InvalidateRect(hSeparator, nullptr, true); // Move and resize controls SeparatorMoveCtrl(IDC_LST_WATCHLIST, yChange, false); @@ -1400,7 +1400,7 @@ CScanResult* CDebugMemorySearch::GetFirstSelectedScanResult(void) if (iItem == -1) { - return NULL; + return nullptr; } int index = m_ResultsListCtrl.GetItemData(iItem); @@ -1414,7 +1414,7 @@ CScanResult* CDebugMemorySearch::GetFirstSelectedWatchListResult(void) if (iItem == -1) { - return NULL; + return nullptr; } int index = m_WatchListCtrl.GetItemData(iItem); @@ -1468,16 +1468,16 @@ void CDebugMemorySearch::SeparatorMoveCtrl(WORD ctrlId, int yChange, bool bResiz if (bResize) // Resize control { - ::SetWindowPos(hControl, NULL, 0, 0, rect.Width(), rect.Height() + yChange, + ::SetWindowPos(hControl, nullptr, 0, 0, rect.Width(), rect.Height() + yChange, SWP_NOMOVE | SWP_NOZORDER); } else // Move control { - ::SetWindowPos(hControl, NULL, rect.left, rect.top + yChange, 0, 0, + ::SetWindowPos(hControl, nullptr, rect.left, rect.top + yChange, 0, 0, SWP_NOSIZE | SWP_NOZORDER); } - ::InvalidateRect(hControl, NULL, true); + ::InvalidateRect(hControl, nullptr, true); } int CDebugMemorySearch::GetNumVisibleRows(CListViewCtrl& list) @@ -1929,7 +1929,7 @@ void CDebugMemorySearch::RefreshResultsListValues(void) size_t index = m_ResultsListCtrl.GetItemData(nItem); CScanResult *presult = m_MemoryScanner.GetResult(index); - if (presult == NULL) + if (presult == nullptr) { g_Notify->BreakPoint(__FILE__, __LINE__); break; @@ -2083,7 +2083,7 @@ void CDebugMemorySearch::LoadWatchList(void) default: goto parse_error; } - uint32_t address = strtoul(szAddress, NULL, 16); + uint32_t address = strtoul(szAddress, nullptr, 16); result.m_Address = address; ValueType type; @@ -2222,7 +2222,7 @@ LRESULT CSetValueDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lP { m_Value.ShowWindow(SW_HIDE); - for (int i = 0; m_ComboItems[i].str != NULL; i++) + for (int i = 0; m_ComboItems[i].str != nullptr; i++) { int idx = m_CmbValue.AddString(stdstr(m_ComboItems[i].str).ToUTF16().c_str()); m_CmbValue.SetItemData(idx, m_ComboItems[i].data); @@ -2246,10 +2246,10 @@ LRESULT CSetValueDlg::OnDestroy(void) LRESULT CSetValueDlg::OnOK(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hwnd*/, BOOL& /*bHandled*/) { - if (m_EnteredString != NULL) + if (m_EnteredString != nullptr) { delete[] m_EnteredString; - m_EnteredString = NULL; + m_EnteredString = nullptr; } if (m_Mode == Mode_TextBox) @@ -2278,26 +2278,26 @@ LRESULT CSetValueDlg::OnCancel(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hwnd*/ } CSetValueDlg::CSetValueDlg(void) : - m_EnteredString(NULL) + m_EnteredString(nullptr) { } CSetValueDlg::~CSetValueDlg(void) { - if (m_EnteredString != NULL) + if (m_EnteredString != nullptr) { delete[] m_EnteredString; } } CEditMixed::CEditMixed(void) : - m_String(NULL) + m_String(nullptr) { } CEditMixed::~CEditMixed(void) { - if (m_String != NULL) + if (m_String != nullptr) { delete[] m_String; } @@ -2315,7 +2315,7 @@ void CEditMixed::SetDisplayFormat(DisplayFormat fmt) void CEditMixed::ReloadString(void) { - if (m_String != NULL) + if (m_String != nullptr) { delete[] m_String; } @@ -2536,7 +2536,7 @@ bool CEditMixed::GetValueHexString(const wchar_t*& value, int& length) } stdstr string = stdstr().FromUTF16(m_String); - int numBytes = CMemoryScanner::ParseHexString(NULL, string.c_str()); + int numBytes = CMemoryScanner::ParseHexString(nullptr, string.c_str()); if (numBytes == 0) { diff --git a/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.cpp b/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.cpp index f9e5f2d69..a78a91192 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.cpp @@ -4,7 +4,7 @@ #include "OpInfo.h" bool CRegisterTabs::m_bColorsEnabled = false; -CDebuggerUI* CRegisterTabs::m_Debugger = NULL; +CDebuggerUI* CRegisterTabs::m_Debugger = nullptr; CRegisterTabs::CRegisterTabs() : m_attached(false) @@ -74,19 +74,19 @@ void CRegisterTabs::Attach(HWND hWndNew, CDebuggerUI* debugger) HWND CRegisterTabs::Detach(void) { m_attached = false; - m_GPRTab = NULL; - m_FPRTab = NULL; - m_COP0Tab = NULL; - m_RDRAMTab = NULL; - m_SPTab = NULL; - m_DPCTab = NULL; - m_MITab = NULL; - m_VITab = NULL; - m_AITab = NULL; - m_PITab = NULL; - m_RITab = NULL; - m_SITab = NULL; - m_DDTab = NULL; + m_GPRTab = nullptr; + m_FPRTab = nullptr; + m_COP0Tab = nullptr; + m_RDRAMTab = nullptr; + m_SPTab = nullptr; + m_DPCTab = nullptr; + m_MITab = nullptr; + m_VITab = nullptr; + m_AITab = nullptr; + m_PITab = nullptr; + m_RITab = nullptr; + m_SITab = nullptr; + m_DDTab = nullptr; for (size_t i = 0; i < m_TabWindows.size(); i++) { m_TabWindows[i].DestroyWindow(); @@ -94,12 +94,12 @@ HWND CRegisterTabs::Detach(void) m_TabWindows.clear(); m_CauseTip.Detach(); CTabCtrl::Detach(); - return NULL; + return nullptr; } void CRegisterTabs::RefreshEdits() { - if (g_Reg == NULL) + if (g_Reg == nullptr) { ZeroRegisterEdits64(m_GPREdits, TabData::GPR.FieldCount); ZeroRegisterEdit64(m_HIEdit); @@ -265,7 +265,7 @@ void CRegisterTabs::RefreshEdits() void CRegisterTabs::RegisterChanged(HWND hDlg, TAB_ID srcTabId, WPARAM wParam) { - if (g_Reg == NULL || !isStepping()) + if (g_Reg == nullptr || !isStepping()) { return; } @@ -295,7 +295,7 @@ void CRegisterTabs::RegisterChanged(HWND hDlg, TAB_ID srcTabId, WPARAM wParam) return; } - uint32_t value = wcstoul(text, NULL, 16); + uint32_t value = wcstoul(text, nullptr, 16); wsprintf(text, L"%08X", value); editCtrl.SetWindowText(text); // Reformat text @@ -451,7 +451,7 @@ INT_PTR CALLBACK CRegisterTabs::TabProcDefault(HWND hDlg, UINT msg, WPARAM wPara if (msg == WM_COMMAND && HIWORD(wParam) == EN_KILLFOCUS) { bool * attached = (bool *)GetProp(hDlg, L"attached"); - if (attached != NULL && *attached) + if (attached != nullptr && *attached) { RegisterChanged(hDlg, TabDefault, wParam); } @@ -478,7 +478,7 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L COLORREF colorWrite = RGB(255, 200, 200); COLORREF colorBoth = RGB(220, 170, 255); - if (!m_bColorsEnabled || g_Reg == NULL || g_MMU == NULL) + if (!m_bColorsEnabled || g_Reg == nullptr || g_MMU == nullptr) { return FALSE; } @@ -541,7 +541,7 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L if (msg == WM_COMMAND && HIWORD(wParam) == EN_KILLFOCUS) { bool * attached = (bool *)GetProp(hDlg, L"attached"); - if (attached != NULL && *attached) + if (attached != nullptr && *attached) { RegisterChanged(hDlg, TabGPR, wParam); } @@ -552,7 +552,7 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L // Right click labels if (msg == WM_CONTEXTMENU) { - if (m_Debugger == NULL) + if (m_Debugger == nullptr) { return FALSE; } @@ -582,14 +582,14 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L breakpoints->ToggleGPRWriteBP(nReg); } - ::InvalidateRect(hWnd, NULL, true); + ::InvalidateRect(hWnd, nullptr, true); return FALSE; } // Click labels if (msg == WM_COMMAND && HIWORD(wParam) == STN_CLICKED || HIWORD(wParam) == STN_DBLCLK) { - if (m_Debugger == NULL) + if (m_Debugger == nullptr) { return FALSE; } @@ -619,14 +619,14 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L breakpoints->ToggleGPRReadBP(nReg); } - ::InvalidateRect(hWnd, NULL, true); + ::InvalidateRect(hWnd, nullptr, true); return FALSE; } // Color labels if (msg == WM_CTLCOLORSTATIC) { - if (m_Debugger == NULL) + if (m_Debugger == nullptr) { return FALSE; } @@ -701,7 +701,7 @@ INT_PTR CALLBACK CRegisterTabs::TabProcFPR(HWND hDlg, UINT msg, WPARAM wParam, L if (msg == WM_COMMAND && HIWORD(wParam) == EN_KILLFOCUS) { bool * attached = (bool *)GetProp(hDlg, L"attached"); - if (attached != NULL && *attached) + if (attached != nullptr && *attached) { RegisterChanged(hDlg, TabFPR, wParam); } @@ -724,7 +724,7 @@ CWindow CRegisterTabs::AddTab(char* caption, int dialogId, DLGPROC dlgProc) AddItem(stdstr(caption).ToUTF16().c_str()); CWindow parentWin = GetParent(); - CWindow tabWin = ::CreateDialogParam(NULL, MAKEINTRESOURCE(dialogId), parentWin, dlgProc, (LPARAM)&m_attached); + CWindow tabWin = ::CreateDialogParam(nullptr, MAKEINTRESOURCE(dialogId), parentWin, dlgProc, (LPARAM)&m_attached); CRect pageRect = GetPageRect(); @@ -952,12 +952,12 @@ uint64_t CEditReg64::ParseValue(const char* wordPair) { uint32_t a, b; uint64_t ret; - char * end = NULL; + char * end = nullptr; a = strtoul(wordPair, &end, 16); if (*end == ' ') { end++; - b = strtoul(end, NULL, 16); + b = strtoul(end, nullptr, 16); ret = (uint64_t)a << 32; ret |= b; return ret; @@ -1008,7 +1008,7 @@ LRESULT CEditReg64::OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandl } } - if (charCode == ' ' && wcschr(text, ' ') != NULL) + if (charCode == ' ' && wcschr(text, ' ') != nullptr) { goto canceled; } diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp index 00c7b4079..0431ceae7 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp @@ -5,8 +5,8 @@ CDebugScripts::CDebugScripts(CDebuggerUI* debugger) : CDebugDialog(debugger), CToolTipDialog(), - m_hQuitScriptDirWatchEvent(NULL), - m_hScriptDirWatchThread(NULL) + m_hQuitScriptDirWatchEvent(nullptr), + m_hScriptDirWatchThread(nullptr) { } @@ -52,8 +52,8 @@ LRESULT CDebugScripts::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l LoadWindowPos(); WindowCreated(); - m_hQuitScriptDirWatchEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - m_hScriptDirWatchThread = CreateThread(NULL, 0, ScriptDirWatchProc, (void*)this, 0, NULL); + m_hQuitScriptDirWatchEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); + m_hScriptDirWatchThread = CreateThread(nullptr, 0, ScriptDirWatchProc, (void*)this, 0, nullptr); return 0; } @@ -148,7 +148,7 @@ void CDebugScripts::ConsoleCopy() void CDebugScripts::ConsolePrint(const char* text) { - if (m_hWnd != NULL) + if (m_hWnd != nullptr) { SendMessage(WM_CONSOLE_PRINT, (WPARAM)text); } @@ -156,7 +156,7 @@ void CDebugScripts::ConsolePrint(const char* text) void CDebugScripts::ConsoleClear() { - if (m_hWnd != NULL) + if (m_hWnd != nullptr) { SendMessage(WM_CONSOLE_CLEAR); } @@ -164,7 +164,7 @@ void CDebugScripts::ConsoleClear() void CDebugScripts::RefreshList() { - if (m_hWnd != NULL) + if (m_hWnd != nullptr) { PostMessage(WM_REFRESH_LIST); } @@ -195,7 +195,7 @@ LRESULT CDebugScripts::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl* ConsoleCopy(); break; case IDC_SCRIPTDIR_BTN: - ShellExecute(NULL, L"open", L"Scripts", NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"open", L"Scripts", nullptr, nullptr, SW_SHOW); break; } return FALSE; @@ -253,7 +253,7 @@ LRESULT CDebugScripts::OnScriptListRClicked(NMHDR* pNMHDR) INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName.c_str()); - HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_SCRIPT_POPUP)); + HMENU hMenu = LoadMenu(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDR_SCRIPT_POPUP)); HMENU hPopupMenu = GetSubMenu(hMenu, 0); if (state == STATE_STARTED || state == STATE_RUNNING) @@ -267,7 +267,7 @@ LRESULT CDebugScripts::OnScriptListRClicked(NMHDR* pNMHDR) POINT mouse; GetCursorPos(&mouse); - TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN, mouse.x, mouse.y, 0, m_hWnd, NULL); + TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN, mouse.x, mouse.y, 0, m_hWnd, nullptr); DestroyMenu(hMenu); return 0; @@ -464,7 +464,7 @@ void CDebugScripts::ToggleSelected() void CDebugScripts::EditSelected() { - ShellExecute(NULL, L"edit", stdstr(m_SelectedScriptName).ToUTF16().c_str(), NULL, L"Scripts", SW_SHOWNORMAL); + ShellExecute(nullptr, L"edit", stdstr(m_SelectedScriptName).ToUTF16().c_str(), nullptr, L"Scripts", SW_SHOWNORMAL); } // Console input @@ -498,7 +498,7 @@ LRESULT CEditEval::OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BO } else if (wParam == VK_RETURN) { - if (m_ScriptWindow == NULL) + if (m_ScriptWindow == nullptr) { bHandled = FALSE; return 0; diff --git a/Source/Project64/UserInterface/Debugger/Debugger-StackView.cpp b/Source/Project64/UserInterface/Debugger/Debugger-StackView.cpp index 8634fc560..da539bb26 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-StackView.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-StackView.cpp @@ -55,7 +55,7 @@ LRESULT CDebugStackView::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCt switch (wID) { case IDC_MEM_BTN: - if (g_Reg != NULL) + if (g_Reg != nullptr) { m_Debugger->Debug_ShowMemoryLocation(g_Reg->m_GPR[29].UW[0], true); } @@ -69,7 +69,7 @@ LRESULT CDebugStackView::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCt void CDebugStackView::Refresh() { - if (g_Reg == NULL) + if (g_Reg == nullptr) { return; } diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Symbols.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Symbols.cpp index e4e2eb130..61a0a1c04 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Symbols.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Symbols.cpp @@ -21,7 +21,7 @@ const CSetValueDlg::ComboItem CDebugSymbols::ModalChangeTypeItems[] = { { "v2", SYM_VECTOR2 }, { "v3", SYM_VECTOR3 }, { "v4", SYM_VECTOR4 }, - { NULL, 0 } + { nullptr, 0 } }; CDebugSymbols::CDebugSymbols(CDebuggerUI * debugger) : @@ -51,7 +51,7 @@ LRESULT CDebugSymbols::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l Refresh(); - SetTimer(TIMER_ID_AUTO_REFRESH, 100, NULL); + SetTimer(TIMER_ID_AUTO_REFRESH, 100, nullptr); LoadWindowPos(); WindowCreated(); @@ -106,7 +106,7 @@ LRESULT CDebugSymbols::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl* LRESULT CDebugSymbols::OnListDblClicked(NMHDR* pNMHDR) { - if (g_MMU == NULL) + if (g_MMU == nullptr) { return true; } @@ -287,7 +287,7 @@ LRESULT CDebugSymbols::OnListDblClicked(NMHDR* pNMHDR) void CDebugSymbols::Refresh() { - if (m_SymbolsListView.m_hWnd == NULL) + if (m_SymbolsListView.m_hWnd == nullptr) { return; } @@ -319,7 +319,7 @@ void CDebugSymbols::Refresh() void CDebugSymbols::RefreshValues() { - if (g_MMU == NULL) + if (g_MMU == nullptr) { return; } diff --git a/Source/Project64/UserInterface/Debugger/Debugger-TLB.cpp b/Source/Project64/UserInterface/Debugger/Debugger-TLB.cpp index 566ab9b34..26e9a1062 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-TLB.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-TLB.cpp @@ -100,7 +100,7 @@ LRESULT CDebugTlb::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& /*bHand void CDebugTlb::RefreshTLBWindow(void) { - if (m_hWnd == NULL) + if (m_hWnd == nullptr) { return; } diff --git a/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.cpp b/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.cpp index 373351678..be9a51cfb 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.cpp @@ -34,7 +34,7 @@ CDebugMemoryView::CDebugMemoryView(CDebuggerUI * debugger) : CDebugDialog(debugger), CDialogResize(), CToolTipDialog(), - m_Breakpoints(NULL), + m_Breakpoints(nullptr), m_WriteTargetColorStride(0), m_ReadTargetColorStride(0), m_SymbolColorStride(0), @@ -54,7 +54,7 @@ CDebugMemoryView::~CDebugMemoryView() void CDebugMemoryView::ShowAddress(uint32_t address, bool bVirtual) { - if (m_hWnd == NULL) + if (m_hWnd == nullptr) { return; } @@ -268,7 +268,7 @@ void CDebugMemoryView::SetupJumpMenu(bool bVirtual) { jump_item_t* item = &JumpItems[i]; - if (item->caption == NULL) + if (item->caption == nullptr) { break; } @@ -283,7 +283,7 @@ int CDebugMemoryView::GetJumpItemIndex(uint32_t address, bool bVirtual) { for (int nItem = 0;; nItem++) { - if (JumpItems[nItem].caption == NULL) + if (JumpItems[nItem].caption == nullptr) { break; } @@ -606,7 +606,7 @@ LRESULT CDebugMemoryView::OnHxCtrlKeyPressed(LPNMHDR lpNMHDR) LRESULT CDebugMemoryView::OnHxSetNibble(LPNMHDR lpNMHDR) { - if (g_MMU == NULL) + if (g_MMU == nullptr) { return FALSE; } @@ -645,7 +645,7 @@ LRESULT CDebugMemoryView::OnHxSetByte(LPNMHDR lpNMHDR) { NMHXSETBYTE* nmsb = reinterpret_cast(lpNMHDR); - if (g_MMU == NULL) + if (g_MMU == nullptr) { return FALSE; } @@ -706,7 +706,7 @@ LRESULT CDebugMemoryView::OnHxSelectionChanged(LPNMHDR /*lpNMHDR*/) uint32_t romAddr, offset; DMALOGENTRY* entry = m_Debugger->DMALog()->GetEntryByRamAddress(startAddress, &romAddr, &offset); - m_StatusBar.SetText(MEMSB_DMAINFO, entry != NULL ? L"Have DMA" : L""); + m_StatusBar.SetText(MEMSB_DMAINFO, entry != nullptr ? L"Have DMA" : L""); return FALSE; } @@ -773,7 +773,7 @@ LRESULT CDebugMemoryView::OnHxGetByteInfo(LPNMHDR lpNMHDR) newByte->bkColor = BKCOLOR_DEFAULT; newByte->color = COLOR_DEFAULT; - if (m_bVirtualMemory && (g_MMU == NULL || !g_MMU->TranslateVaddr(address, paddress))) + if (m_bVirtualMemory && (g_MMU == nullptr || !g_MMU->TranslateVaddr(address, paddress))) { newByte->bValid = false; continue; @@ -843,7 +843,7 @@ LRESULT CDebugMemoryView::OnHxGetByteInfo(LPNMHDR lpNMHDR) newByte->bkColor = m_SymbolColorPhase ? BKCOLOR_SYMBOL0 : BKCOLOR_SYMBOL1; } - if (g_Rom != NULL && paddress >= 0x10000000 && paddress < 0x10000000 + g_Rom->GetRomSize()) + if (g_Rom != nullptr && paddress >= 0x10000000 && paddress < 0x10000000 + g_Rom->GetRomSize()) { newByte->color = COLOR_READONLY; } @@ -889,7 +889,7 @@ LRESULT CDebugMemoryView::OnHxRightClick(LPNMHDR lpNMHDR) m_ContextMenuAddress = nmrc->address; - HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MEM_BP_POPUP)); + HMENU hMenu = LoadMenu(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDR_MEM_BP_POPUP)); HMENU hPopupMenu = GetSubMenu(hMenu, 0); bool bHaveLock = m_Breakpoints->MemLockExists(m_ContextMenuAddress, 1); @@ -912,7 +912,7 @@ LRESULT CDebugMemoryView::OnHxRightClick(LPNMHDR lpNMHDR) POINT mouse; GetCursorPos(&mouse); - TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN, mouse.x, mouse.y, 0, m_hWnd, NULL); + TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN, mouse.x, mouse.y, 0, m_hWnd, nullptr); DestroyMenu(hMenu); return FALSE; } @@ -960,7 +960,7 @@ LRESULT CDebugMemoryView::OnHxPaste(LPNMHDR lpNMHDR) { NMHXPASTE *nmp = reinterpret_cast(lpNMHDR); - if (g_MMU == NULL) + if (g_MMU == nullptr) { return FALSE; } @@ -972,9 +972,9 @@ LRESULT CDebugMemoryView::OnHxPaste(LPNMHDR lpNMHDR) if (nmp->column == HX_COL_HEXDATA) { - char* data = NULL; + char* data = nullptr; // TODO: move this function to some utility class - int length = CMemoryScanner::ParseHexString(NULL, text); + int length = CMemoryScanner::ParseHexString(nullptr, text); if (length != 0) { @@ -1187,7 +1187,7 @@ LRESULT CDebugMemoryView::OnStatusBarClick(LPNMHDR lpNMHDR) uint32_t romAddress, blockOffset; DMALOGENTRY* entry = m_Debugger->DMALog()->GetEntryByRamAddress(startAddress, &romAddress, &blockOffset); - if (entry == NULL) + if (entry == nullptr) { return FALSE; } diff --git a/Source/Project64/UserInterface/Debugger/Debugger.cpp b/Source/Project64/UserInterface/Debugger/Debugger.cpp index 2b9559544..80f7fdabb 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger.cpp @@ -9,23 +9,23 @@ CPj64Module _Module; CDebuggerUI::CDebuggerUI() : - m_MemoryDump(NULL), - m_MemoryView(NULL), - m_MemorySearch(NULL), - m_DebugTLB(NULL), - m_CommandsView(NULL), - m_Scripts(NULL), - m_Symbols(NULL), - m_Breakpoints(NULL), - m_ScriptSystem(NULL), - m_StackTrace(NULL), - m_StackView(NULL), - m_DMALogView(NULL), - m_CPULogView(NULL), - m_ExcBreakpoints(NULL), - m_DMALog(NULL), - m_CPULog(NULL), - m_SymbolTable(NULL), + m_MemoryDump(nullptr), + m_MemoryView(nullptr), + m_MemorySearch(nullptr), + m_DebugTLB(nullptr), + m_CommandsView(nullptr), + m_Scripts(nullptr), + m_Symbols(nullptr), + m_Breakpoints(nullptr), + m_ScriptSystem(nullptr), + m_StackTrace(nullptr), + m_StackView(nullptr), + m_DMALogView(nullptr), + m_CPULogView(nullptr), + m_ExcBreakpoints(nullptr), + m_DMALog(nullptr), + m_CPULog(nullptr), + m_SymbolTable(nullptr), m_StepEvent(false) { g_Debugger = this; @@ -132,83 +132,83 @@ void CDebuggerUI::Debug_Reset(void) { m_MemoryDump->HideWindow(); delete m_MemoryDump; - m_MemoryDump = NULL; + m_MemoryDump = nullptr; } if (m_MemorySearch) { m_MemorySearch->HideWindow(); delete m_MemorySearch; - m_MemorySearch = NULL; + m_MemorySearch = nullptr; } if (m_DebugTLB) { m_DebugTLB->HideWindow(); delete m_DebugTLB; - m_DebugTLB = NULL; + m_DebugTLB = nullptr; } if (m_MemoryView) { m_MemoryView->HideWindow(); delete m_MemoryView; - m_MemoryView = NULL; + m_MemoryView = nullptr; } if (m_CommandsView) { m_CommandsView->HideWindow(); delete m_CommandsView; - m_CommandsView = NULL; + m_CommandsView = nullptr; } if (m_Scripts) { m_Scripts->HideWindow(); delete m_Scripts; - m_Scripts = NULL; + m_Scripts = nullptr; } if (m_Symbols) { m_Symbols->HideWindow(); delete m_Symbols; - m_Symbols = NULL; + m_Symbols = nullptr; } if (m_DMALogView) { m_DMALogView->HideWindow(); delete m_DMALogView; - m_DMALogView = NULL; + m_DMALogView = nullptr; } if (m_CPULogView) { m_CPULogView->HideWindow(); delete m_CPULogView; - m_CPULogView = NULL; + m_CPULogView = nullptr; } if (m_StackTrace) { m_StackTrace->HideWindow(); delete m_StackTrace; - m_StackTrace = NULL; + m_StackTrace = nullptr; } if (m_StackView) { m_StackView->HideWindow(); delete m_StackView; - m_StackView = NULL; + m_StackView = nullptr; } if (m_ExcBreakpoints) { m_ExcBreakpoints->HideWindow(); delete m_ExcBreakpoints; - m_ExcBreakpoints = NULL; + m_ExcBreakpoints = nullptr; } } void CDebuggerUI::OpenMemoryDump() { - if (g_MMU == NULL) + if (g_MMU == nullptr) { return; } - if (m_MemoryDump == NULL) + if (m_MemoryDump == nullptr) { m_MemoryDump = new CDumpMemory(this); } @@ -220,7 +220,7 @@ void CDebuggerUI::OpenMemoryDump() void CDebuggerUI::OpenMemoryWindow(void) { - if (m_MemoryView == NULL) + if (m_MemoryView == nullptr) { m_MemoryView = new CDebugMemoryView(this); } @@ -241,11 +241,11 @@ void CDebuggerUI::Debug_ShowMemoryLocation(uint32_t Address, bool VAddr) void CDebuggerUI::OpenTLBWindow(void) { - if (g_MMU == NULL) + if (g_MMU == nullptr) { return; } - if (m_DebugTLB == NULL) + if (m_DebugTLB == nullptr) { m_DebugTLB = new CDebugTlb(this); } @@ -273,7 +273,7 @@ void CDebuggerUI::Debug_RefreshDMALogWindow(void) void CDebuggerUI::OpenMemorySearch() { - if (m_MemorySearch == NULL) + if (m_MemorySearch == nullptr) { m_MemorySearch = new CDebugMemorySearch(this); } @@ -285,7 +285,7 @@ void CDebuggerUI::OpenMemorySearch() void CDebuggerUI::OpenCommandWindow() { - if (m_CommandsView == NULL) + if (m_CommandsView == nullptr) { m_CommandsView = new CDebugCommandsView(this, m_StepEvent); } @@ -303,7 +303,7 @@ void CDebuggerUI::Debug_ShowCommandsLocation(uint32_t address, bool top) void CDebuggerUI::OpenScriptsWindow() { - if (m_Scripts == NULL) + if (m_Scripts == nullptr) { m_Scripts = new CDebugScripts(this); } @@ -312,7 +312,7 @@ void CDebuggerUI::OpenScriptsWindow() void CDebuggerUI::Debug_RefreshScriptsWindow() { - if (m_Scripts != NULL) + if (m_Scripts != nullptr) { m_Scripts->RefreshList(); } @@ -320,7 +320,7 @@ void CDebuggerUI::Debug_RefreshScriptsWindow() void CDebuggerUI::Debug_LogScriptsWindow(const char* text) { - if (m_Scripts != NULL) + if (m_Scripts != nullptr) { m_Scripts->ConsolePrint(text); } @@ -328,7 +328,7 @@ void CDebuggerUI::Debug_LogScriptsWindow(const char* text) void CDebuggerUI::Debug_ClearScriptsWindow() { - if (m_Scripts != NULL) + if (m_Scripts != nullptr) { m_Scripts->ConsoleClear(); } @@ -336,7 +336,7 @@ void CDebuggerUI::Debug_ClearScriptsWindow() void CDebuggerUI::OpenSymbolsWindow() { - if (m_Symbols == NULL) + if (m_Symbols == nullptr) { m_Symbols = new CDebugSymbols(this); } @@ -345,7 +345,7 @@ void CDebuggerUI::OpenSymbolsWindow() void CDebuggerUI::Debug_RefreshSymbolsWindow() { - if (m_Symbols != NULL) + if (m_Symbols != nullptr) { m_Symbols->Refresh(); } @@ -353,7 +353,7 @@ void CDebuggerUI::Debug_RefreshSymbolsWindow() void CDebuggerUI::OpenDMALogWindow(void) { - if (m_DMALogView == NULL) + if (m_DMALogView == nullptr) { m_DMALogView = new CDebugDMALogView(this); } @@ -362,7 +362,7 @@ void CDebuggerUI::OpenDMALogWindow(void) void CDebuggerUI::OpenCPULogWindow(void) { - if (m_CPULogView == NULL) + if (m_CPULogView == nullptr) { m_CPULogView = new CDebugCPULogView(this); } @@ -371,7 +371,7 @@ void CDebuggerUI::OpenCPULogWindow(void) void CDebuggerUI::OpenExcBreakpointsWindow(void) { - if (m_ExcBreakpoints == NULL) + if (m_ExcBreakpoints == nullptr) { m_ExcBreakpoints = new CDebugExcBreakpoints(this); } @@ -380,7 +380,7 @@ void CDebuggerUI::OpenExcBreakpointsWindow(void) void CDebuggerUI::OpenStackTraceWindow(void) { - if (m_StackTrace == NULL) + if (m_StackTrace == nullptr) { m_StackTrace = new CDebugStackTrace(this); } @@ -389,7 +389,7 @@ void CDebuggerUI::OpenStackTraceWindow(void) void CDebuggerUI::OpenStackViewWindow(void) { - if (m_StackView == NULL) + if (m_StackView == nullptr) { m_StackView = new CDebugStackView(this); } @@ -398,7 +398,7 @@ void CDebuggerUI::OpenStackViewWindow(void) void CDebuggerUI::Debug_RefreshStackWindow(void) { - if (m_StackView != NULL) + if (m_StackView != nullptr) { m_StackView->Refresh(); } @@ -406,7 +406,7 @@ void CDebuggerUI::Debug_RefreshStackWindow(void) void CDebuggerUI::Debug_RefreshStackTraceWindow(void) { - if (m_StackTrace != NULL && m_StackTrace->m_hWnd != NULL) + if (m_StackTrace != nullptr && m_StackTrace->m_hWnd != nullptr) { m_StackTrace->Refresh(); } @@ -414,7 +414,7 @@ void CDebuggerUI::Debug_RefreshStackTraceWindow(void) void CDebuggerUI::Debug_RefreshCPULogWindow(void) { - if (m_CPULogView != NULL) + if (m_CPULogView != nullptr) { m_CPULogView->RefreshList(); } @@ -640,7 +640,7 @@ void CDebuggerUI::CPUStep() // Called after opcode has been executed void CDebuggerUI::CPUStepEnded() { - if (m_StackTrace == NULL) + if (m_StackTrace == nullptr) { return; } @@ -665,7 +665,7 @@ void CDebuggerUI::CPUStepEnded() void CDebuggerUI::FrameDrawn() { - static HWND hMainWnd = NULL; + static HWND hMainWnd = nullptr; static HFONT monoFont = CreateFont(-11, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, @@ -673,11 +673,11 @@ void CDebuggerUI::FrameDrawn() PROOF_QUALITY, FF_DONTCARE, L"Consolas" ); - if (hMainWnd == NULL) + if (hMainWnd == nullptr) { RenderWindow* mainWindow = g_Plugins->MainWindow(); - if (mainWindow == NULL) + if (mainWindow == nullptr) { return; } @@ -711,45 +711,45 @@ void CDebuggerUI::WaitForStep(void) bool CDebuggerUI::ExecutionBP(uint32_t address) { - return m_Breakpoints != NULL && m_Breakpoints->ExecutionBPExists(address, true) != CBreakpoints::BP_NOT_SET; + return m_Breakpoints != nullptr && m_Breakpoints->ExecutionBPExists(address, true) != CBreakpoints::BP_NOT_SET; } bool CDebuggerUI::ReadBP8(uint32_t address) { - return m_Breakpoints != NULL && m_Breakpoints->ReadBPExists8(address) != CBreakpoints::BP_NOT_SET; + return m_Breakpoints != nullptr && m_Breakpoints->ReadBPExists8(address) != CBreakpoints::BP_NOT_SET; } bool CDebuggerUI::ReadBP16(uint32_t address) { - return m_Breakpoints != NULL && m_Breakpoints->ReadBPExists16(address) != CBreakpoints::BP_NOT_SET; + return m_Breakpoints != nullptr && m_Breakpoints->ReadBPExists16(address) != CBreakpoints::BP_NOT_SET; } bool CDebuggerUI::ReadBP32(uint32_t address) { - return m_Breakpoints != NULL && m_Breakpoints->ReadBPExists32(address) != CBreakpoints::BP_NOT_SET; + return m_Breakpoints != nullptr && m_Breakpoints->ReadBPExists32(address) != CBreakpoints::BP_NOT_SET; } bool CDebuggerUI::ReadBP64(uint32_t address) { - return m_Breakpoints != NULL && m_Breakpoints->ReadBPExists64(address) != CBreakpoints::BP_NOT_SET; + return m_Breakpoints != nullptr && m_Breakpoints->ReadBPExists64(address) != CBreakpoints::BP_NOT_SET; } bool CDebuggerUI::WriteBP8(uint32_t address) { - return m_Breakpoints != NULL && m_Breakpoints->WriteBPExists8(address) != CBreakpoints::BP_NOT_SET; + return m_Breakpoints != nullptr && m_Breakpoints->WriteBPExists8(address) != CBreakpoints::BP_NOT_SET; } bool CDebuggerUI::WriteBP16(uint32_t address) { - return m_Breakpoints != NULL && m_Breakpoints->WriteBPExists16(address) != CBreakpoints::BP_NOT_SET; + return m_Breakpoints != nullptr && m_Breakpoints->WriteBPExists16(address) != CBreakpoints::BP_NOT_SET; } bool CDebuggerUI::WriteBP32(uint32_t address) { - return m_Breakpoints != NULL && m_Breakpoints->WriteBPExists32(address) != CBreakpoints::BP_NOT_SET; + return m_Breakpoints != nullptr && m_Breakpoints->WriteBPExists32(address) != CBreakpoints::BP_NOT_SET; } bool CDebuggerUI::WriteBP64(uint32_t address) { - return m_Breakpoints != NULL && m_Breakpoints->WriteBPExists64(address) != CBreakpoints::BP_NOT_SET; + return m_Breakpoints != nullptr && m_Breakpoints->WriteBPExists64(address) != CBreakpoints::BP_NOT_SET; } diff --git a/Source/Project64/UserInterface/Debugger/MemoryScanner.cpp b/Source/Project64/UserInterface/Debugger/MemoryScanner.cpp index b2d2d7192..50238262b 100644 --- a/Source/Project64/UserInterface/Debugger/MemoryScanner.cpp +++ b/Source/Project64/UserInterface/Debugger/MemoryScanner.cpp @@ -15,7 +15,7 @@ CMixed::TypeNameEntry CMixed::TypeNames[] = { { "char", ValueType_string }, { "char", ValueType_unkstring }, { "char", ValueType_unkstring }, - { NULL, ValueType_invalid} + { nullptr, ValueType_invalid} }; const char* CMixed::GetTypeName(void) @@ -38,12 +38,12 @@ const char* CMixed::GetTypeName(void) return "char"; } - return NULL; + return nullptr; } ValueType CMixed::GetTypeFromString(const char* name, int* charArrayLength) { - for (int i = 0; TypeNames[i].name != NULL; i++) + for (int i = 0; TypeNames[i].name != nullptr; i++) { if (strcmp(name, TypeNames[i].name) == 0) { @@ -142,7 +142,7 @@ CScanResult::CScanResult(AddressType addressType, DisplayFormat displayFormat) : m_Address(0), m_DisplayFormat(displayFormat), m_bSelected(false), - m_Description(NULL) + m_Description(nullptr) { } @@ -152,7 +152,7 @@ CScanResult::~CScanResult(void) void CScanResult::SetDescription(const char* str) { - if (m_Description != NULL) + if (m_Description != nullptr) { free(m_Description); } @@ -165,16 +165,16 @@ void CScanResult::SetDescription(const char* str) void CScanResult::DeleteDescription(void) { - if (m_Description != NULL) + if (m_Description != nullptr) { free(m_Description); - m_Description = NULL; + m_Description = nullptr; } } const char* CScanResult::GetDescription(void) { - if (m_Description == NULL) + if (m_Description == nullptr) { return ""; } @@ -189,7 +189,7 @@ int CScanResult::GetValueString(char *buffer, size_t size) bool CScanResult::GetMemoryValue(CMixed* v) { - if (g_MMU == NULL) + if (g_MMU == nullptr) { return false; } @@ -230,7 +230,7 @@ bool CScanResult::GetMemoryValue(CMixed* v) int CScanResult::GetMemoryValueString(char* buffer, size_t size, bool bIgnoreHex) { - if (g_MMU == NULL) + if (g_MMU == nullptr) { sprintf(buffer, "?"); return 1; @@ -305,7 +305,7 @@ uint32_t CScanResult::GetVirtualAddress(void) bool CScanResult::SetMemoryValueFromString(const char* str) { - if (g_MMU == NULL) + if (g_MMU == nullptr) { //sprintf(buffer, "?"); return false; @@ -366,7 +366,7 @@ bool CScanResult::SetMemoryValueFromString(const char* str) case ValueType_unkstring: if (bHex) { - int size = CMemoryScanner::ParseHexString(NULL, str); + int size = CMemoryScanner::ParseHexString(nullptr, str); if (size == 0) { return false; @@ -478,7 +478,7 @@ CMemoryScanner::CMemoryScanner(void) : m_SearchType(SearchType_ExactValue), m_AddressType(AddressType_Virtual), m_VAddrBits(0x80000000), - m_Memory(NULL) + m_Memory(nullptr) { m_Value._uint64 = 0; SetAddressRange(0x80000000, 0x803FFFFF); @@ -496,7 +496,7 @@ bool CMemoryScanner::AddrCheck(uint32_t addr, uint32_t rangeStart, uint32_t rang bool CMemoryScanner::PAddrValid(uint32_t physAddr) { - if (g_MMU == NULL || g_Rom == NULL) + if (g_MMU == nullptr || g_Rom == nullptr) { g_Notify->BreakPoint(__FILE__, __LINE__); } @@ -600,7 +600,7 @@ uint8_t* CMemoryScanner::GetMemoryPool(uint32_t physAddr) { if (!g_MMU || !g_Rom) { - return NULL; + return nullptr; } if ((physAddr >= 0x00000000 && physAddr < g_MMU->RdramSize()) || @@ -614,7 +614,7 @@ uint8_t* CMemoryScanner::GetMemoryPool(uint32_t physAddr) } else { - return NULL; + return nullptr; } } @@ -692,7 +692,7 @@ CScanResult* CMemoryScanner::GetResult(size_t index) { if (index >= m_Results.size()) { - return NULL; + return nullptr; } return &m_Results[index]; @@ -731,7 +731,7 @@ void CMemoryScanner::FirstScanLoopString(DisplayFormat resultDisplayFormat) } result.m_Address = addr | m_VAddrBits; - result.Set((const wchar_t*)NULL); + result.Set((const wchar_t*)nullptr); m_Results.push_back(result); next_addr:; } @@ -760,7 +760,7 @@ void CMemoryScanner::FirstScanLoopIString(DisplayFormat resultDisplayFormat) } result.m_Address = addr | m_VAddrBits; - result.Set((const wchar_t*)NULL); + result.Set((const wchar_t*)nullptr); m_Results.push_back(result); next_addr:; } @@ -833,7 +833,7 @@ void CMemoryScanner::FirstScanLoopUnkString(void) } result.m_Address = addr | m_VAddrBits; - result.Set((const wchar_t*)NULL); + result.Set((const wchar_t*)nullptr); m_Results.push_back(result); next_addr:; @@ -1033,7 +1033,7 @@ int CMemoryScanner::ParseHexString(char *dst, const char* src) else { curByte |= HexDigitVal(src[i]); - if (dst != NULL) + if (dst != nullptr) { dst[size] = curByte; } diff --git a/Source/Project64/UserInterface/Debugger/ScriptInstance.cpp b/Source/Project64/UserInterface/Debugger/ScriptInstance.cpp index 884bbc890..375ff3733 100644 --- a/Source/Project64/UserInterface/Debugger/ScriptInstance.cpp +++ b/Source/Project64/UserInterface/Debugger/ScriptInstance.cpp @@ -37,7 +37,7 @@ CScriptInstance* CScriptInstance::FetchInstance(duk_context* ctx) return Cache[i]; } } - return NULL; + return nullptr; } CScriptInstance::CScriptInstance(CDebuggerUI* debugger) @@ -46,11 +46,11 @@ CScriptInstance::CScriptInstance(CDebuggerUI* debugger) m_Ctx = duk_create_heap_default(); m_ScriptSystem = m_Debugger->ScriptSystem(); m_NextListenerId = 0; - m_hIOCompletionPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0); + m_hIOCompletionPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE, nullptr, 0, 0); CacheInstance(this); m_hKernel = LoadLibraryA("Kernel32.dll"); - m_CancelIoEx = NULL; - if (m_hKernel != NULL) + m_CancelIoEx = nullptr; + if (m_hKernel != nullptr) { m_CancelIoEx = (Dynamic_CancelIoEx)GetProcAddress(m_hKernel, "CancelIoEx"); } @@ -63,8 +63,8 @@ CScriptInstance::~CScriptInstance() TerminateThread(m_hThread, 0); CloseHandle(m_hThread); - m_CancelIoEx = NULL; - if (m_hKernel != NULL) + m_CancelIoEx = nullptr; + if (m_hKernel != nullptr) { FreeLibrary(m_hKernel); } @@ -73,7 +73,7 @@ CScriptInstance::~CScriptInstance() void CScriptInstance::Start(char* path) { m_TempPath = path; - CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)StartThread, this, 0, NULL); + CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)StartThread, this, 0, nullptr); } void CScriptInstance::ForceStop() @@ -136,7 +136,7 @@ void CScriptInstance::StartScriptProc() if (apiresult != 0) { - MessageBox(NULL, stdstr(duk_safe_to_string(ctx, -1)).ToUTF16().c_str(), L"API Script Error", MB_OK | MB_ICONERROR); + MessageBox(nullptr, stdstr(duk_safe_to_string(ctx, -1)).ToUTF16().c_str(), L"API Script Error", MB_OK | MB_ICONERROR); return; } @@ -144,12 +144,12 @@ void CScriptInstance::StartScriptProc() { stdstr fullPath = stdstr_f("Scripts/%s", m_TempPath); duk_int_t scriptresult = duk_peval_file(ctx, fullPath.c_str()); - m_TempPath = NULL; + m_TempPath = nullptr; if (scriptresult != 0) { const char* errorText = duk_safe_to_string(ctx, -1); - //MessageBox(NULL, duk_safe_to_string(ctx, -1), "Script error", MB_OK | MB_ICONWARNING); + //MessageBox(nullptr, duk_safe_to_string(ctx, -1), "Script error", MB_OK | MB_ICONWARNING); m_Debugger->Debug_LogScriptsWindow(errorText); m_Debugger->Debug_LogScriptsWindow("\r\n"); SetState(STATE_STOPPED); @@ -219,7 +219,7 @@ CScriptInstance::WaitForEvent(IOLISTENER** lpListener) if (!status) { - *lpListener = NULL; + *lpListener = nullptr; DWORD errorCode = GetLastError(); if (errorCode == STATUS_USER_APC) { @@ -317,7 +317,7 @@ void CScriptInstance::RemoveAsyncFile(HANDLE fd) HANDLE CScriptInstance::CreateSocket() { - HANDLE fd = (HANDLE)WSASocket(AF_INET, SOCK_STREAM, 0, NULL, 0, WSA_FLAG_OVERLAPPED); + HANDLE fd = (HANDLE)WSASocket(AF_INET, SOCK_STREAM, 0, nullptr, 0, WSA_FLAG_OVERLAPPED); AddAsyncFile(fd, true); return fd; } @@ -344,14 +344,14 @@ void CScriptInstance::RemoveListenerByIndex(UINT index) { IOLISTENER* lpListener = m_Listeners[index]; - if (lpListener->data != NULL) + if (lpListener->data != nullptr) { free(lpListener->data); } // Original call to CancelIoEx: //CancelIoEx(lpListener->fd, (LPOVERLAPPED)lpListener); - if (m_CancelIoEx != NULL) + if (m_CancelIoEx != nullptr) { m_CancelIoEx(lpListener->fd, (LPOVERLAPPED)lpListener); } @@ -396,7 +396,7 @@ void CScriptInstance::InvokeListenerCallback(IOLISTENER* lpListener) { CGuard guard(m_CS); - if (lpListener->callback == NULL) + if (lpListener->callback == nullptr) { return; } @@ -442,7 +442,7 @@ void CScriptInstance::InvokeListenerCallback(IOLISTENER* lpListener) if (status != DUK_EXEC_SUCCESS) { const char* msg = duk_safe_to_string(m_Ctx, -1); - MessageBox(NULL, stdstr(msg).ToUTF16().c_str(), L"Script error", MB_OK | MB_ICONWARNING); + MessageBox(nullptr, stdstr(msg).ToUTF16().c_str(), L"Script error", MB_OK | MB_ICONWARNING); } duk_pop(m_Ctx); @@ -452,11 +452,11 @@ const char* CScriptInstance::Eval(const char* jsCode) { CGuard guard(m_CS); int result = duk_peval_string(m_Ctx, jsCode); - const char* msg = NULL; + const char* msg = nullptr; if (result != 0) { - MessageBox(NULL, stdstr(msg).ToUTF16().c_str(), L"Script error", MB_OK | MB_ICONWARNING); + MessageBox(nullptr, stdstr(msg).ToUTF16().c_str(), L"Script error", MB_OK | MB_ICONWARNING); } else { @@ -471,7 +471,7 @@ bool CScriptInstance::AddFile(const char* path, const char* mode, int* fd) { FILE* fp = fopen(path, mode); - if (fp == NULL) + if (fp == nullptr) { return false; } @@ -525,7 +525,7 @@ FILE* CScriptInstance::GetFilePointer(int fd) return filefd->fp; } } - return NULL; + return nullptr; } const char* CScriptInstance::EvalFile(const char* jsPath) @@ -534,7 +534,7 @@ const char* CScriptInstance::EvalFile(const char* jsPath) const char* msg = duk_safe_to_string(m_Ctx, -1); if (result != 0) { - MessageBox(NULL, stdstr(msg).ToUTF16().c_str(), stdstr(jsPath).ToUTF16().c_str(), MB_OK | MB_ICONWARNING); + MessageBox(nullptr, stdstr(msg).ToUTF16().c_str(), stdstr(jsPath).ToUTF16().c_str(), MB_OK | MB_ICONWARNING); } duk_pop(m_Ctx); return msg; @@ -579,9 +579,9 @@ void CScriptInstance::Invoke2(void* heapptr, uint32_t param, uint32_t param2) void CScriptInstance::QueueAPC(PAPCFUNC userProc, ULONG_PTR param) { - if (m_hThread != NULL) + if (m_hThread != nullptr) { - MessageBox(NULL, L"apc queued", L"", MB_OK); + MessageBox(nullptr, L"apc queued", L"", MB_OK); QueueUserAPC(userProc, m_hThread, param); } } @@ -611,7 +611,7 @@ duk_ret_t CScriptInstance::js_ioSockConnect(duk_context* ctx) ::bind((SOCKET)fd, (SOCKADDR*)&clientAddr, sizeof(SOCKADDR)); IOLISTENER* lpListener = _this->AddListener(fd, EVENT_CONNECT, callback); - ConnectEx((SOCKET)fd, (SOCKADDR*)&serverAddr, sizeof(SOCKADDR), NULL, 0, NULL, (LPOVERLAPPED)lpListener); + ConnectEx((SOCKET)fd, (SOCKADDR*)&serverAddr, sizeof(SOCKADDR), nullptr, 0, nullptr, (LPOVERLAPPED)lpListener); duk_pop_n(ctx, 4); return 1; @@ -681,7 +681,7 @@ duk_ret_t CScriptInstance::js_ioSockAccept(duk_context* ctx) 0, sizeof(SOCKADDR_IN) + 16, sizeof(SOCKADDR_IN) + 16, - NULL, + nullptr, (LPOVERLAPPED)lpListener ); @@ -708,11 +708,11 @@ duk_ret_t CScriptInstance::js_ioRead(duk_context* ctx) void* data = malloc(bufferSize); // Freed after event is fired IOLISTENER* lpListener = _this->AddListener(fd, EVENT_READ, jsCallback, data, bufferSize); - BOOL status = ReadFile(fd, lpListener->data, lpListener->dataLen, NULL, (LPOVERLAPPED)lpListener); + BOOL status = ReadFile(fd, lpListener->data, lpListener->dataLen, nullptr, (LPOVERLAPPED)lpListener); if (status == false && GetLastError() != ERROR_IO_PENDING) { - MessageBox(NULL, L"readex error", L"", MB_OK); + MessageBox(nullptr, L"readex error", L"", MB_OK); } duk_pop_n(ctx, 3); @@ -733,7 +733,7 @@ duk_ret_t CScriptInstance::js_ioWrite(duk_context* ctx) data[dataLen] = '\0'; IOLISTENER* lpListener = _this->AddListener(fd, EVENT_WRITE, jsCallback, data, dataLen); - WriteFile(fd, lpListener->data, lpListener->dataLen, NULL, (LPOVERLAPPED)lpListener); + WriteFile(fd, lpListener->data, lpListener->dataLen, nullptr, (LPOVERLAPPED)lpListener); duk_pop_n(ctx, 3); return 1; @@ -765,7 +765,7 @@ duk_ret_t CScriptInstance::js_AddCallback(duk_context* ctx) int callbackId = -1; CScriptHook* hook = _this->m_ScriptSystem->GetHook(hookId); - if (hook != NULL) + if (hook != nullptr) { callbackId = hook->Add(_this, heapptr, param, param2, param3, param4, bOnce); } @@ -985,7 +985,7 @@ duk_ret_t CScriptInstance::js_GetROMInt(duk_context* ctx) duk_pop_n(ctx, 3); - if (g_Rom == NULL) + if (g_Rom == nullptr) { goto return_err; } @@ -1054,7 +1054,7 @@ duk_ret_t CScriptInstance::js_GetROMFloat(duk_context* ctx) duk_pop_n(ctx, argc); - if (g_Rom == NULL) + if (g_Rom == nullptr) { goto return_err; } @@ -1099,7 +1099,7 @@ duk_ret_t CScriptInstance::js_GetRDRAMInt(duk_context* ctx) duk_pop_n(ctx, 3); - if (g_MMU == NULL) + if (g_MMU == nullptr) { goto return_err; } @@ -1167,7 +1167,7 @@ duk_ret_t CScriptInstance::js_SetRDRAMInt(duk_context* ctx) duk_pop_n(ctx, 3); - if (g_MMU == NULL) + if (g_MMU == nullptr) { goto return_err; } @@ -1220,7 +1220,7 @@ duk_ret_t CScriptInstance::js_GetRDRAMFloat(duk_context* ctx) duk_pop_n(ctx, argc); - if (g_MMU == NULL) + if (g_MMU == nullptr) { goto return_err; } @@ -1273,7 +1273,7 @@ duk_ret_t CScriptInstance::js_SetRDRAMFloat(duk_context* ctx) duk_pop_n(ctx, argc); - if (g_MMU == NULL) + if (g_MMU == nullptr) { goto return_err; } @@ -1315,7 +1315,7 @@ duk_ret_t CScriptInstance::js_GetRDRAMBlock(duk_context* ctx) duk_pop_n(ctx, 2); - if (g_MMU == NULL) + if (g_MMU == nullptr) { duk_push_boolean(ctx, false); return 1; @@ -1343,7 +1343,7 @@ duk_ret_t CScriptInstance::js_MsgBox(duk_context* ctx) caption = duk_to_string(ctx, 1); } - MessageBox(NULL, stdstr(msg).ToUTF16().c_str(), stdstr(caption).ToUTF16().c_str(), MB_OK); + MessageBox(nullptr, stdstr(msg).ToUTF16().c_str(), stdstr(caption).ToUTF16().c_str(), MB_OK); duk_pop_n(ctx, argc); duk_push_boolean(ctx, 1); @@ -1606,7 +1606,7 @@ duk_ret_t CScriptInstance::js_FSWrite(duk_context* ctx) FILE* fp = _this->GetFilePointer(fd); - if (fp == NULL) + if (fp == nullptr) { goto end; } @@ -1629,7 +1629,7 @@ duk_ret_t CScriptInstance::js_FSWrite(duk_context* ctx) // Buffer buffer = (const char*)duk_get_buffer_data(ctx, 1, &length); - if (buffer == NULL) + if (buffer == nullptr) { goto end; } @@ -1694,7 +1694,7 @@ duk_ret_t CScriptInstance::js_FSRead(duk_context* ctx) FILE* fp = _this->GetFilePointer(fd); - if (fp == NULL) + if (fp == nullptr) { goto end; } @@ -1752,7 +1752,7 @@ duk_ret_t CScriptInstance::js_FSFStat(duk_context* ctx) { "atimeMs", (duk_double_t)statbuf.st_atime * 1000 }, { "mtimeMs", (duk_double_t)statbuf.st_mtime * 1000 }, { "ctimeMs", (duk_double_t)statbuf.st_ctime * 1000 }, - { NULL, 0 } + { nullptr, 0 } }; duk_put_number_list(ctx, obj_idx, props); @@ -1798,7 +1798,7 @@ duk_ret_t CScriptInstance::js_FSStat(duk_context* ctx) { "atimeMs", (duk_double_t)statbuf.st_atime * 1000 }, { "mtimeMs", (duk_double_t)statbuf.st_mtime * 1000 }, { "ctimeMs", (duk_double_t)statbuf.st_ctime * 1000 }, - { NULL, 0 } + { nullptr, 0 } }; duk_put_number_list(ctx, obj_idx, props); @@ -1819,7 +1819,7 @@ duk_ret_t CScriptInstance::js_FSMkDir(duk_context* ctx) duk_pop_n(ctx, nargs); - if (CreateDirectoryA(path, NULL)) + if (CreateDirectoryA(path, nullptr)) { duk_push_true(ctx); } @@ -1932,7 +1932,7 @@ duk_ret_t CScriptInstance::js_FSReadDir(duk_context* ctx) static BOOL ConnectEx(SOCKET s, const SOCKADDR* name, int namelen, PVOID lpSendBuffer, DWORD dwSendDataLength, LPDWORD lpdwBytesSent, LPOVERLAPPED lpOverlapped) { - LPFN_CONNECTEX ConnectExPtr = NULL; + LPFN_CONNECTEX ConnectExPtr = nullptr; DWORD nBytes; GUID guid = WSAID_CONNECTEX; int fetched = WSAIoctl( @@ -1943,11 +1943,11 @@ static BOOL ConnectEx(SOCKET s, const SOCKADDR* name, int namelen, PVOID lpSendB &ConnectExPtr, sizeof(LPFN_CONNECTEX), &nBytes, - NULL, - NULL + nullptr, + nullptr ); - if (fetched == 0 && ConnectExPtr != NULL) + if (fetched == 0 && ConnectExPtr != nullptr) { ConnectExPtr(s, name, namelen, lpSendBuffer, dwSendDataLength, lpdwBytesSent, lpOverlapped); } diff --git a/Source/Project64/UserInterface/Debugger/ScriptInstance.h b/Source/Project64/UserInterface/Debugger/ScriptInstance.h index def6b543b..0848deb04 100644 --- a/Source/Project64/UserInterface/Debugger/ScriptInstance.h +++ b/Source/Project64/UserInterface/Debugger/ScriptInstance.h @@ -114,7 +114,7 @@ private: void RemoveAsyncFile(HANDLE fd); HANDLE CreateSocket(); - IOLISTENER* AddListener(HANDLE fd, IOEVENTTYPE evt, void* jsCallback, void* data = NULL, int dataLen = 0); + IOLISTENER* AddListener(HANDLE fd, IOEVENTTYPE evt, void* jsCallback, void* data = nullptr, int dataLen = 0); void RemoveListener(IOLISTENER* lpListener); void RemoveListenerByIndex(UINT index); void RemoveListenersByFd(HANDLE fd); @@ -251,6 +251,6 @@ private: { "fsMkDir", js_FSMkDir, DUK_VARARGS }, { "fsRmDir", js_FSRmDir, DUK_VARARGS }, { "fsReadDir", js_FSReadDir, DUK_VARARGS }, - { NULL, NULL, 0 } + { nullptr, nullptr, 0 } }; }; diff --git a/Source/Project64/UserInterface/Debugger/ScriptSystem.cpp b/Source/Project64/UserInterface/Debugger/ScriptSystem.cpp index 92ab8e8a1..cb9337b18 100644 --- a/Source/Project64/UserInterface/Debugger/ScriptSystem.cpp +++ b/Source/Project64/UserInterface/Debugger/ScriptSystem.cpp @@ -29,7 +29,7 @@ CScriptSystem::CScriptSystem(CDebuggerUI* debugger) RegisterHook("gprvalue", m_HookCPUGPRValue); RegisterHook("draw", m_HookFrameDrawn); - HMODULE hInst = GetModuleHandle(NULL); + HMODULE hInst = GetModuleHandle(nullptr); HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(IDR_JSAPI_TEXT), L"TEXT"); HGLOBAL hGlob = LoadResource(hInst, hRes); @@ -73,7 +73,7 @@ void CScriptSystem::StopScript(const char* path) { CScriptInstance* scriptInstance = GetInstance(path); - if (scriptInstance == NULL) + if (scriptInstance == nullptr) { return; } @@ -128,7 +128,7 @@ CScriptInstance* CScriptSystem::GetInstance(const char* path) } } - return NULL; + return nullptr; } bool CScriptSystem::HasCallbacksForInstance(CScriptInstance* scriptInstance) @@ -180,7 +180,7 @@ CScriptHook* CScriptSystem::GetHook(const char* hookId) return m_Hooks[i].cbList; } } - return NULL; + return nullptr; } int CScriptSystem::GetNextCallbackId() diff --git a/Source/Project64/UserInterface/Debugger/Symbols.cpp b/Source/Project64/UserInterface/Debugger/Symbols.cpp index 1143cdc0f..336c19aeb 100644 --- a/Source/Project64/UserInterface/Debugger/Symbols.cpp +++ b/Source/Project64/UserInterface/Debugger/Symbols.cpp @@ -4,14 +4,14 @@ CSymbolTable::CSymbolTable(CDebuggerUI* debugger) : m_Debugger(debugger), m_NextSymbolId(0), - m_SymFileBuffer(NULL), + m_SymFileBuffer(nullptr), m_SymFileSize(0), - m_ParserToken(NULL), + m_ParserToken(nullptr), m_ParserTokenLength(0), m_ParserDelimeter(0), - m_SymFileParseBuffer(NULL), + m_SymFileParseBuffer(nullptr), m_bHaveFirstToken(false), - m_TokPos(NULL) + m_TokPos(nullptr) { } @@ -37,13 +37,13 @@ symbol_type_info_t CSymbolTable::m_SymbolTypes[] = { { SYM_VECTOR2, "v2", 8 }, { SYM_VECTOR3, "v3", 12 }, { SYM_VECTOR4, "v4", 16 }, - { SYM_INVALID, NULL, 0 } + { SYM_INVALID, nullptr, 0 } }; symbol_type_id_t CSymbolTable::GetTypeId(char* typeName) { const char* name; - for (int i = 0; (name = m_SymbolTypes[i].name) != NULL; i++) + for (int i = 0; (name = m_SymbolTypes[i].name) != nullptr; i++) { if (strcmp(typeName, name) == 0) { @@ -57,7 +57,7 @@ const char* CSymbolTable::GetTypeName(int typeId) { if (typeId >= NUM_SYM_TYPES) { - return NULL; + return nullptr; } return m_SymbolTypes[typeId].name; } @@ -98,16 +98,16 @@ void CSymbolTable::ParserFetchToken(const char* delim) { if (!m_bHaveFirstToken) { - m_TokPos = NULL; + m_TokPos = nullptr; m_ParserToken = strtok_s(m_SymFileParseBuffer, delim, &m_TokPos); m_bHaveFirstToken = true; } else { - m_ParserToken = strtok_s(NULL, delim, &m_TokPos); + m_ParserToken = strtok_s(nullptr, delim, &m_TokPos); } - if (m_ParserToken != NULL) + if (m_ParserToken != nullptr) { m_ParserTokenLength = strlen(m_ParserToken); m_ParserDelimeter = m_SymFileBuffer[m_ParserToken - m_SymFileParseBuffer + m_ParserTokenLength]; @@ -128,7 +128,7 @@ void CSymbolTable::Load() if (g_Settings->LoadStringVal(Game_GameName).length() == 0) { - MessageBox(NULL, L"Game must be loaded", L"Symbols", MB_ICONWARNING | MB_OK); + MessageBox(nullptr, L"Game must be loaded", L"Symbols", MB_ICONWARNING | MB_OK); return; } @@ -141,12 +141,12 @@ void CSymbolTable::Load() return; } - if (m_SymFileBuffer != NULL) + if (m_SymFileBuffer != nullptr) { delete[] m_SymFileBuffer; } - if (m_SymFileParseBuffer != NULL) + if (m_SymFileParseBuffer != nullptr) { delete[] m_SymFileParseBuffer; } @@ -168,13 +168,13 @@ void CSymbolTable::Load() { uint32_t address = 0; int type = 0; - char* name = NULL; - char* description = NULL; + char* name = nullptr; + char* description = nullptr; // Address ParserFetchToken(",\n\0"); - if (m_ParserToken == NULL || m_ParserTokenLength == 0) + if (m_ParserToken == nullptr || m_ParserTokenLength == 0) { // Empty line @EOF errorCode = ERR_SUCCESS; @@ -236,10 +236,10 @@ void CSymbolTable::Load() } delete[] m_SymFileParseBuffer; - m_SymFileParseBuffer = NULL; + m_SymFileParseBuffer = nullptr; delete[] m_SymFileBuffer; - m_SymFileBuffer = NULL; + m_SymFileBuffer = nullptr; switch (errorCode) { @@ -272,7 +272,7 @@ void CSymbolTable::Save() CSymbol& symbol = m_Symbols[i]; stdstr strLine = stdstr_f("%08X,%s,%s", symbol.m_Address, symbol.TypeName(), symbol.m_Name); - if (symbol.m_Description != NULL) + if (symbol.m_Description != nullptr) { strLine += stdstr_f(",%s", symbol.m_Description); } @@ -380,7 +380,7 @@ void CSymbolTable::GetValueString(char* dst, CSymbol* symbol) void CSymbolTable::ParseErrorAlert(char* message, int lineNumber) { stdstr messageFormatted = stdstr_f("%s\nLine %d", message, lineNumber); - MessageBox(NULL, messageFormatted.ToUTF16().c_str(), L"Parse error", MB_OK | MB_ICONWARNING); + MessageBox(nullptr, messageFormatted.ToUTF16().c_str(), L"Parse error", MB_OK | MB_ICONWARNING); } void CSymbolTable::Reset() @@ -398,14 +398,14 @@ void CSymbolTable::AddSymbol(int type, uint32_t address, const char* name, const { CGuard guard(m_CS); - if (name == NULL || strlen(name) == 0) + if (name == nullptr || strlen(name) == 0) { return; } - if (description == NULL || strlen(description) == 0) + if (description == nullptr || strlen(description) == 0) { - description = NULL; + description = nullptr; } int id = m_NextSymbolId++; diff --git a/Source/Project64/UserInterface/Debugger/Symbols.h b/Source/Project64/UserInterface/Debugger/Symbols.h index c967352cb..92a89b520 100644 --- a/Source/Project64/UserInterface/Debugger/Symbols.h +++ b/Source/Project64/UserInterface/Debugger/Symbols.h @@ -78,7 +78,7 @@ public: void Save(); void ParseErrorAlert(char* message, int lineNumber); - void AddSymbol(int type, uint32_t address, const char* name, const char* description = NULL); + void AddSymbol(int type, uint32_t address, const char* name, const char* description = nullptr); void Reset(); int GetCount(); bool GetSymbolById(int id, CSymbol* symbol); @@ -100,8 +100,8 @@ public: m_Id(0), m_Type(SYM_INVALID), m_Address(0), - m_Name(NULL), - m_Description(NULL) + m_Name(nullptr), + m_Description(nullptr) { } @@ -109,15 +109,15 @@ public: m_Id(id), m_Type(type), m_Address(address), - m_Name(NULL), - m_Description(NULL) + m_Name(nullptr), + m_Description(nullptr) { - if (name != NULL) + if (name != nullptr) { m_Name = _strdup(name); } - if (description != NULL) + if (description != nullptr) { m_Description = _strdup(description); } @@ -127,21 +127,21 @@ public: m_Id(symbol.m_Id), m_Type(symbol.m_Type), m_Address(symbol.m_Address), - m_Name(NULL), - m_Description(NULL) + m_Name(nullptr), + m_Description(nullptr) { - m_Name = symbol.m_Name ? _strdup(symbol.m_Name) : NULL; - m_Description = symbol.m_Description ? _strdup(symbol.m_Description) : NULL; + m_Name = symbol.m_Name ? _strdup(symbol.m_Name) : nullptr; + m_Description = symbol.m_Description ? _strdup(symbol.m_Description) : nullptr; } CSymbol& operator= (const CSymbol& symbol) { - if (m_Name != NULL) + if (m_Name != nullptr) { free(m_Name); } - if (m_Description != NULL) + if (m_Description != nullptr) { free(m_Description); } @@ -149,19 +149,19 @@ public: m_Id = symbol.m_Id; m_Type = symbol.m_Type; m_Address = symbol.m_Address; - m_Name = symbol.m_Name ? _strdup(symbol.m_Name) : NULL; - m_Description = symbol.m_Description ? _strdup(symbol.m_Description) : NULL; + m_Name = symbol.m_Name ? _strdup(symbol.m_Name) : nullptr; + m_Description = symbol.m_Description ? _strdup(symbol.m_Description) : nullptr; return *this; } ~CSymbol() { - if (m_Name != NULL) + if (m_Name != nullptr) { free(m_Name); } - if (m_Description != NULL) + if (m_Description != nullptr) { free(m_Description); } diff --git a/Source/Project64/UserInterface/DiscordRPC.cpp b/Source/Project64/UserInterface/DiscordRPC.cpp index 041f0d033..4a89c6ca8 100644 --- a/Source/Project64/UserInterface/DiscordRPC.cpp +++ b/Source/Project64/UserInterface/DiscordRPC.cpp @@ -12,7 +12,7 @@ void CDiscord::Init() { DiscordEventHandlers handlers = {}; - Discord_Initialize(PJ64_DISCORD_APPID, &handlers, 1, NULL); + Discord_Initialize(PJ64_DISCORD_APPID, &handlers, 1, nullptr); } void CDiscord::Shutdown() @@ -29,7 +29,7 @@ static stdstr GetTitle() return g_Settings->LoadStringVal(Rdb_GoodName); else { Default = CPath(g_Settings->LoadStringVal(Game_File)).GetName().c_str(); - if (strstr(const_cast(Default.c_str()), "?") != NULL) { + if (strstr(const_cast(Default.c_str()), "?") != nullptr) { return Default.substr(Default.find("?") + 1); } return Default; diff --git a/Source/Project64/UserInterface/EnhancementUI.cpp b/Source/Project64/UserInterface/EnhancementUI.cpp index 9e829eabd..88beb2d0e 100644 --- a/Source/Project64/UserInterface/EnhancementUI.cpp +++ b/Source/Project64/UserInterface/EnhancementUI.cpp @@ -104,7 +104,7 @@ private: }; CEnhancementUI::CEnhancementUI(void) : - m_hSelectedItem(NULL), + m_hSelectedItem(nullptr), m_bModal(false) { } @@ -120,7 +120,7 @@ void CEnhancementUI::Display(HWND hParent, bool BlockExecution) m_bModal = true; DoModal(hParent); } - else if (m_hWnd != NULL) + else if (m_hWnd != nullptr) { SetFocus(); } @@ -140,7 +140,7 @@ LRESULT CEnhancementUI::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* m_TreeList.SetWindowLong(GWL_STYLE, TVS_CHECKBOXES | TVS_SHOWSELALWAYS | Style); HIMAGELIST hImageList = ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 40, 40); - HBITMAP hBmp = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_TRI_STATE)); + HBITMAP hBmp = LoadBitmap(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDB_TRI_STATE)); ImageList_AddMasked(hImageList, hBmp, RGB(255, 0, 255)); DeleteObject(hBmp); m_TreeList.SetImageList(hImageList, TVSIL_STATE); @@ -155,7 +155,7 @@ LRESULT CEnhancementUI::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* int32_t DlgHeight = rcDlg.Height(); int32_t X = (((rcParent.Width()) - DlgWidth) / 2) + rcParent.left; int32_t Y = (((rcParent.Height()) - DlgHeight) / 2) + rcParent.top; - SetWindowPos(NULL, X, Y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + SetWindowPos(nullptr, X, Y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); RefreshList(); ShowWindow(SW_SHOW); @@ -260,17 +260,17 @@ LRESULT CEnhancementUI::OnEnhancementListRClicked(NMHDR* pNMHDR) POINT Mouse; GetCursorPos(&Mouse); - HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_ENHANCEMENT_MENU)); + HMENU hMenu = LoadMenu(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDR_ENHANCEMENT_MENU)); HMENU hPopupMenu = GetSubMenu(hMenu, 0); - if (m_hSelectedItem == NULL) + if (m_hSelectedItem == nullptr) { RemoveMenu(hPopupMenu, 3, MF_BYPOSITION); RemoveMenu(hPopupMenu, 2, MF_BYPOSITION); RemoveMenu(hPopupMenu, 1, MF_BYPOSITION); } - TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0, m_hWnd, NULL); + TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0, m_hWnd, nullptr); DestroyMenu(hMenu); return TRUE; } @@ -371,7 +371,7 @@ void CEnhancementUI::AddCodeLayers(LPARAM Enhancement, const std::wstring & Name void CEnhancementUI::ChangeChildrenStatus(HTREEITEM hParent, bool Checked) { HTREEITEM hItem = m_TreeList.GetChildItem(hParent);; - if (hItem == NULL) + if (hItem == nullptr) { if (hParent == TVI_ROOT) { return; } @@ -398,7 +398,7 @@ void CEnhancementUI::ChangeChildrenStatus(HTREEITEM hParent, bool Checked) return; } TV_CHECK_STATE state = TV_STATE_UNKNOWN; - while (hItem != NULL) + while (hItem != nullptr) { TV_CHECK_STATE ChildState = TV_GetCheckState(hItem); if ((ChildState != TV_STATE_CHECKED || !Checked) && @@ -419,14 +419,14 @@ void CEnhancementUI::ChangeChildrenStatus(HTREEITEM hParent, bool Checked) void CEnhancementUI::CheckParentStatus(HTREEITEM hParent) { - if (hParent == NULL) + if (hParent == nullptr) { return; } HTREEITEM hItem = m_TreeList.GetChildItem(hParent); TV_CHECK_STATE InitialState = TV_GetCheckState(hParent); TV_CHECK_STATE CurrentState = TV_GetCheckState(hItem); - while (hItem != NULL) + while (hItem != nullptr) { if (TV_GetCheckState(hItem) != CurrentState) { diff --git a/Source/Project64/UserInterface/LoggingUI.cpp b/Source/Project64/UserInterface/LoggingUI.cpp index 3444929f8..5fc7dae3f 100644 --- a/Source/Project64/UserInterface/LoggingUI.cpp +++ b/Source/Project64/UserInterface/LoggingUI.cpp @@ -15,40 +15,40 @@ void EnterLogOptions(HWND hwndOwner) psp[0].dwSize = sizeof(PROPSHEETPAGE); psp[0].dwFlags = PSP_USETITLE; - psp[0].hInstance = GetModuleHandle(NULL); + psp[0].hInstance = GetModuleHandle(nullptr); psp[0].pszTemplate = MAKEINTRESOURCE(IDD_Logging_Registers); psp[0].pfnDlgProc = (DLGPROC)LogRegProc; psp[0].pszTitle = L"Registers"; psp[0].lParam = (LPARAM)&logSettings; - psp[0].pfnCallback = NULL; + psp[0].pfnCallback = nullptr; psp[1].dwSize = sizeof(PROPSHEETPAGE); psp[1].dwFlags = PSP_USETITLE; - psp[1].hInstance = GetModuleHandle(NULL); + psp[1].hInstance = GetModuleHandle(nullptr); psp[1].pszTemplate = MAKEINTRESOURCE(IDD_Logging_PifRam); psp[1].pfnDlgProc = (DLGPROC)LogPifProc; psp[1].pszTitle = L"Pif Ram"; psp[1].lParam = (LPARAM)&logSettings; - psp[1].pfnCallback = NULL; + psp[1].pfnCallback = nullptr; psp[2].dwSize = sizeof(PROPSHEETPAGE); psp[2].dwFlags = PSP_USETITLE; - psp[2].hInstance = GetModuleHandle(NULL); + psp[2].hInstance = GetModuleHandle(nullptr); psp[2].pszTemplate = MAKEINTRESOURCE(IDD_Logging_General); psp[2].pfnDlgProc = (DLGPROC)LogGeneralProc; psp[2].pszTitle = L"General"; psp[2].lParam = (LPARAM)&logSettings; - psp[2].pfnCallback = NULL; + psp[2].pfnCallback = nullptr; psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; psh.hwndParent = hwndOwner; - psh.hInstance = GetModuleHandle(NULL); + psh.hInstance = GetModuleHandle(nullptr); psh.pszCaption = (LPTSTR)L"Log Options"; psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); psh.nStartPage = 0; psh.ppsp = (LPCPROPSHEETPAGE)&psp; - psh.pfnCallback = NULL; + psh.pfnCallback = nullptr; PropertySheet(&psh); return; diff --git a/Source/Project64/UserInterface/MainMenu.cpp b/Source/Project64/UserInterface/MainMenu.cpp index 5ee67a648..d7ff15272 100644 --- a/Source/Project64/UserInterface/MainMenu.cpp +++ b/Source/Project64/UserInterface/MainMenu.cpp @@ -231,17 +231,17 @@ void CMainMenu::OnSaveAs(HWND hWnd) _splitpath(SaveFile, drive, dir, fname, ext); if (_stricmp(ext, ".pj") == 0 || _stricmp(ext, ".zip") == 0) { - _makepath(SaveFile, drive, dir, fname, NULL); + _makepath(SaveFile, drive, dir, fname, nullptr); _splitpath(SaveFile, drive, dir, fname, ext); if (_stricmp(ext, ".pj") == 0) { - _makepath(SaveFile, drive, dir, fname, NULL); + _makepath(SaveFile, drive, dir, fname, nullptr); } } g_Settings->SaveString(GameRunning_InstantSaveFile, SaveFile); char SaveDir[MAX_PATH]; - _makepath(SaveDir, drive, dir, NULL, NULL); + _makepath(SaveDir, drive, dir, nullptr, nullptr); UISettingsSaveString(Directory_LastSave, SaveDir); g_BaseSystem->ExternalEvent(SysEvent_SaveMachineState); } @@ -401,7 +401,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI { WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN a"); m_Gui->MakeWindowOnTop(false); - Notify().SetGfxPlugin(NULL); + Notify().SetGfxPlugin(nullptr); WriteTrace(TraceGFXPlugin, TraceDebug, "ChangeWindow: Starting"); g_Plugins->Gfx()->ChangeWindow(); WriteTrace(TraceGFXPlugin, TraceDebug, "ChangeWindow: Done"); @@ -428,7 +428,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI WriteTrace(TraceError, TraceDebug, "Exception when going to full screen"); char Message[600]; sprintf(Message, "Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__); - MessageBox(NULL, stdstr(Message).ToUTF16().c_str(), L"Exception", MB_OK); + MessageBox(nullptr, stdstr(Message).ToUTF16().c_str(), L"Exception", MB_OK); } WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN b 4"); m_Gui->MakeWindowOnTop(false); @@ -580,8 +580,8 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI g_Settings->SaveDword(Game_CurrentSaveState, (DWORD)((MenuID - ID_CURRENT_SAVE_1) + 1)); break; case ID_HELP_SUPPORT_PROJECT64: OnSupportProject64(hWnd); break; - case ID_HELP_DISCORD: ShellExecute(NULL, L"open", L"https://discord.gg/Cg3zquF", NULL, NULL, SW_SHOWMAXIMIZED); break; - case ID_HELP_WEBSITE: ShellExecute(NULL, L"open", L"http://www.pj64-emu.com", NULL, NULL, SW_SHOWMAXIMIZED); break; + case ID_HELP_DISCORD: ShellExecute(nullptr, L"open", L"https://discord.gg/Cg3zquF", nullptr, nullptr, SW_SHOWMAXIMIZED); break; + case ID_HELP_WEBSITE: ShellExecute(nullptr, L"open", L"http://www.pj64-emu.com", nullptr, nullptr, SW_SHOWMAXIMIZED); break; case ID_HELP_ABOUT: CAboutDlg(m_Gui->Support()).DoModal(); break; default: if (MenuID >= ID_RECENT_ROM_START && MenuID < ID_RECENT_ROM_END) @@ -634,8 +634,8 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI stdstr CMainMenu::GetFileLastMod(const CPath & FileName) { - HANDLE hFile = CreateFileA(FileName, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL); + HANDLE hFile = CreateFileA(FileName, GENERIC_READ, FILE_SHARE_READ, nullptr, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, nullptr); if (hFile == INVALID_HANDLE_VALUE) { return ""; @@ -648,7 +648,7 @@ stdstr CMainMenu::GetFileLastMod(const CPath & FileName) // Convert the last-write time to local time FileTimeToSystemTime(&LastWriteTime, &stUTC); - SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal); + SystemTimeToTzSpecificLocalTime(nullptr, &stUTC, &stLocal); LastMod.Format(" [%d/%02d/%02d %02d:%02d]", stLocal.wYear, stLocal.wMonth, stLocal.wDay, stLocal.wHour, stLocal.wMinute); } @@ -758,7 +758,7 @@ void CMainMenu::FillOutMenu(HMENU hMenu) int Offset = 0; for (LanguageList::iterator Language = LangList.begin(); Language != LangList.end(); Language++) { - Item.Reset(ID_LANG_START + Offset++, EMPTY_STRING, EMPTY_STDSTR, NULL, stdstr(Language->LanguageName).ToUTF16().c_str()); + Item.Reset(ID_LANG_START + Offset++, EMPTY_STRING, EMPTY_STDSTR, nullptr, stdstr(Language->LanguageName).ToUTF16().c_str()); if (g_Lang->IsCurrentLang(*Language)) { Item.SetItemTicked(true); @@ -779,7 +779,7 @@ void CMainMenu::FillOutMenu(HMENU hMenu) } stdstr_f MenuString("&%d %s", (count + 1) % 10, LastRom.c_str()); - RecentRomMenu.push_back(MENU_ITEM(ID_RECENT_ROM_START + count, EMPTY_STRING, EMPTY_STDSTR, NULL, MenuString.ToUTF16(CP_ACP).c_str())); + RecentRomMenu.push_back(MENU_ITEM(ID_RECENT_ROM_START + count, EMPTY_STRING, EMPTY_STDSTR, nullptr, MenuString.ToUTF16(CP_ACP).c_str())); } // Recent directory @@ -796,7 +796,7 @@ void CMainMenu::FillOutMenu(HMENU hMenu) stdstr_f MenuString("&%d %s", (count + 1) % 10, LastDir.c_str()); - RecentDirMenu.push_back(MENU_ITEM(ID_RECENT_DIR_START + count, EMPTY_STRING, EMPTY_STDSTR, NULL, MenuString.ToUTF16(CP_ACP).c_str())); + RecentDirMenu.push_back(MENU_ITEM(ID_RECENT_DIR_START + count, EMPTY_STRING, EMPTY_STDSTR, nullptr, MenuString.ToUTF16(CP_ACP).c_str())); } // File menu @@ -865,38 +865,38 @@ void CMainMenu::FillOutMenu(HMENU hMenu) // Current save MenuItemList CurrentSaveMenu; DWORD _CurrentSaveState = g_Settings->LoadDword(Game_CurrentSaveState); - Item.Reset(ID_CURRENT_SAVE_DEFAULT, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_DEFAULT, RunningState), NULL, GetSaveSlotString(0)); + Item.Reset(ID_CURRENT_SAVE_DEFAULT, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_DEFAULT, RunningState), nullptr, GetSaveSlotString(0)); if (_CurrentSaveState == 0) { Item.SetItemTicked(true); } CurrentSaveMenu.push_back(Item); CurrentSaveMenu.push_back(MENU_ITEM(SPLITER)); - Item.Reset(ID_CURRENT_SAVE_1, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_1, RunningState), NULL, GetSaveSlotString(1)); + Item.Reset(ID_CURRENT_SAVE_1, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_1, RunningState), nullptr, GetSaveSlotString(1)); if (_CurrentSaveState == 1) { Item.SetItemTicked(true); } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_2, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_2, RunningState), NULL, GetSaveSlotString(2)); + Item.Reset(ID_CURRENT_SAVE_2, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_2, RunningState), nullptr, GetSaveSlotString(2)); if (_CurrentSaveState == 2) { Item.SetItemTicked(true); } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_3, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_3, RunningState), NULL, GetSaveSlotString(3)); + Item.Reset(ID_CURRENT_SAVE_3, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_3, RunningState), nullptr, GetSaveSlotString(3)); if (_CurrentSaveState == 3) { Item.SetItemTicked(true); } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_4, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_4, RunningState), NULL, GetSaveSlotString(4)); + Item.Reset(ID_CURRENT_SAVE_4, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_4, RunningState), nullptr, GetSaveSlotString(4)); if (_CurrentSaveState == 4) { Item.SetItemTicked(true); } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_5, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_5, RunningState), NULL, GetSaveSlotString(5)); + Item.Reset(ID_CURRENT_SAVE_5, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_5, RunningState), nullptr, GetSaveSlotString(5)); if (_CurrentSaveState == 5) { Item.SetItemTicked(true); } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_6, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_6, RunningState), NULL, GetSaveSlotString(6)); + Item.Reset(ID_CURRENT_SAVE_6, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_6, RunningState), nullptr, GetSaveSlotString(6)); if (_CurrentSaveState == 6) { Item.SetItemTicked(true); } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_7, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_7, RunningState), NULL, GetSaveSlotString(7)); + Item.Reset(ID_CURRENT_SAVE_7, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_7, RunningState), nullptr, GetSaveSlotString(7)); if (_CurrentSaveState == 7) { Item.SetItemTicked(true); } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_8, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_8, RunningState), NULL, GetSaveSlotString(8)); + Item.Reset(ID_CURRENT_SAVE_8, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_8, RunningState), nullptr, GetSaveSlotString(8)); if (_CurrentSaveState == 8) { Item.SetItemTicked(true); } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_9, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_9, RunningState), NULL, GetSaveSlotString(9)); + Item.Reset(ID_CURRENT_SAVE_9, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_9, RunningState), nullptr, GetSaveSlotString(9)); if (_CurrentSaveState == 9) { Item.SetItemTicked(true); } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_10, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_10, RunningState), NULL, GetSaveSlotString(10)); + Item.Reset(ID_CURRENT_SAVE_10, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_10, RunningState), nullptr, GetSaveSlotString(10)); if (_CurrentSaveState == 10) { Item.SetItemTicked(true); } CurrentSaveMenu.push_back(Item); @@ -931,7 +931,7 @@ void CMainMenu::FillOutMenu(HMENU hMenu) SystemMenu.push_back(MENU_ITEM(SPLITER)); } Item.Reset(ID_SYSTEM_SWAPDISK, MENU_SWAPDISK, m_ShortCuts.ShortCutString(ID_SYSTEM_SWAPDISK, RunningState)); - if (g_Disk == NULL) { Item.SetItemEnabled(false); } + if (g_Disk == nullptr) { Item.SetItemEnabled(false); } SystemMenu.push_back(Item); SystemMenu.push_back(MENU_ITEM(SPLITER)); SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_SAVE, MENU_SAVE, m_ShortCuts.ShortCutString(ID_SYSTEM_SAVE, RunningState))); @@ -958,7 +958,7 @@ void CMainMenu::FillOutMenu(HMENU hMenu) MenuItemList OptionMenu; Item.Reset(ID_OPTIONS_FULLSCREEN, MENU_FULL_SCREEN, m_ShortCuts.ShortCutString(ID_OPTIONS_FULLSCREEN, RunningState)); Item.SetItemEnabled(CPURunning); - if (g_Plugins && g_Plugins->Gfx() && g_Plugins->Gfx()->ChangeWindow == NULL) + if (g_Plugins && g_Plugins->Gfx() && g_Plugins->Gfx()->ChangeWindow == nullptr) { Item.SetItemEnabled(false); } @@ -973,13 +973,13 @@ void CMainMenu::FillOutMenu(HMENU hMenu) OptionMenu.push_back(MENU_ITEM(SPLITER)); Item.Reset(ID_OPTIONS_CONFIG_GFX, MENU_CONFG_GFX, m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_GFX, RunningState)); - if (g_Plugins && g_Plugins->Gfx() == NULL || g_Plugins->Gfx()->DllConfig == NULL) + if (g_Plugins && g_Plugins->Gfx() == nullptr || g_Plugins->Gfx()->DllConfig == nullptr) { Item.SetItemEnabled(false); } OptionMenu.push_back(Item); Item.Reset(ID_OPTIONS_CONFIG_AUDIO, MENU_CONFG_AUDIO, m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_AUDIO, RunningState)); - if (g_Plugins->Audio() == NULL || g_Plugins->Audio()->DllConfig == NULL) + if (g_Plugins->Audio() == nullptr || g_Plugins->Audio()->DllConfig == nullptr) { Item.SetItemEnabled(false); } @@ -987,14 +987,14 @@ void CMainMenu::FillOutMenu(HMENU hMenu) if (!inBasicMode) { Item.Reset(ID_OPTIONS_CONFIG_RSP, MENU_CONFG_RSP, m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_RSP, RunningState)); - if (g_Plugins->RSP() == NULL || g_Plugins->RSP()->DllConfig == NULL) + if (g_Plugins->RSP() == nullptr || g_Plugins->RSP()->DllConfig == nullptr) { Item.SetItemEnabled(false); } OptionMenu.push_back(Item); } Item.Reset(ID_OPTIONS_CONFIG_CONT, MENU_CONFG_CTRL, m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_CONT, RunningState)); - if (g_Plugins && g_Plugins->Control() == NULL || g_Plugins->Control()->DllConfig == NULL) + if (g_Plugins && g_Plugins->Control() == nullptr || g_Plugins->Control()->DllConfig == nullptr) { Item.SetItemEnabled(false); } @@ -1013,13 +1013,13 @@ void CMainMenu::FillOutMenu(HMENU hMenu) MenuItemList DebugProfileMenu; if (HaveDebugger()) { - Item.Reset(ID_PROFILE_PROFILE, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Record Execution Times"); + Item.Reset(ID_PROFILE_PROFILE, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Record Execution Times"); if (g_Settings->LoadBool(Debugger_RecordExecutionTimes)) { Item.SetItemTicked(true); } DebugProfileMenu.push_back(Item); - Item.Reset(ID_PROFILE_RESETCOUNTER, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Reset Counters"); + Item.Reset(ID_PROFILE_RESETCOUNTER, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Reset Counters"); if (!CPURunning) { Item.SetItemEnabled(false); } DebugProfileMenu.push_back(Item); - Item.Reset(ID_PROFILE_GENERATELOG, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Generate Log File"); + Item.Reset(ID_PROFILE_GENERATELOG, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Generate Log File"); if (!CPURunning) { Item.SetItemEnabled(false); } DebugProfileMenu.push_back(Item); } @@ -1035,40 +1035,40 @@ void CMainMenu::FillOutMenu(HMENU hMenu) if (HaveDebugger()) { // Debug - Interrupt - Item.Reset(ID_DEBUGGER_INTERRUPT_SP, EMPTY_STRING, EMPTY_STDSTR, NULL, L"SP Interrupt"); + Item.Reset(ID_DEBUGGER_INTERRUPT_SP, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"SP Interrupt"); Item.SetItemEnabled(CPURunning); DebugInterrupt.push_back(Item); - Item.Reset(ID_DEBUGGER_INTERRUPT_SI, EMPTY_STRING, EMPTY_STDSTR, NULL, L"SI Interrupt"); + Item.Reset(ID_DEBUGGER_INTERRUPT_SI, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"SI Interrupt"); Item.SetItemEnabled(CPURunning); DebugInterrupt.push_back(Item); - Item.Reset(ID_DEBUGGER_INTERRUPT_AI, EMPTY_STRING, EMPTY_STDSTR, NULL, L"AI Interrupt"); + Item.Reset(ID_DEBUGGER_INTERRUPT_AI, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"AI Interrupt"); Item.SetItemEnabled(CPURunning); DebugInterrupt.push_back(Item); - Item.Reset(ID_DEBUGGER_INTERRUPT_VI, EMPTY_STRING, EMPTY_STDSTR, NULL, L"VI Interrupt"); + Item.Reset(ID_DEBUGGER_INTERRUPT_VI, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"VI Interrupt"); Item.SetItemEnabled(CPURunning); DebugInterrupt.push_back(Item); - Item.Reset(ID_DEBUGGER_INTERRUPT_PI, EMPTY_STRING, EMPTY_STDSTR, NULL, L"PI Interrupt"); + Item.Reset(ID_DEBUGGER_INTERRUPT_PI, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"PI Interrupt"); Item.SetItemEnabled(CPURunning); DebugInterrupt.push_back(Item); - Item.Reset(ID_DEBUGGER_INTERRUPT_DP, EMPTY_STRING, EMPTY_STDSTR, NULL, L"DP Interrupt"); + Item.Reset(ID_DEBUGGER_INTERRUPT_DP, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"DP Interrupt"); Item.SetItemEnabled(CPURunning); DebugInterrupt.push_back(Item); // Debug - R4300i // ID_DEBUGGER_LOGOPTIONS - Item.Reset(ID_DEBUGGER_BREAKPOINTS, EMPTY_STRING, EMPTY_STDSTR, NULL, L"&Commands..."); + Item.Reset(ID_DEBUGGER_BREAKPOINTS, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"&Commands..."); DebugR4300Menu.push_back(Item); - Item.Reset(ID_DEBUGGER_CPULOG, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Command Log..."); + Item.Reset(ID_DEBUGGER_CPULOG, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Command Log..."); DebugR4300Menu.push_back(Item); - Item.Reset(ID_DEBUGGER_EXCBREAKPOINTS, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Exceptions..."); + Item.Reset(ID_DEBUGGER_EXCBREAKPOINTS, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Exceptions..."); DebugR4300Menu.push_back(Item); - Item.Reset(ID_DEBUGGER_STACKVIEW, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Stack..."); + Item.Reset(ID_DEBUGGER_STACKVIEW, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Stack..."); DebugR4300Menu.push_back(Item); - Item.Reset(ID_DEBUGGER_STACKTRACE, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Stack Trace..."); + Item.Reset(ID_DEBUGGER_STACKTRACE, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Stack Trace..."); DebugR4300Menu.push_back(Item); - Item.Reset(ID_DEBUG_DISABLE_GAMEFIX, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Disable Game Fixes"); + Item.Reset(ID_DEBUG_DISABLE_GAMEFIX, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Disable Game Fixes"); if (g_Settings->LoadBool(Debugger_DisableGameFixes)) { Item.SetItemTicked(true); @@ -1078,112 +1078,112 @@ void CMainMenu::FillOutMenu(HMENU hMenu) DebugR4300Menu.push_back(Item); // Debug - Memory - Item.Reset(ID_DEBUGGER_MEMORY, EMPTY_STRING, EMPTY_STDSTR, NULL, L"View..."); + Item.Reset(ID_DEBUGGER_MEMORY, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"View..."); DebugMemoryMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_SEARCHMEMORY, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Search..."); + Item.Reset(ID_DEBUGGER_SEARCHMEMORY, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Search..."); DebugMemoryMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_SYMBOLS, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Symbols..."); + Item.Reset(ID_DEBUGGER_SYMBOLS, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Symbols..."); DebugMemoryMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_DUMPMEMORY, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Dump..."); + Item.Reset(ID_DEBUGGER_DUMPMEMORY, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Dump..."); DebugMemoryMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TLBENTRIES, EMPTY_STRING, EMPTY_STDSTR, NULL, L"TLB Entries..."); + Item.Reset(ID_DEBUGGER_TLBENTRIES, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"TLB Entries..."); DebugMemoryMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_DMALOG, EMPTY_STRING, EMPTY_STDSTR, NULL, L"DMA Log..."); + Item.Reset(ID_DEBUGGER_DMALOG, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"DMA Log..."); DebugMemoryMenu.push_back(Item); // Debug - App logging - Item.Reset(ID_DEBUGGER_TRACE_MD5, EMPTY_STRING, EMPTY_STDSTR, NULL, L"MD5"); + Item.Reset(ID_DEBUGGER_TRACE_MD5, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"MD5"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceMD5) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_SETTINGS, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Settings"); + Item.Reset(ID_DEBUGGER_TRACE_SETTINGS, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Settings"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceSettings) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_UNKNOWN, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Unknown"); + Item.Reset(ID_DEBUGGER_TRACE_UNKNOWN, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Unknown"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceUnknown) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_APPINIT, EMPTY_STRING, EMPTY_STDSTR, NULL, L"App Init"); + Item.Reset(ID_DEBUGGER_TRACE_APPINIT, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"App Init"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceAppInit) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_APPCLEANUP, EMPTY_STRING, EMPTY_STDSTR, NULL, L"App Cleanup"); + Item.Reset(ID_DEBUGGER_TRACE_APPCLEANUP, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"App Cleanup"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceAppCleanup) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_N64SYSTEM, EMPTY_STRING, EMPTY_STDSTR, NULL, L"N64 System"); + Item.Reset(ID_DEBUGGER_TRACE_N64SYSTEM, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"N64 System"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceN64System) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_PLUGINS, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Plugins"); + Item.Reset(ID_DEBUGGER_TRACE_PLUGINS, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Plugins"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TracePlugins) == TraceVerbose);; DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_GFXPLUGIN, EMPTY_STRING, EMPTY_STDSTR, NULL, L"GFX Plugin"); + Item.Reset(ID_DEBUGGER_TRACE_GFXPLUGIN, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"GFX Plugin"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceGFXPlugin) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_AUDIOPLUGIN, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Audio Plugin"); + Item.Reset(ID_DEBUGGER_TRACE_AUDIOPLUGIN, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Audio Plugin"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceAudioPlugin) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_CONTROLLERPLUGIN, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Controller Plugin"); + Item.Reset(ID_DEBUGGER_TRACE_CONTROLLERPLUGIN, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Controller Plugin"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceControllerPlugin) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_RSPPLUGIN, EMPTY_STRING, EMPTY_STDSTR, NULL, L"RSP Plugin"); + Item.Reset(ID_DEBUGGER_TRACE_RSPPLUGIN, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"RSP Plugin"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceRSPPlugin) == TraceVerbose);; DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_RSP, EMPTY_STRING, EMPTY_STDSTR, NULL, L"RSP"); + Item.Reset(ID_DEBUGGER_TRACE_RSP, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"RSP"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceRSP) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_AUDIO, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Audio"); + Item.Reset(ID_DEBUGGER_TRACE_AUDIO, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Audio"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceAudio) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_REGISTERCACHE, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Register Cache"); + Item.Reset(ID_DEBUGGER_TRACE_REGISTERCACHE, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Register Cache"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceRegisterCache) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_RECOMPILER, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Recompiler"); + Item.Reset(ID_DEBUGGER_TRACE_RECOMPILER, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Recompiler"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceRecompiler) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_TLB, EMPTY_STRING, EMPTY_STDSTR, NULL, L"TLB"); + Item.Reset(ID_DEBUGGER_TRACE_TLB, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"TLB"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceTLB) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_PROTECTEDMEM, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Protected MEM"); + Item.Reset(ID_DEBUGGER_TRACE_PROTECTEDMEM, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Protected MEM"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceProtectedMEM) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_TRACE_USERINTERFACE, EMPTY_STRING, EMPTY_STDSTR, NULL, L"User Interface"); + Item.Reset(ID_DEBUGGER_TRACE_USERINTERFACE, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"User Interface"); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceUserInterface) == TraceVerbose); DebugAppLoggingMenu.push_back(Item); DebugAppLoggingMenu.push_back(MENU_ITEM(SPLITER)); - Item.Reset(ID_DEBUGGER_APPLOG_FLUSH, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Auto flush file"); + Item.Reset(ID_DEBUGGER_APPLOG_FLUSH, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Auto flush file"); if (g_Settings->LoadBool(Debugger_AppLogFlush)) { Item.SetItemTicked(true); } DebugAppLoggingMenu.push_back(Item); // Debug - logging - Item.Reset(ID_DEBUGGER_LOGOPTIONS, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Log Options..."); + Item.Reset(ID_DEBUGGER_LOGOPTIONS, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Log Options..."); DebugLoggingMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_GENERATELOG, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Generate Log"); + Item.Reset(ID_DEBUGGER_GENERATELOG, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Generate Log"); if (g_Settings->LoadBool(Logging_GenerateLog)) { Item.SetItemTicked(true); } DebugLoggingMenu.push_back(Item); // Debugger main menu - Item.Reset(ID_DEBUGGER_BREAKPOINTS, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Commands..."); + Item.Reset(ID_DEBUGGER_BREAKPOINTS, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Commands..."); DebugMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_MEMORY, EMPTY_STRING, EMPTY_STDSTR, NULL, L"View Memory..."); + Item.Reset(ID_DEBUGGER_MEMORY, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"View Memory..."); DebugMenu.push_back(Item); - Item.Reset(ID_DEBUGGER_SCRIPTS, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Scripts..."); + Item.Reset(ID_DEBUGGER_SCRIPTS, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Scripts..."); DebugMenu.push_back(Item); DebugMenu.push_back(MENU_ITEM(SPLITER)); @@ -1197,33 +1197,33 @@ void CMainMenu::FillOutMenu(HMENU hMenu) DebugMenu.push_back(Item); // Debug - RSP - if (g_Plugins && g_Plugins->RSP() != NULL && IsMenu((HMENU)g_Plugins->RSP()->GetDebugMenu())) + if (g_Plugins && g_Plugins->RSP() != nullptr && IsMenu((HMENU)g_Plugins->RSP()->GetDebugMenu())) { Item.Reset(ID_PLUGIN_MENU, EMPTY_STRING, EMPTY_STDSTR, g_Plugins->RSP()->GetDebugMenu(), L"&RSP"); DebugMenu.push_back(Item); } // Debug - RDP - if (g_Plugins && g_Plugins->Gfx() != NULL && IsMenu((HMENU)g_Plugins->Gfx()->GetDebugMenu())) + if (g_Plugins && g_Plugins->Gfx() != nullptr && IsMenu((HMENU)g_Plugins->Gfx()->GetDebugMenu())) { Item.Reset(ID_PLUGIN_MENU, EMPTY_STRING, EMPTY_STDSTR, g_Plugins->Gfx()->GetDebugMenu(), L"&RDP"); DebugMenu.push_back(Item); } // Notification menu - Item.Reset(ID_DEBUG_SHOW_UNHANDLED_MEM, EMPTY_STRING, EMPTY_STDSTR, NULL, L"On Unhandled Memory Actions"); + Item.Reset(ID_DEBUG_SHOW_UNHANDLED_MEM, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"On Unhandled Memory Actions"); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { Item.SetItemTicked(true); } DebugNotificationMenu.push_back(Item); - Item.Reset(ID_DEBUG_SHOW_PIF_ERRORS, EMPTY_STRING, EMPTY_STDSTR, NULL, L"On PIF Errors"); + Item.Reset(ID_DEBUG_SHOW_PIF_ERRORS, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"On PIF Errors"); if (g_Settings->LoadBool(Debugger_ShowPifErrors)) { Item.SetItemTicked(true); } DebugNotificationMenu.push_back(Item); - Item.Reset(ID_DEBUG_SHOW_DIV_BY_ZERO, EMPTY_STRING, EMPTY_STDSTR, NULL, L"On Div By Zero"); + Item.Reset(ID_DEBUG_SHOW_DIV_BY_ZERO, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"On Div By Zero"); if (g_Settings->LoadBool(Debugger_ShowDivByZero)) { Item.SetItemTicked(true); @@ -1240,32 +1240,32 @@ void CMainMenu::FillOutMenu(HMENU hMenu) Item.Reset(SUB_MENU, EMPTY_STRING, EMPTY_STDSTR, &DebugNotificationMenu, L"Notification"); DebugMenu.push_back(Item); DebugMenu.push_back(MENU_ITEM(SPLITER)); - Item.Reset(ID_DEBUG_SHOW_TLB_MISSES, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Show TLB Misses"); + Item.Reset(ID_DEBUG_SHOW_TLB_MISSES, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Show TLB Misses"); if (g_Settings->LoadBool(Debugger_ShowTLBMisses)) { Item.SetItemTicked(true); } DebugMenu.push_back(Item); - Item.Reset(ID_DEBUG_SHOW_DLIST_COUNT, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Display Alist/Dlist Count"); + Item.Reset(ID_DEBUG_SHOW_DLIST_COUNT, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Display Alist/Dlist Count"); if (g_Settings->LoadBool(Debugger_ShowDListAListCount)) { Item.SetItemTicked(true); } DebugMenu.push_back(Item); - Item.Reset(ID_DEBUG_LANGUAGE, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Debug Language"); + Item.Reset(ID_DEBUG_LANGUAGE, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Debug Language"); if (g_Settings->LoadBool(Debugger_DebugLanguage)) { Item.SetItemTicked(true); } DebugMenu.push_back(Item); - Item.Reset(ID_DEBUG_SHOW_RECOMP_MEM_SIZE, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Display Recompiler Code Buffer Size"); + Item.Reset(ID_DEBUG_SHOW_RECOMP_MEM_SIZE, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Display Recompiler Code Buffer Size"); if (g_Settings->LoadBool(Debugger_ShowRecompMemSize)) { Item.SetItemTicked(true); } DebugMenu.push_back(Item); DebugMenu.push_back(MENU_ITEM(SPLITER)); - Item.Reset(ID_DEBUG_RECORD_RECOMPILER_ASM, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Record Recompiler ASM"); + Item.Reset(ID_DEBUG_RECORD_RECOMPILER_ASM, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Record Recompiler ASM"); if (g_Settings->LoadBool(Debugger_RecordRecompilerAsm)) { Item.SetItemTicked(true); @@ -1351,11 +1351,11 @@ void CMainMenu::ResetMenu(void) m_Gui->SetWindowMenu(this); WriteTrace(TraceUserInterface, TraceDebug, "Remove plugin menu"); - if (g_Plugins->Gfx() != NULL && IsMenu((HMENU)g_Plugins->Gfx()->GetDebugMenu())) + if (g_Plugins->Gfx() != nullptr && IsMenu((HMENU)g_Plugins->Gfx()->GetDebugMenu())) { RemoveMenu((HMENU)OldMenuHandle, (DWORD)g_Plugins->Gfx()->GetDebugMenu(), MF_BYCOMMAND); } - if (g_Plugins->RSP() != NULL && IsMenu((HMENU)g_Plugins->RSP()->GetDebugMenu())) + if (g_Plugins->RSP() != nullptr && IsMenu((HMENU)g_Plugins->RSP()->GetDebugMenu())) { RemoveMenu((HMENU)OldMenuHandle, (DWORD)g_Plugins->RSP()->GetDebugMenu(), MF_BYCOMMAND); } diff --git a/Source/Project64/UserInterface/MainWindow.cpp b/Source/Project64/UserInterface/MainWindow.cpp index b3f81c7d5..31614873c 100644 --- a/Source/Project64/UserInterface/MainWindow.cpp +++ b/Source/Project64/UserInterface/MainWindow.cpp @@ -22,9 +22,9 @@ CMainGui::CMainGui(bool bMainWindow, const char * WindowTitle) : m_AttachingMenu(false), m_MakingVisible(false), m_ResetPlugins(false), - m_ResetInfo(NULL) + m_ResetInfo(nullptr) { - m_Menu = NULL; + m_Menu = nullptr; m_hMainWindow = 0; m_hStatusWnd = 0; @@ -98,13 +98,13 @@ bool CMainGui::RegisterWinClass(void) wcl.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; wcl.cbClsExtra = 0; wcl.cbWndExtra = 0; - wcl.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_PJ64_Icon)); - wcl.hCursor = LoadCursor(NULL, IDC_ARROW); - wcl.hInstance = GetModuleHandle(NULL); + wcl.hIcon = LoadIcon(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_PJ64_Icon)); + wcl.hCursor = LoadCursor(nullptr, IDC_ARROW); + wcl.hInstance = GetModuleHandle(nullptr); wcl.lpfnWndProc = (WNDPROC)MainGui_Proc; wcl.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); - wcl.lpszMenuName = NULL; + wcl.lpszMenuName = nullptr; wcl.lpszClassName = VersionDisplay.c_str(); if (RegisterClass(&wcl) == 0) return false; return true; @@ -247,7 +247,7 @@ void CMainGui::GameCpuRunning(CMainGui * Gui) } else { - if (Gui->m_CheatsUI.m_hWnd != NULL) + if (Gui->m_CheatsUI.m_hWnd != nullptr) { Gui->m_CheatsUI.SendMessage(WM_COMMAND, MAKELONG(IDCANCEL, 0)); } @@ -310,7 +310,7 @@ void CMainGui::ChangeWinSize(long width, long height) SetRect(&rc1, 0, 0, width, height); } - AdjustWindowRectEx(&rc1, GetWindowLong(m_hMainWindow, GWL_STYLE), GetMenu(m_hMainWindow) != NULL, GetWindowLong(m_hMainWindow, GWL_EXSTYLE)); + AdjustWindowRectEx(&rc1, GetWindowLong(m_hMainWindow, GWL_STYLE), GetMenu(m_hMainWindow) != nullptr, GetWindowLong(m_hMainWindow, GWL_EXSTYLE)); MoveWindow(m_hMainWindow, wndpl.rcNormalPosition.left, wndpl.rcNormalPosition.top, rc1.right - rc1.left, rc1.bottom - rc1.top, TRUE); } @@ -322,7 +322,7 @@ void * CMainGui::GetStatusBar(void) const void * CMainGui::GetModuleInstance(void) const { - return GetModuleHandle(NULL); + return GetModuleHandle(nullptr); } bool CMainGui::ResetPluginsInUiThread(CPlugins * plugins, CN64System * System) @@ -330,7 +330,7 @@ bool CMainGui::ResetPluginsInUiThread(CPlugins * plugins, CN64System * System) RESET_PLUGIN info; info.system = System; info.plugins = plugins; - info.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + info.hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); bool bRes = true; if (info.hEvent) { @@ -389,8 +389,8 @@ void CMainGui::Create(const char * WindowTitle) stdstr_f VersionDisplay("Project64 %s", VER_FILE_VERSION_STR); m_hMainWindow = CreateWindowEx(WS_EX_ACCEPTFILES, VersionDisplay.ToUTF16().c_str(), stdstr(WindowTitle).ToUTF16().c_str(), WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_SYSMENU | WS_MINIMIZEBOX, 5, 5, 640, 480, - NULL, NULL, GetModuleHandle(NULL), this); - m_Created = m_hMainWindow != NULL; + nullptr, nullptr, GetModuleHandle(nullptr), this); + m_Created = m_hMainWindow != nullptr; } void CMainGui::CreateStatusBar(void) @@ -404,17 +404,17 @@ WPARAM CMainGui::ProcessAllMessages(void) { MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) + while (GetMessage(&msg, nullptr, 0, 0)) { if (m_ResetPlugins) { m_ResetPlugins = false; m_ResetInfo->res = m_ResetInfo->plugins->Reset(m_ResetInfo->system); SetEvent(m_ResetInfo->hEvent); - m_ResetInfo = NULL; + m_ResetInfo = nullptr; } - if ((m_CheatsUI.m_hWnd != NULL && IsDialogMessage(m_CheatsUI.m_hWnd, &msg)) || - (m_EnhancementUI.m_hWnd != NULL && IsDialogMessage(m_EnhancementUI.m_hWnd, &msg))) + if ((m_CheatsUI.m_hWnd != nullptr && IsDialogMessage(m_CheatsUI.m_hWnd, &msg)) || + (m_EnhancementUI.m_hWnd != nullptr && IsDialogMessage(m_EnhancementUI.m_hWnd, &msg))) { continue; } @@ -429,7 +429,7 @@ bool CMainGui::ProcessGuiMessages(void) { MSG msg; - while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) + while (PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE)) { if (m_ResetPlugins) { @@ -439,7 +439,7 @@ bool CMainGui::ProcessGuiMessages(void) { return true; } - PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); + PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE); if (m_Menu->ProcessAccelerator(m_hMainWindow, &msg)) { continue; } TranslateMessage(&msg); DispatchMessage(&msg); @@ -508,14 +508,14 @@ float CMainGui::DPIScale(HWND hWnd) void CMainGui::SetPos(int X, int Y) { - SetWindowPos(m_hMainWindow, NULL, X, Y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + SetWindowPos(m_hMainWindow, nullptr, X, Y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); } void CMainGui::SetWindowMenu(CBaseMenu * Menu) { m_AttachingMenu = true; - HMENU hMenu = NULL; + HMENU hMenu = nullptr; { CGuard Guard(m_CS); m_Menu = Menu; @@ -686,7 +686,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO _this->m_SaveMainWindowLeft = WinRect.left; } KillTimer(hWnd, Timer_SetWindowPos); - SetTimer(hWnd, Timer_SetWindowPos, 1000, NULL); + SetTimer(hWnd, Timer_SetWindowPos, 1000, nullptr); } if (CGuiSettings::bCPURunning() && g_BaseSystem) { @@ -734,7 +734,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO case WM_NOTIFY: { CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class"); - if (_this == NULL || !_this->RomBrowserVisible() || !_this->RomListNotify(wParam, lParam)) + if (_this == nullptr || !_this->RomBrowserVisible() || !_this->RomListNotify(wParam, lParam)) { return DefWindowProc(hWnd, uMsg, wParam, lParam); } @@ -763,7 +763,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO // Plugins->Gfx()->DrawScreen(); // } // } - ValidateRect(hWnd, NULL); + ValidateRect(hWnd, nullptr); } break; case WM_KEYUP: @@ -887,7 +887,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO case WM_RESET_PLUGIN: { CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class"); - if (_this->m_ResetInfo != NULL) + if (_this->m_ResetInfo != nullptr) { g_Notify->BreakPoint(__FILE__, __LINE__); } @@ -912,7 +912,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO case WM_COMMAND: { CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class"); - if (_this == NULL) { break; } + if (_this == nullptr) { break; } switch (LOWORD(wParam)) { case ID_POPUPMENU_PLAYGAME: @@ -1029,7 +1029,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO } else if (LOWORD(wParam) > 5200 && LOWORD(wParam) <= 5300) { - if (g_Plugins->Gfx() && g_Plugins->Gfx()->OnRomBrowserMenuItem != NULL) + if (g_Plugins->Gfx() && g_Plugins->Gfx()->OnRomBrowserMenuItem != nullptr) { CN64Rom Rom; if (!Rom.LoadN64Image(_this->CurrentedSelectedRom(), true)) @@ -1087,7 +1087,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO { Notify().WindowMode(); } - _this->m_hMainWindow = NULL; + _this->m_hMainWindow = nullptr; WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - 1"); if (_this->m_bMainWindow) { diff --git a/Source/Project64/UserInterface/MenuClass.h b/Source/Project64/UserInterface/MenuClass.h index 651e68de6..67257c3e6 100644 --- a/Source/Project64/UserInterface/MenuClass.h +++ b/Source/Project64/UserInterface/MenuClass.h @@ -18,12 +18,12 @@ public: Reset(NO_ID); } MENU_ITEM ( int ID, LanguageStringID Title = EMPTY_STRING, const std::wstring & ShortCut = EMPTY_STDSTR, - void * SubMenu = NULL, const std::wstring & ManualString = EMPTY_STDSTR) + void * SubMenu = nullptr, const std::wstring & ManualString = EMPTY_STDSTR) { Reset(ID,Title,ShortCut,SubMenu,ManualString); } void Reset ( int ID, LanguageStringID Title = EMPTY_STRING, const std::wstring & ShortCut2 = EMPTY_STDSTR, - void * SubMenu = NULL, const std::wstring & ManualString = EMPTY_STDSTR) + void * SubMenu = nullptr, const std::wstring & ManualString = EMPTY_STDSTR) { this->m_ID = ID; this->m_Title = Title; diff --git a/Source/Project64/UserInterface/MenuShortCuts.cpp b/Source/Project64/UserInterface/MenuShortCuts.cpp index 6c934ecfe..f29fdeca6 100644 --- a/Source/Project64/UserInterface/MenuShortCuts.cpp +++ b/Source/Project64/UserInterface/MenuShortCuts.cpp @@ -485,7 +485,7 @@ void CShortCuts::Load(bool InitialValues) do { char Line[300]; - if (fgets(Line, sizeof(Line), file) != NULL) + if (fgets(Line, sizeof(Line), file) != nullptr) { sscanf(Line, "%d,%d,%d,%d,%d,%d,%d,%d", &ID, &key, &bCtrl, &bAlt, &bShift, &AccessMode, &bUserAdded, &bInactive); @@ -506,7 +506,7 @@ void CShortCuts::Save(void) stdstr FileName = UISettingsLoadStringVal(SupportFile_ShortCuts); FILE *file = fopen(FileName.c_str(), "w"); - if (file == NULL) + if (file == nullptr) { return; } diff --git a/Source/Project64/UserInterface/Notification.cpp b/Source/Project64/UserInterface/Notification.cpp index e98b64963..0e88207aa 100644 --- a/Source/Project64/UserInterface/Notification.cpp +++ b/Source/Project64/UserInterface/Notification.cpp @@ -8,8 +8,8 @@ CNotificationImp & Notify(void) } CNotificationImp::CNotificationImp() : - m_hWnd(NULL), - m_gfxPlugin(NULL), + m_hWnd(nullptr), + m_gfxPlugin(nullptr), m_NextMsg(0) { _tzset(); @@ -51,7 +51,7 @@ void CNotificationImp::WindowMode(void) const void CNotificationImp::DisplayWarning(const char * Message) const { - HWND Parent = NULL; + HWND Parent = nullptr; if (m_hWnd) { Parent = reinterpret_cast(m_hWnd->GetWindowHandle()); @@ -74,7 +74,7 @@ void CNotificationImp::DisplayError(const char * Message) const WriteTrace(TraceUserInterface, TraceError, Message); WindowMode(); - HWND Parent = NULL; + HWND Parent = nullptr; if (m_hWnd) { Parent = reinterpret_cast(m_hWnd->GetWindowHandle()); @@ -93,7 +93,7 @@ void CNotificationImp::DisplayMessage(int DisplayTime, const char * Message) con if (m_NextMsg > 0 || DisplayTime > 0) { - time_t Now = time(NULL); + time_t Now = time(nullptr); if (DisplayTime == 0 && Now < m_NextMsg) { return; @@ -135,7 +135,7 @@ bool CNotificationImp::AskYesNoQuestion(const char * Question) const WriteTrace(TraceUserInterface, TraceError, Question); WindowMode(); - HWND Parent = NULL; + HWND Parent = nullptr; if (m_hWnd) { Parent = reinterpret_cast(m_hWnd->GetWindowHandle()); @@ -159,7 +159,7 @@ void CNotificationImp::FatalError(const char * Message) const WriteTrace(TraceUserInterface, TraceError, Message); WindowMode(); - HWND Parent = NULL; + HWND Parent = nullptr; if (m_hWnd) { Parent = reinterpret_cast(m_hWnd->GetWindowHandle()); } MessageBox(Parent, stdstr(Message).ToUTF16().c_str(), L"Error", MB_OK | MB_ICONERROR | MB_SETFOREGROUND); ExitThread(0); @@ -209,20 +209,20 @@ void CNotificationImp::AddRecentDir(const char * RomDir) void CNotificationImp::RefreshMenu(void) { - if (m_hWnd == NULL) { return; } + if (m_hWnd == nullptr) { return; } m_hWnd->RefreshMenu(); } void CNotificationImp::HideRomBrowser(void) { - if (m_hWnd == NULL) { return; } + if (m_hWnd == nullptr) { return; } m_hWnd->HideRomList(); } void CNotificationImp::ShowRomBrowser(void) { - if (m_hWnd == NULL) { return; } + if (m_hWnd == nullptr) { return; } if (UISettingsLoadBool(RomBrowser_Enabled)) { //Display the ROM browser @@ -233,20 +233,20 @@ void CNotificationImp::ShowRomBrowser(void) void CNotificationImp::BringToTop(void) { - if (m_hWnd == NULL) { return; } + if (m_hWnd == nullptr) { return; } m_hWnd->BringToTop(); } void CNotificationImp::ChangeFullScreen(void) const { - if (m_hWnd == NULL) { return; } + if (m_hWnd == nullptr) { return; } SendMessage((HWND)(m_hWnd->GetWindowHandle()), WM_COMMAND, MAKELPARAM(ID_OPTIONS_FULLSCREEN2, false), 0); } bool CNotificationImp::ProcessGuiMessages(void) const { - if (m_hWnd == NULL) { return false; } + if (m_hWnd == nullptr) { return false; } return m_hWnd->ProcessGuiMessages(); } diff --git a/Source/Project64/UserInterface/ProjectSupport.cpp b/Source/Project64/UserInterface/ProjectSupport.cpp index fb4ad2439..ed8a80e98 100644 --- a/Source/Project64/UserInterface/ProjectSupport.cpp +++ b/Source/Project64/UserInterface/ProjectSupport.cpp @@ -94,7 +94,7 @@ std::string CProjectSupport::GenerateMachineID(void) GetVolumePathName(SysPath, VolumePath, sizeof(VolumePath) / sizeof(VolumePath[0])); DWORD SerialNumber = 0; - GetVolumeInformation(VolumePath, NULL, NULL, &SerialNumber, NULL, NULL, NULL, NULL); + GetVolumeInformation(VolumePath, nullptr, NULL, &SerialNumber, nullptr, nullptr, nullptr, NULL); wchar_t MachineGuid[200] = { 0 }; HKEY hKey; @@ -154,7 +154,7 @@ bool CProjectSupport::PerformRequest(const wchar_t * Url, const std::string & Po L"text/*", nullptr }; - HINTERNET hRequest = HttpOpenRequest(hConnect, L"POST", Url, NULL, NULL, lpszAcceptTypes, INTERNET_FLAG_SECURE | INTERNET_FLAG_NO_AUTO_REDIRECT | INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_NO_CACHE_WRITE, (LPARAM)0); + HINTERNET hRequest = HttpOpenRequest(hConnect, L"POST", Url, nullptr, nullptr, lpszAcceptTypes, INTERNET_FLAG_SECURE | INTERNET_FLAG_NO_AUTO_REDIRECT | INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_NO_CACHE_WRITE, (LPARAM)0); if (hRequest == nullptr) { InternetCloseHandle(hRequest); @@ -169,17 +169,17 @@ bool CProjectSupport::PerformRequest(const wchar_t * Url, const std::string & Po } DWORD StatusCodeSize = sizeof(StatusCode); - if (!HttpQueryInfo(hRequest, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &StatusCode, &StatusCodeSize, NULL)) + if (!HttpQueryInfo(hRequest, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &StatusCode, &StatusCodeSize, nullptr)) { InternetCloseHandle(hRequest); return false; } DWORD dwSize = 0; - if (!HttpQueryInfo(hRequest, HTTP_QUERY_RAW_HEADERS_CRLF, NULL, &dwSize, NULL) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) + if (!HttpQueryInfo(hRequest, HTTP_QUERY_RAW_HEADERS_CRLF, nullptr, &dwSize, nullptr) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { std::vector RawHeaderData(dwSize); - if (!HttpQueryInfo(hRequest, HTTP_QUERY_RAW_HEADERS_CRLF, RawHeaderData.data(), &dwSize, NULL)) + if (!HttpQueryInfo(hRequest, HTTP_QUERY_RAW_HEADERS_CRLF, RawHeaderData.data(), &dwSize, nullptr)) { InternetCloseHandle(hRequest); return false; @@ -229,7 +229,7 @@ void CProjectSupport::SaveSupportInfo(void) HKEY hKeyResults = 0; DWORD Disposition = 0; - long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, L"SOFTWARE\\Project64", 0, L"", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKeyResults, &Disposition); + long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, L"SOFTWARE\\Project64", 0, L"", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, nullptr, &hKeyResults, &Disposition); if (lResult == ERROR_SUCCESS) { RegSetValueEx(hKeyResults, L"user", 0, REG_BINARY, (BYTE *)OutData.data(), OutData.size()); @@ -247,20 +247,20 @@ void CProjectSupport::LoadSupportInfo(void) if (lResult == ERROR_SUCCESS) { DWORD DataSize = 0; - if (RegQueryValueEx(hKeyResults, L"user", NULL, NULL, NULL, &DataSize) == ERROR_SUCCESS) + if (RegQueryValueEx(hKeyResults, L"user", nullptr, nullptr, nullptr, &DataSize) == ERROR_SUCCESS) { InData.resize(DataSize); - if (RegQueryValueEx(hKeyResults, L"user", NULL, NULL, InData.data(), &DataSize) != ERROR_SUCCESS) + if (RegQueryValueEx(hKeyResults, L"user", nullptr, nullptr, InData.data(), &DataSize) != ERROR_SUCCESS) { InData.clear(); } } } - if (hKeyResults != NULL) + if (hKeyResults != nullptr) { RegCloseKey(hKeyResults); - NULL; + nullptr; } std::vector OutData; diff --git a/Source/Project64/UserInterface/RomBrowserClass.cpp b/Source/Project64/UserInterface/RomBrowserClass.cpp index cb2416147..a948d4fcb 100644 --- a/Source/Project64/UserInterface/RomBrowserClass.cpp +++ b/Source/Project64/UserInterface/RomBrowserClass.cpp @@ -12,8 +12,8 @@ CRomBrowser::CRomBrowser(HWND & MainWindow, HWND & StatusWindow) : m_ShowingRomBrowser(false), m_AllowSelectionLastRom(true), m_WatchThreadID(0), - m_WatchThread(NULL), - m_WatchStopEvent(NULL) + m_WatchThread(nullptr), + m_WatchStopEvent(nullptr) { m_hRomList = 0; m_Visible = false; @@ -273,7 +273,7 @@ void CRomBrowser::RomListReset(void) WriteTrace(TraceUserInterface, TraceDebug, "1"); ListView_DeleteAllItems(m_hRomList); WriteTrace(TraceUserInterface, TraceDebug, "2"); - InvalidateRect(m_hRomList, NULL, TRUE); + InvalidateRect(m_hRomList, nullptr, TRUE); Sleep(100); WriteTrace(TraceUserInterface, TraceDebug, "3"); m_LastRom = UISettingsLoadStringIndex(File_RecentGameFileIndex, 0); @@ -290,7 +290,7 @@ void CRomBrowser::RomListReset(void) void CRomBrowser::CreateRomListControl(void) { - m_hRomList = CreateWindow(WC_LISTVIEW, NULL, WS_TABSTOP | WS_VISIBLE | WS_CHILD | LVS_OWNERDRAWFIXED | LVS_SINGLESEL | LVS_REPORT, 0, 0, 0, 0, m_MainWindow, (HMENU)IDC_ROMLIST, GetModuleHandle(NULL), NULL); + m_hRomList = CreateWindow(WC_LISTVIEW, nullptr, WS_TABSTOP | WS_VISIBLE | WS_CHILD | LVS_OWNERDRAWFIXED | LVS_SINGLESEL | LVS_REPORT, 0, 0, 0, 0, m_MainWindow, (HMENU)IDC_ROMLIST, GetModuleHandle(nullptr), nullptr); ResetRomBrowserColomuns(); LoadRomList(); } @@ -362,7 +362,7 @@ void CRomBrowser::MenuSetText(HMENU hMenu, int32_t MenuPos, const wchar_t * Titl MENUITEMINFO MenuInfo; wchar_t String[256]; - if (Title == NULL || wcslen(Title) == 0) { return; } + if (Title == nullptr || wcslen(Title) == 0) { return; } memset(&MenuInfo, 0, sizeof(MENUITEMINFO)); MenuInfo.cbSize = sizeof(MENUITEMINFO); @@ -374,7 +374,7 @@ void CRomBrowser::MenuSetText(HMENU hMenu, int32_t MenuPos, const wchar_t * Titl GetMenuItemInfo(hMenu, MenuPos, TRUE, &MenuInfo); wcscpy(String, Title); - if (wcschr(String, '\t') != NULL) { *(wcschr(String, '\t')) = '\0'; } + if (wcschr(String, '\t') != nullptr) { *(wcschr(String, '\t')) = '\0'; } if (ShortCut) { swprintf(String, sizeof(String) / sizeof(String[0]), L"%s\t%s", String, stdstr(ShortCut).ToUTF16().c_str()); } SetMenuItemInfo(hMenu, MenuPos, TRUE, &MenuInfo); } @@ -487,7 +487,7 @@ bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam) return true; } ROM_INFO * pRomInfo = &m_RomInfo[lvItem.lParam]; - if (pRomInfo == NULL) + if (pRomInfo == nullptr) { return true; } @@ -633,14 +633,14 @@ int32_t CALLBACK CRomBrowser::RomList_CompareItems(uint32_t lParam1, uint32_t lP ROM_INFO * pRomInfo2 = &_this->m_RomInfo[SortFieldInfo->KeyAscend ? lParam2 : lParam1]; int32_t result; - const char * GoodName1 = NULL, *GoodName2 = NULL; + const char * GoodName1 = nullptr, *GoodName2 = nullptr; if (SortFieldInfo->Key == RB_GoodName) { GoodName1 = strcmp("#340#", pRomInfo1->GoodName) != 0 ? pRomInfo1->GoodName : m_UnknownGoodName.c_str(); GoodName2 = strcmp("#340#", pRomInfo2->GoodName) != 0 ? pRomInfo2->GoodName : m_UnknownGoodName.c_str(); } - const char * Name1 = NULL, *Name2 = NULL; + const char * Name1 = nullptr, *Name2 = nullptr; if (SortFieldInfo->Key == RB_Name) { Name1 = strcmp("#321#", pRomInfo1->Name) != 0 ? pRomInfo1->GoodName : pRomInfo1->FileName; @@ -685,7 +685,7 @@ void CRomBrowser::RomList_GetDispInfo(uint32_t pnmh) ROM_INFO * pRomInfo = &m_RomInfo[lpdi->item.lParam]; - if (pRomInfo == NULL) + if (pRomInfo == nullptr) { wcscpy(lpdi->item.pszText, L" "); return; @@ -772,7 +772,7 @@ void CRomBrowser::RomList_GetDispInfo(uint32_t pnmh) break; default: wcsncpy(lpdi->item.pszText, L" ", lpdi->item.cchTextMax); } - if (lpdi->item.pszText == NULL || wcslen(lpdi->item.pszText) == 0) { lpdi->item.pszText = L" "; } + if (lpdi->item.pszText == nullptr || wcslen(lpdi->item.pszText) == 0) { lpdi->item.pszText = L" "; } } void CRomBrowser::RomList_OpenRom(uint32_t /*pnmh*/) @@ -825,19 +825,19 @@ void CRomBrowser::RomList_PopupMenu(uint32_t /*pnmh*/) } // Load the menu - HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_POPUP)); + HMENU hMenu = LoadMenu(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDR_POPUP)); HMENU hPopupMenu = (HMENU)GetSubMenu(hMenu, 0); // Fix up menu - MenuSetText(hPopupMenu, 0, wGS(POPUP_PLAY).c_str(), NULL); - MenuSetText(hPopupMenu, 1, wGS(POPUP_PLAYDISK).c_str(), NULL); - MenuSetText(hPopupMenu, 3, wGS(MENU_REFRESH).c_str(), NULL); - MenuSetText(hPopupMenu, 4, wGS(MENU_CHOOSE_ROM).c_str(), NULL); - MenuSetText(hPopupMenu, 6, wGS(POPUP_INFO).c_str(), NULL); - MenuSetText(hPopupMenu, 7, wGS(POPUP_GFX_PLUGIN).c_str(), NULL); - MenuSetText(hPopupMenu, 9, wGS(POPUP_SETTINGS).c_str(), NULL); - MenuSetText(hPopupMenu, 10, wGS(POPUP_CHEATS).c_str(), NULL); - MenuSetText(hPopupMenu, 11, wGS(POPUP_ENHANCEMENTS).c_str(), NULL); + MenuSetText(hPopupMenu, 0, wGS(POPUP_PLAY).c_str(), nullptr); + MenuSetText(hPopupMenu, 1, wGS(POPUP_PLAYDISK).c_str(), nullptr); + MenuSetText(hPopupMenu, 3, wGS(MENU_REFRESH).c_str(), nullptr); + MenuSetText(hPopupMenu, 4, wGS(MENU_CHOOSE_ROM).c_str(), nullptr); + MenuSetText(hPopupMenu, 6, wGS(POPUP_INFO).c_str(), nullptr); + MenuSetText(hPopupMenu, 7, wGS(POPUP_GFX_PLUGIN).c_str(), nullptr); + MenuSetText(hPopupMenu, 9, wGS(POPUP_SETTINGS).c_str(), nullptr); + MenuSetText(hPopupMenu, 10, wGS(POPUP_CHEATS).c_str(), nullptr); + MenuSetText(hPopupMenu, 11, wGS(POPUP_ENHANCEMENTS).c_str(), nullptr); if (m_SelectedRom.size() == 0) { @@ -864,7 +864,7 @@ void CRomBrowser::RomList_PopupMenu(uint32_t /*pnmh*/) if (inBasicMode && !CheatsRemembered) { DeleteMenu(hPopupMenu, 8, MF_BYPOSITION); } DeleteMenu(hPopupMenu, 7, MF_BYPOSITION); if ((CPath(m_SelectedRom).GetExtension() == "ndd") || (CPath(m_SelectedRom).GetExtension() == "d64")) { DeleteMenu(hPopupMenu, 1, MF_BYPOSITION); } - if (!inBasicMode && g_Plugins && g_Plugins->Gfx() && g_Plugins->Gfx()->GetRomBrowserMenu != NULL) + if (!inBasicMode && g_Plugins && g_Plugins->Gfx() && g_Plugins->Gfx()->GetRomBrowserMenu != nullptr) { HMENU GfxMenu = (HMENU)g_Plugins->Gfx()->GetRomBrowserMenu(); if (GfxMenu) @@ -884,7 +884,7 @@ void CRomBrowser::RomList_PopupMenu(uint32_t /*pnmh*/) GetCursorPos(&Mouse); // Show the menu - TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0, m_MainWindow, NULL); + TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0, m_MainWindow, nullptr); DestroyMenu(hMenu); } @@ -914,7 +914,7 @@ void CRomBrowser::SaveRomListColoumnInfo(void) { WriteTrace(TraceUserInterface, TraceDebug, "Start"); // if (!RomBrowserVisible()) { return; } - if (g_Settings == NULL) { return; } + if (g_Settings == nullptr) { return; } LV_COLUMN lvColumn; @@ -972,14 +972,14 @@ void CRomBrowser::SelectRomDir(void) WriteTrace(TraceUserInterface, TraceDebug, "1"); stdstr RomDir = g_Settings->LoadStringVal(RomList_GameDir).c_str(); bi.hwndOwner = m_MainWindow; - bi.pidlRoot = NULL; + bi.pidlRoot = nullptr; bi.pszDisplayName = SelectedDir; bi.lpszTitle = title.c_str(); bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; bi.lpfn = (BFFCALLBACK)SelectRomDirCallBack; bi.lParam = (uint32_t)RomDir.c_str(); WriteTrace(TraceUserInterface, TraceDebug, "2"); - if ((pidl = SHBrowseForFolder(&bi)) != NULL) + if ((pidl = SHBrowseForFolder(&bi)) != nullptr) { WriteTrace(TraceUserInterface, TraceDebug, "3"); char Directory[_MAX_PATH]; @@ -1022,7 +1022,7 @@ void CRomBrowser::FixRomListWindow(void) UISettingsLoadDword(RomBrowser_Top, (uint32_t &)Y); UISettingsLoadDword(RomBrowser_Left, (uint32_t &)X); - SetWindowPos(m_MainWindow, NULL, X, Y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + SetWindowPos(m_MainWindow, nullptr, X, Y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); // Fix height and width int32_t Width = UISettingsLoadDword(RomBrowser_Width); @@ -1041,7 +1041,7 @@ void CRomBrowser::FixRomListWindow(void) int32_t WindowHeight = rcClient.bottom - rcClient.top; int32_t WindowWidth = rcClient.right - rcClient.left; - SetWindowPos(m_MainWindow, NULL, 0, 0, WindowWidth, WindowHeight, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(m_MainWindow, nullptr, 0, 0, WindowWidth, WindowHeight, SWP_NOMOVE | SWP_NOZORDER); } void CRomBrowser::ShowRomList(void) @@ -1049,7 +1049,7 @@ void CRomBrowser::ShowRomList(void) if (m_Visible || g_Settings->LoadBool(GameRunning_CPU_Running)) { return; } m_ShowingRomBrowser = true; WatchThreadStop(); - if (m_hRomList == NULL) { CreateRomListControl(); } + if (m_hRomList == nullptr) { CreateRomListControl(); } EnableWindow(m_hRomList, TRUE); ShowWindow(m_hRomList, SW_SHOW); FixRomListWindow(); @@ -1068,7 +1068,7 @@ void CRomBrowser::ShowRomList(void) ResizeRomList((WORD)rcWindow.right, (WORD)rcWindow.bottom); } - InvalidateRect(m_hRomList, NULL, TRUE); + InvalidateRect(m_hRomList, nullptr, TRUE); // Start thread to watch for directory change WatchThreadStart(); @@ -1103,7 +1103,7 @@ void CRomBrowser::HideRomList(void) int32_t Y = (GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2; UISettingsLoadDword(UserInterface_MainWindowTop, (uint32_t &)Y); UISettingsLoadDword(UserInterface_MainWindowLeft, (uint32_t &)X); - SetWindowPos(m_MainWindow, NULL, X, Y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + SetWindowPos(m_MainWindow, nullptr, X, Y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); // Mark the window as not visible m_Visible = false; @@ -1203,7 +1203,7 @@ void CRomBrowser::WatchRomDirChanged(CRomBrowser * _this) void CRomBrowser::WatchThreadStart(void) { - if (m_WatchThread != NULL) + if (m_WatchThread != nullptr) { // Thread already running return; @@ -1211,18 +1211,18 @@ void CRomBrowser::WatchThreadStart(void) WriteTrace(TraceUserInterface, TraceDebug, "1"); WatchThreadStop(); WriteTrace(TraceUserInterface, TraceDebug, "2"); - if (m_WatchStopEvent == NULL) + if (m_WatchStopEvent == nullptr) { - m_WatchStopEvent = CreateEvent(NULL, true, false, NULL); + m_WatchStopEvent = CreateEvent(nullptr, true, false, nullptr); } WriteTrace(TraceUserInterface, TraceDebug, "3"); - m_WatchThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WatchRomDirChanged, this, 0, &m_WatchThreadID); + m_WatchThread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)WatchRomDirChanged, this, 0, &m_WatchThreadID); WriteTrace(TraceUserInterface, TraceDebug, "4"); } void CRomBrowser::WatchThreadStop(void) { - if (m_WatchThread == NULL) + if (m_WatchThread == nullptr) { return; } @@ -1249,8 +1249,8 @@ void CRomBrowser::WatchThreadStop(void) CloseHandle(m_WatchThread); CloseHandle(m_WatchStopEvent); - m_WatchStopEvent = NULL; - m_WatchThread = NULL; + m_WatchStopEvent = nullptr; + m_WatchThread = nullptr; m_WatchThreadID = 0; WriteTrace(TraceUserInterface, TraceDebug, "5"); } diff --git a/Source/Project64/UserInterface/RomInformationClass.cpp b/Source/Project64/UserInterface/RomInformationClass.cpp index 6f7647512..66c16a43e 100644 --- a/Source/Project64/UserInterface/RomInformationClass.cpp +++ b/Source/Project64/UserInterface/RomInformationClass.cpp @@ -6,8 +6,8 @@ RomInformation::RomInformation(const char * RomFile) : m_DeleteRomInfo(true), m_DeleteDiskInfo(true), m_FileName(RomFile ? RomFile : ""), - m_pRomInfo(NULL), - m_pDiskInfo(NULL) + m_pRomInfo(nullptr), + m_pDiskInfo(nullptr) { if (m_FileName.length() == 0) { return; } if ((CPath(m_FileName).GetExtension() != "ndd") && (CPath(m_FileName).GetExtension() != "d64")) @@ -16,7 +16,7 @@ RomInformation::RomInformation(const char * RomFile) : if (!m_pRomInfo->LoadN64Image(m_FileName.c_str())) { delete m_pRomInfo; - m_pRomInfo = NULL; + m_pRomInfo = nullptr; return; } } @@ -26,7 +26,7 @@ RomInformation::RomInformation(const char * RomFile) : if (!m_pDiskInfo->LoadDiskImage(m_FileName.c_str())) { delete m_pDiskInfo; - m_pDiskInfo = NULL; + m_pDiskInfo = nullptr; return; } } @@ -37,7 +37,7 @@ RomInformation::RomInformation(CN64Rom * RomInfo) : m_DeleteDiskInfo(false), m_FileName(RomInfo ? RomInfo->GetFileName().c_str() : ""), m_pRomInfo(RomInfo), - m_pDiskInfo(NULL) + m_pDiskInfo(nullptr) { } @@ -45,7 +45,7 @@ RomInformation::RomInformation(CN64Disk * DiskInfo) : m_DeleteRomInfo(false), m_DeleteDiskInfo(false), m_FileName(DiskInfo ? DiskInfo->GetFileName().c_str() : ""), - m_pRomInfo(NULL), + m_pRomInfo(nullptr), m_pDiskInfo(DiskInfo) { } @@ -63,7 +63,7 @@ void RomInformation::DisplayInformation(HWND hParent) const { if (m_FileName.length() == 0) { return; } - DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Rom_Information), hParent, (DLGPROC)RomInfoProc, (DWORD)this); + DialogBoxParam(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDD_Rom_Information), hParent, (DLGPROC)RomInfoProc, (DWORD)this); } DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam) @@ -76,7 +76,7 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam) SetProp(hDlg, L"this", (RomInformation *)lParam); RomInformation * _this = (RomInformation *)lParam; - if (_this->m_pDiskInfo == NULL) + if (_this->m_pDiskInfo == nullptr) { SetWindowText(hDlg, wGS(INFO_TITLE).c_str()); diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-Directories.cpp b/Source/Project64/UserInterface/Settings/SettingsPage-Directories.cpp index 2b1051ebc..6cad7f5e0 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage-Directories.cpp +++ b/Source/Project64/UserInterface/Settings/SettingsPage-Directories.cpp @@ -6,7 +6,7 @@ COptionsDirectoriesPage::COptionsDirectoriesPage(HWND hParent, const RECT & rcDi m_InUpdateSettings(false) { Create(hParent); - if (m_hWnd == NULL) + if (m_hWnd == nullptr) { return; } @@ -70,13 +70,13 @@ void COptionsDirectoriesPage::SelectDirectory(LanguageStringID Title, CModifiedE stdstr InitialDir = EditBox.GetWindowText(); std::wstring wTitle = wGS(Title); bi.hwndOwner = m_hWnd; - bi.pidlRoot = NULL; + bi.pidlRoot = nullptr; bi.pszDisplayName = Buffer; bi.lpszTitle = wTitle.c_str(); bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; bi.lpfn = (BFFCALLBACK)SelectDirCallBack; bi.lParam = (DWORD)InitialDir.c_str(); - if ((pidl = SHBrowseForFolder(&bi)) != NULL) + if ((pidl = SHBrowseForFolder(&bi)) != nullptr) { if (SHGetPathFromIDList(pidl, Directory)) { @@ -194,7 +194,7 @@ void COptionsDirectoriesPage::UpdatePageSettings() void COptionsDirectoriesPage::UseSelectedClicked(UINT /*Code*/, int id, HWND /*ctl*/) { - CModifiedButton * Button = NULL; + CModifiedButton * Button = nullptr; switch (id) { case IDC_PLUGIN_DEFAULT: Button = &m_PluginDefault; break; @@ -209,7 +209,7 @@ void COptionsDirectoriesPage::UseSelectedClicked(UINT /*Code*/, int id, HWND /*c case IDC_TEXTURE_OTHER: Button = &m_TextureDefault; break; } - if (Button == NULL) + if (Button == nullptr) { return; } diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-Game-Plugin.cpp b/Source/Project64/UserInterface/Settings/SettingsPage-Game-Plugin.cpp index 8887dc6ba..2e05f4085 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage-Game-Plugin.cpp +++ b/Source/Project64/UserInterface/Settings/SettingsPage-Game-Plugin.cpp @@ -56,7 +56,7 @@ void CGamePluginPage::AddPlugins(int ListId, SettingID Type, PLUGIN_TYPE PluginT for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++) { const CPluginList::PLUGIN * Plugin = m_PluginList.GetPluginInfo(i); - if (Plugin == NULL) + if (Plugin == nullptr) { continue; } @@ -74,7 +74,7 @@ void CGamePluginPage::AddPlugins(int ListId, SettingID Type, PLUGIN_TYPE PluginT void CGamePluginPage::ShowAboutButton(int id) { - CModifiedComboBox * ComboBox = NULL; + CModifiedComboBox * ComboBox = nullptr; for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++) { if ((int)(cb_iter->second->GetMenu()) != id) @@ -84,7 +84,7 @@ void CGamePluginPage::ShowAboutButton(int id) ComboBox = cb_iter->second; break; } - if (ComboBox == NULL) + if (ComboBox == nullptr) { return; } @@ -95,13 +95,13 @@ void CGamePluginPage::ShowAboutButton(int id) } const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index); - if (PluginPtr == NULL) + if (PluginPtr == nullptr) { return; } const CPluginList::PLUGIN * Plugin = *PluginPtr; - if (Plugin == NULL) + if (Plugin == nullptr) { return; } @@ -110,7 +110,7 @@ void CGamePluginPage::ShowAboutButton(int id) UINT LastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); HMODULE hLib = LoadLibrary(stdstr((const char *)Plugin->FullPath).ToUTF16().c_str()); SetErrorMode(LastErrorMode); - if (hLib == NULL) + if (hLib == nullptr) { return; } @@ -127,7 +127,7 @@ void CGamePluginPage::ShowAboutButton(int id) void CGamePluginPage::PluginItemChanged(int id, int AboutID, bool bSetChanged) { - CModifiedComboBox * ComboBox = NULL; + CModifiedComboBox * ComboBox = nullptr; for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++) { if ((int)(cb_iter->second->GetMenu()) != id) @@ -137,7 +137,7 @@ void CGamePluginPage::PluginItemChanged(int id, int AboutID, bool bSetChanged) ComboBox = cb_iter->second; break; } - if (ComboBox == NULL) + if (ComboBox == nullptr) { return; } @@ -179,7 +179,7 @@ void CGamePluginPage::UpdatePageSettings(void) for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++) { const CPluginList::PLUGIN * Plugin = m_PluginList.GetPluginInfo(i); - if (Plugin == NULL) + if (Plugin == nullptr) { continue; } @@ -240,7 +240,7 @@ void CGamePluginPage::ApplyComboBoxes(void) } const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index); - if (PluginPtr == NULL) + if (PluginPtr == nullptr) { return; } @@ -277,11 +277,11 @@ bool CGamePluginPage::ResetComboBox(CModifiedComboBox & ComboBox, SettingID /*Ty for (int i = 0, n = ComboBox.GetCount(); i < n; i++) { const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox.GetItemDataPtr(i); - if (PluginPtr == NULL) + if (PluginPtr == nullptr) { continue; } - if (*PluginPtr != NULL) + if (*PluginPtr != nullptr) { continue; } diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-Game-Status.cpp b/Source/Project64/UserInterface/Settings/SettingsPage-Game-Status.cpp index c198c3bd5..87825d626 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage-Game-Status.cpp +++ b/Source/Project64/UserInterface/Settings/SettingsPage-Game-Status.cpp @@ -21,8 +21,8 @@ CGameStatusPage::CGameStatusPage(HWND hParent, const RECT & rcDispay) { for (CIniFile::strlist::iterator item = Keys.begin(); item != Keys.end(); item++) { - if (strstr(item->c_str(), ".Sel") != NULL) { continue; } - if (strstr(item->c_str(), ".Auto") != NULL) { continue; } + if (strstr(item->c_str(), ".Sel") != nullptr) { continue; } + if (strstr(item->c_str(), ".Auto") != nullptr) { continue; } ComboBox->AddItem(stdstr(*item).ToUTF16().c_str(), item->c_str()); } ComboBox->SetTextField(GetDlgItem(IDC_STATUS_TEXT)); diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-KeyboardShortcuts.cpp b/Source/Project64/UserInterface/Settings/SettingsPage-KeyboardShortcuts.cpp index 56b7b54d5..601b37c53 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage-KeyboardShortcuts.cpp +++ b/Source/Project64/UserInterface/Settings/SettingsPage-KeyboardShortcuts.cpp @@ -87,7 +87,7 @@ void COptionsShortCutsPage::OnCpuStateChanged(UINT /*Code*/, int /*id*/, HWND /* hParent = m_MenuItems.GetNextSiblingItem(hParent); } - if (hParent == NULL) + if (hParent == nullptr) { hParent = m_MenuItems.InsertItem(TVIF_TEXT | TVIF_PARAM, wGS(Item->second.Section()).c_str(), 0, 0, 0, 0, Item->second.Section(), TVI_ROOT, TVI_LAST); } @@ -125,13 +125,13 @@ void COptionsShortCutsPage::OnCpuStateChanged(UINT /*Code*/, int /*id*/, HWND /* void COptionsShortCutsPage::OnRemoveClicked(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { HTREEITEM hSelectedItem = m_MenuItems.GetSelectedItem(); - if (hSelectedItem == NULL) + if (hSelectedItem == nullptr) { g_Notify->DisplayWarning(GS(MSG_NO_SEL_SHORTCUT)); return; } HTREEITEM hParent = m_MenuItems.GetParentItem(hSelectedItem); - if (hParent == NULL) + if (hParent == nullptr) { g_Notify->DisplayWarning(GS(MSG_NO_SEL_SHORTCUT)); return; @@ -157,7 +157,7 @@ void COptionsShortCutsPage::OnRemoveClicked(UINT /*Code*/, int /*id*/, HWND /*ct void COptionsShortCutsPage::OnDetectKeyClicked(UINT /*Code*/, int /*id*/, HWND /*ctl*/) { - CloseHandle(CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)stInputGetKeys, this, 0, NULL)); + CloseHandle(CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)stInputGetKeys, this, 0, nullptr)); } void COptionsShortCutsPage::OnAssignClicked(UINT /*Code*/, int /*id*/, HWND /*ctl*/) @@ -178,13 +178,13 @@ void COptionsShortCutsPage::OnAssignClicked(UINT /*Code*/, int /*id*/, HWND /*ct RUNNING_STATE RunningState = (RUNNING_STATE)m_CpuState.GetItemData(m_CpuState.GetCurSel()); HTREEITEM hSelectedItem = m_MenuItems.GetSelectedItem(); - if (hSelectedItem == NULL) + if (hSelectedItem == nullptr) { g_Notify->DisplayWarning(GS(MSG_NO_MENUITEM_SEL)); return; } HTREEITEM hParent = m_MenuItems.GetParentItem(hSelectedItem); - if (hParent == NULL) + if (hParent == nullptr) { g_Notify->DisplayWarning(GS(MSG_NO_MENUITEM_SEL)); return; @@ -247,7 +247,7 @@ LRESULT COptionsShortCutsPage::OnMenuItemChanged(LPNMHDR lpnmh) void COptionsShortCutsPage::RefreshShortCutOptions(HTREEITEM hItem) { HTREEITEM hParent = m_MenuItems.GetParentItem(hItem); - if (hParent == NULL) + if (hParent == nullptr) { return; } @@ -293,15 +293,15 @@ BOOL CALLBACK KeyPromptDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lPa void COptionsShortCutsPage::InputGetKeys(void) { - HWND hKeyDlg = CreateDialogParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Key_Prompt), m_hWnd, (DLGPROC)KeyPromptDlgProc, (LPARAM)::GetDlgItem(m_hWnd, IDC_VIRTUALKEY)); + HWND hKeyDlg = CreateDialogParam(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDD_Key_Prompt), m_hWnd, (DLGPROC)KeyPromptDlgProc, (LPARAM)::GetDlgItem(m_hWnd, IDC_VIRTUALKEY)); ::EnableWindow(GetParent(), false); MSG msg; - for (bool fDone = false; !fDone; MsgWaitForMultipleObjects(0, NULL, false, 45, QS_ALLINPUT)) { + for (bool fDone = false; !fDone; MsgWaitForMultipleObjects(0, nullptr, false, 45, QS_ALLINPUT)) { while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) { fDone = true; - ::PostMessage(NULL, WM_QUIT, 0, 0); + ::PostMessage(nullptr, WM_QUIT, 0, 0); break; } if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) { diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-Plugin.cpp b/Source/Project64/UserInterface/Settings/SettingsPage-Plugin.cpp index d60d99d47..16fcc75d5 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage-Plugin.cpp +++ b/Source/Project64/UserInterface/Settings/SettingsPage-Plugin.cpp @@ -48,7 +48,7 @@ void COptionPluginPage::AddPlugins(int ListId, SettingID Type, PLUGIN_TYPE Plugi for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++) { const CPluginList::PLUGIN * Plugin = m_PluginList.GetPluginInfo(i); - if (Plugin == NULL) + if (Plugin == nullptr) { continue; } @@ -66,7 +66,7 @@ void COptionPluginPage::AddPlugins(int ListId, SettingID Type, PLUGIN_TYPE Plugi void COptionPluginPage::ShowAboutButton(int id) { - CModifiedComboBox * ComboBox = NULL; + CModifiedComboBox * ComboBox = nullptr; for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++) { if ((int)(cb_iter->second->GetMenu()) != id) @@ -76,7 +76,7 @@ void COptionPluginPage::ShowAboutButton(int id) ComboBox = cb_iter->second; break; } - if (ComboBox == NULL) + if (ComboBox == nullptr) { return; } @@ -87,13 +87,13 @@ void COptionPluginPage::ShowAboutButton(int id) } const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index); - if (PluginPtr == NULL) + if (PluginPtr == nullptr) { return; } const CPluginList::PLUGIN * Plugin = *PluginPtr; - if (Plugin == NULL) + if (Plugin == nullptr) { return; } @@ -102,7 +102,7 @@ void COptionPluginPage::ShowAboutButton(int id) UINT LastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); HMODULE hLib = LoadLibrary(stdstr((const char *)(Plugin->FullPath)).ToUTF16().c_str()); SetErrorMode(LastErrorMode); - if (hLib == NULL) + if (hLib == nullptr) { return; } @@ -119,7 +119,7 @@ void COptionPluginPage::ShowAboutButton(int id) void COptionPluginPage::PluginItemChanged(int id, int AboutID, bool bSetChanged) { - CModifiedComboBox * ComboBox = NULL; + CModifiedComboBox * ComboBox = nullptr; for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++) { if ((int)(cb_iter->second->GetMenu()) != id) @@ -129,7 +129,7 @@ void COptionPluginPage::PluginItemChanged(int id, int AboutID, bool bSetChanged) ComboBox = cb_iter->second; break; } - if (ComboBox == NULL) + if (ComboBox == nullptr) { return; } @@ -168,12 +168,12 @@ void COptionPluginPage::UpdatePageSettings(void) for (int i = 0, n = ComboBox->GetCount(); i < n; i++) { const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(i); - if (PluginPtr == NULL) + if (PluginPtr == nullptr) { continue; } const CPluginList::PLUGIN * Plugin = *PluginPtr; - if (Plugin == NULL) + if (Plugin == nullptr) { continue; } @@ -230,7 +230,7 @@ void COptionPluginPage::ApplyComboBoxes(void) } const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index); - if (PluginPtr == NULL) + if (PluginPtr == nullptr) { return; } @@ -259,7 +259,7 @@ bool COptionPluginPage::ResetComboBox(CModifiedComboBox & ComboBox, SettingID Ty for (int i = 0, n = ComboBox.GetCount(); i < n; i++) { const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox.GetItemDataPtr(i); - if (PluginPtr == NULL) + if (PluginPtr == nullptr) { continue; } diff --git a/Source/Project64/UserInterface/Settings/SettingsPage.cpp b/Source/Project64/UserInterface/Settings/SettingsPage.cpp index 3929f9238..b289d7931 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage.cpp +++ b/Source/Project64/UserInterface/Settings/SettingsPage.cpp @@ -26,7 +26,7 @@ CSettingsPage * CConfigSettingSection::GetPage(int PageNo) { if (PageNo < 0 || PageNo >= (int)m_Pages.size()) { - return NULL; + return nullptr; } return m_Pages[PageNo]; } diff --git a/Source/Project64/UserInterface/Settings/SettingsPage.h b/Source/Project64/UserInterface/Settings/SettingsPage.h index 8c8103e49..aaa7c2345 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage.h +++ b/Source/Project64/UserInterface/Settings/SettingsPage.h @@ -46,7 +46,7 @@ protected: } bool Create(HWND hParent, const RECT & rcDispay) { - BOOL result = m_thunk.Init(NULL, NULL); + BOOL result = m_thunk.Init(nullptr, nullptr); if (result == FALSE) { SetLastError(ERROR_OUTOFMEMORY); @@ -58,7 +58,7 @@ protected: m_bModal = false; #endif //_DEBUG m_hWnd = ::CreateDialogParam(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(static_cast(this)->IDD), hParent, T::StartDialogProc, NULL); - if (m_hWnd == NULL) + if (m_hWnd == nullptr) { return false; } @@ -162,16 +162,16 @@ protected: if (item == m_TxtBoxList.end()) { CModifiedEditBox * EditBox = new CModifiedEditBox(bString); - if (EditBox == NULL) + if (EditBox == nullptr) { - return NULL; + return nullptr; } EditBox->Attach(hWnd); m_TxtBoxList.insert(TextBoxList::value_type(Type, EditBox)); return EditBox; } - return NULL; + return nullptr; } void AddModCheckBox(HWND hWnd, SettingID Type) @@ -180,7 +180,7 @@ protected: if (item == m_ButtonList.end()) { CModifiedButton * Button = new CModifiedButton; - if (Button == NULL) + if (Button == nullptr) { return; } @@ -198,10 +198,10 @@ protected: return item->second; } - CModifiedComboBox * ComboBox = new CModifiedComboBox(g_Settings->LoadDefaultDword(Type), NULL, false); - if (ComboBox == NULL) + CModifiedComboBox * ComboBox = new CModifiedComboBox(g_Settings->LoadDefaultDword(Type), nullptr, false); + if (ComboBox == nullptr) { - return NULL; + return nullptr; } ComboBox->Attach(hWnd); m_ComboBoxList.insert(ComboBoxList::value_type(Type, ComboBox)); @@ -217,9 +217,9 @@ protected: } CModifiedComboBoxTxt * ComboBox = new CModifiedComboBoxTxt(g_Settings->LoadDefaultString(Type)); - if (ComboBox == NULL) + if (ComboBox == nullptr) { - return NULL; + return nullptr; } ComboBox->Attach(hWnd); m_ComboBoxTxtList.insert(ComboBoxTxtList::value_type(Type, ComboBox)); diff --git a/Source/Project64/UserInterface/SettingsConfig.cpp b/Source/Project64/UserInterface/SettingsConfig.cpp index f64e4862e..e6073a1e0 100644 --- a/Source/Project64/UserInterface/SettingsConfig.cpp +++ b/Source/Project64/UserInterface/SettingsConfig.cpp @@ -5,10 +5,10 @@ #include CSettingConfig::CSettingConfig(bool bJustGameSetting /* = false */) : - m_CurrentPage(NULL), - m_GeneralOptionsPage(NULL), - m_AdvancedPage(NULL), - m_DefaultsPage(NULL), + m_CurrentPage(nullptr), + m_GeneralOptionsPage(nullptr), + m_AdvancedPage(nullptr), + m_DefaultsPage(nullptr), m_GameConfig(bJustGameSetting), m_bTVNSelChangedSupported(false) { @@ -30,7 +30,7 @@ void CSettingConfig::Display(void * ParentWindow) g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_Settings); } - BOOL result = m_thunk.Init(NULL, NULL); + BOOL result = m_thunk.Init(nullptr, nullptr); if (result) { _AtlWinModule.AddCreateWndData(&m_thunk.cd, this); @@ -88,7 +88,7 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* RECT rcSettingInfo; ::GetWindowRect(GetDlgItem(IDC_SETTING_INFO), &rcSettingInfo); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcSettingInfo, 2); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&rcSettingInfo, 2); CConfigSettingSection * SettingsSection; @@ -180,7 +180,7 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* { CConfigSettingSection * Section = *iter; - HTREEITEM hSectionItem = NULL; + HTREEITEM hSectionItem = nullptr; for (size_t i = 0; i < Section->GetPageCount(); i++) { @@ -194,13 +194,13 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* hSectionItem = m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM, Section->GetPageTitle(), 0, 0, 0, 0, (ULONG)Page, TVI_ROOT, TVI_LAST); continue; } - if (hSectionItem == NULL) + if (hSectionItem == nullptr) { continue; } m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM, wGS(Page->PageTitle()).c_str(), 0, 0, 0, 0, (ULONG)Page, hSectionItem, TVI_LAST); } - if (bFirstItem && hSectionItem != NULL) + if (bFirstItem && hSectionItem != nullptr) { bFirstItem = false; m_PagesTreeList.Expand(hSectionItem); diff --git a/Source/Project64/UserInterface/SupportEnterCode.cpp b/Source/Project64/UserInterface/SupportEnterCode.cpp index 82f0eb3e9..44058e5ab 100644 --- a/Source/Project64/UserInterface/SupportEnterCode.cpp +++ b/Source/Project64/UserInterface/SupportEnterCode.cpp @@ -69,47 +69,47 @@ LRESULT CSupportEnterCode::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM hDC.SelectFont(hFont); if (hDC.DrawText(DescriptionText.c_str(), DescriptionText.length(), &rcWin, DT_LEFT | DT_CALCRECT | DT_WORDBREAK | DT_NOCLIP) > 0) { - hDescription.SetWindowPos(NULL, 0, 0, rcWin.right, rcWin.bottom, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER); + hDescription.SetWindowPos(nullptr, 0, 0, rcWin.right, rcWin.bottom, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER); } hDescription.GetWindowRect(&rcWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&rcWin, 2); - MachineId.SetWindowPos(NULL, rcWin.left, rcWin.bottom + 4, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); + MachineId.SetWindowPos(nullptr, rcWin.left, rcWin.bottom + 4, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); MachineId.GetWindowRect(&rcWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&rcWin, 2); CWindow Code = GetDlgItem(IDC_CODE); - Code.SetWindowPos(NULL, rcWin.left, rcWin.bottom + 4, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); + Code.SetWindowPos(nullptr, rcWin.left, rcWin.bottom + 4, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); Code.GetWindowRect(&rcWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&rcWin, 2); CWindow RequestDescption = GetDlgItem(IDC_REQUEST_DESCPTION); RequestDescption.ShowWindow(SWP_HIDEWINDOW); - RequestDescption.SetWindowPos(NULL, rcWin.left, rcWin.bottom + 10, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); + RequestDescption.SetWindowPos(nullptr, rcWin.left, rcWin.bottom + 10, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); RequestDescption.GetWindowRect(&rcWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&rcWin, 2); CWindow RequestLink = GetDlgItem(IDC_REQUEST_LINK); RequestLink.ShowWindow(SWP_HIDEWINDOW); - RequestLink.SetWindowPos(NULL, rcWin.left, rcWin.bottom + 4, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); + RequestLink.SetWindowPos(nullptr, rcWin.left, rcWin.bottom + 4, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); RequestLink.GetWindowRect(&rcWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&rcWin, 2); RECT CancelBtnWin = { 0 }; CancelBtn.GetWindowRect(&CancelBtnWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&CancelBtnWin, 2); - CancelBtn.SetWindowPos(NULL, CancelBtnWin.left, rcWin.bottom + 40, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&CancelBtnWin, 2); + CancelBtn.SetWindowPos(nullptr, CancelBtnWin.left, rcWin.bottom + 40, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); RECT OkBtnWin = { 0 }; OkBtn.GetWindowRect(&OkBtnWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&OkBtnWin, 2); - OkBtn.SetWindowPos(NULL, OkBtnWin.left, rcWin.bottom + 40, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&OkBtnWin, 2); + OkBtn.SetWindowPos(nullptr, OkBtnWin.left, rcWin.bottom + 40, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); OkBtn.GetWindowRect(&OkBtnWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&OkBtnWin, 2); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&OkBtnWin, 2); GetWindowRect(&rcWin); SetRect(&rcWin, 0, 0, rcWin.Width(), OkBtnWin.bottom + 30); - AdjustWindowRectEx(&rcWin, GetStyle(), GetMenu() != NULL, GetExStyle()); + AdjustWindowRectEx(&rcWin, GetStyle(), GetMenu() != nullptr, GetExStyle()); int32_t Left = (GetSystemMetrics(SM_CXSCREEN) - rcWin.Width()) / 2; int32_t Top = (GetSystemMetrics(SM_CYSCREEN) - rcWin.Height()) / 2; MoveWindow(Left, Top, rcWin.Width(), rcWin.Height(), TRUE); diff --git a/Source/Project64/UserInterface/SupportWindow.cpp b/Source/Project64/UserInterface/SupportWindow.cpp index 0331ab3e5..67c3794c9 100644 --- a/Source/Project64/UserInterface/SupportWindow.cpp +++ b/Source/Project64/UserInterface/SupportWindow.cpp @@ -18,7 +18,7 @@ CSupportWindow::~CSupportWindow(void) void CALLBACK CSupportWindow::TimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) { - ::KillTimer(NULL, idEvent); + ::KillTimer(nullptr, idEvent); m_this->DoModal(m_this->m_hParent); } @@ -82,34 +82,34 @@ LRESULT CSupportWindow::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* hDC.SelectFont(hFont); if (hDC.DrawText(InfoText.c_str(),InfoText.length(),&rcWin,DT_LEFT | DT_CALCRECT | DT_WORDBREAK | DT_NOCLIP) > 0) { - hInfo.SetWindowPos(NULL,0,0,rcWin.right, rcWin.bottom,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER); + hInfo.SetWindowPos(nullptr,0,0,rcWin.right, rcWin.bottom,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER); } hInfo.SetWindowText(InfoText.c_str()); hInfo.GetWindowRect(&rcWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&rcWin, 2); CWindow EnterCode = GetDlgItem(IDC_ENTER_CODE); - EnterCode.SetWindowPos(NULL,rcWin.left,rcWin.bottom + 4,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOOWNERZORDER); + EnterCode.SetWindowPos(nullptr,rcWin.left,rcWin.bottom + 4,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOOWNERZORDER); EnterCode.GetWindowRect(&rcWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&rcWin, 2); CWindow SupportBtn = GetDlgItem(ID_SUPPORT_PJ64); RECT SupportBtnWin = { 0 }; SupportBtn.GetWindowRect(&SupportBtnWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&SupportBtnWin, 2); - SupportBtn.SetWindowPos(NULL, SupportBtnWin.left, rcWin.bottom + 40, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&SupportBtnWin, 2); + SupportBtn.SetWindowPos(nullptr, SupportBtnWin.left, rcWin.bottom + 40, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); CWindow CancelBtn = GetDlgItem(IDCANCEL); RECT CancelBtnWin = { 0 }; CancelBtn.GetWindowRect(&CancelBtnWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&CancelBtnWin, 2); - CancelBtn.SetWindowPos(NULL, CancelBtnWin.left, rcWin.bottom + 40, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&CancelBtnWin, 2); + CancelBtn.SetWindowPos(nullptr, CancelBtnWin.left, rcWin.bottom + 40, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER); GetWindowRect(&rcWin); SupportBtn.GetWindowRect(&SupportBtnWin); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&SupportBtnWin, 2); + ::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&SupportBtnWin, 2); SetRect(&rcWin, 0, 0, rcWin.Width(), SupportBtnWin.bottom + 30); - AdjustWindowRectEx(&rcWin, GetStyle(), GetMenu() != NULL, GetExStyle()); + AdjustWindowRectEx(&rcWin, GetStyle(), GetMenu() != nullptr, GetExStyle()); int32_t Left = (GetSystemMetrics(SM_CXSCREEN) - rcWin.Width()) / 2; int32_t Top = (GetSystemMetrics(SM_CYSCREEN) - rcWin.Height()) / 2; @@ -125,8 +125,8 @@ LRESULT CSupportWindow::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* SetWindowLong(GWL_STYLE, dwStyle); GetDlgItem(IDCANCEL).EnableWindow(false); - srand ((uint32_t)time(NULL)); - SetTimer(0, 1000, NULL); + srand ((uint32_t)time(nullptr)); + SetTimer(0, 1000, nullptr); } return TRUE; } @@ -176,7 +176,7 @@ LRESULT CSupportWindow::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCt LRESULT CSupportWindow::OnSupportProject64(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { stdstr SupportURL = stdstr_f("https://www.pj64-emu.com/support-project64.html?ver=%s&machine=%s", VER_FILE_VERSION_STR, m_Support.MachineID()); - ShellExecute(NULL, L"open", SupportURL.ToUTF16().c_str(), NULL, NULL, SW_SHOWMAXIMIZED); + ShellExecute(nullptr, L"open", SupportURL.ToUTF16().c_str(), nullptr, nullptr, SW_SHOWMAXIMIZED); return TRUE; } diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/DataArray.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/DataArray.h index e39fe6ba3..40ffc4ad7 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/DataArray.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/DataArray.h @@ -44,7 +44,7 @@ class CListCtrlArray { public: // Construction/destruction - CListCtrlArray() : m_aT(NULL), m_nSize(0), m_nAllocSize(0) + CListCtrlArray() : m_aT(nullptr), m_nSize(0), m_nAllocSize(0) { } ~CListCtrlArray() @@ -52,10 +52,10 @@ public: RemoveAll(); } - CListCtrlArray(const CListCtrlArray< T, TEqual >& src) : m_aT(NULL), m_nSize(0), m_nAllocSize(0) + CListCtrlArray(const CListCtrlArray< T, TEqual >& src) : m_aT(nullptr), m_nSize(0), m_nAllocSize(0) { m_aT = (T*)malloc(src.GetSize() * sizeof(T)); - if (m_aT != NULL) + if (m_aT != nullptr) { m_nAllocSize = src.GetSize(); for (int i=0; i= 0 && nIndex < m_nSize); if(nIndex < 0 || nIndex >= m_nSize) { - RaiseException(EXCEPTION_ARRAY_BOUNDS_EXCEEDED, EXCEPTION_NONCONTINUABLE, 0, NULL); + RaiseException(EXCEPTION_ARRAY_BOUNDS_EXCEEDED, EXCEPTION_NONCONTINUABLE, 0, nullptr); } return m_aT[nIndex]; } @@ -167,7 +167,7 @@ public: ATLASSERT(nIndex >= 0 && nIndex < m_nSize); if(nIndex < 0 || nIndex >= m_nSize) { - RaiseException(EXCEPTION_ARRAY_BOUNDS_EXCEEDED, EXCEPTION_NONCONTINUABLE, 0, NULL); + RaiseException(EXCEPTION_ARRAY_BOUNDS_EXCEEDED, EXCEPTION_NONCONTINUABLE, 0, nullptr); } return m_aT[nIndex]; } diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/DragDrop.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/DragDrop.h index 2d2513136..876a732f4 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/DragDrop.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/DragDrop.h @@ -23,12 +23,12 @@ public: // IUnknown members STDMETHOD(QueryInterface)( REFIID refiid, void FAR* FAR* ppvObject ) { - *ppvObject = ( refiid == IID_IUnknown || refiid == IID_IEnumFORMATETC ) ? this : NULL; + *ppvObject = ( refiid == IID_IUnknown || refiid == IID_IEnumFORMATETC ) ? this : nullptr; - if ( *ppvObject != NULL ) + if ( *ppvObject != nullptr ) ( (LPUNKNOWN)*ppvObject )->AddRef(); - return *ppvObject == NULL ? E_NOINTERFACE : S_OK; + return *ppvObject == nullptr ? E_NOINTERFACE : S_OK; } STDMETHOD_(ULONG, AddRef)( void ) @@ -47,15 +47,15 @@ public: // IEnumFORMATETC members STDMETHOD(Next)( ULONG celt, LPFORMATETC lpFormatEtc, ULONG FAR *pceltFetched ) { - if ( pceltFetched != NULL ) + if ( pceltFetched != nullptr ) *pceltFetched=0; ULONG cReturn = celt; - if ( celt <= 0 || lpFormatEtc == NULL || m_nIndex >= (int)m_vFormatEtc.size() ) + if ( celt <= 0 || lpFormatEtc == nullptr || m_nIndex >= (int)m_vFormatEtc.size() ) return S_FALSE; - if ( pceltFetched == NULL && celt != 1 ) // pceltFetched can be NULL only for 1 item request + if ( pceltFetched == nullptr && celt != 1 ) // pceltFetched can be nullptr only for 1 item request return S_FALSE; while ( m_nIndex < (int)m_vFormatEtc.size() && cReturn > 0 ) @@ -64,7 +64,7 @@ public: cReturn--; } - if ( pceltFetched != NULL ) + if ( pceltFetched != nullptr ) *pceltFetched = celt - cReturn; return cReturn == 0 ? S_OK : S_FALSE; @@ -86,7 +86,7 @@ public: STDMETHOD(Clone)( IEnumFORMATETC FAR * FAR* ppCloneEnumFormatEtc ) { - if ( ppCloneEnumFormatEtc == NULL ) + if ( ppCloneEnumFormatEtc == nullptr ) return E_POINTER; *ppCloneEnumFormatEtc = new CEnumFormatEtc( m_vFormatEtc ); @@ -112,12 +112,12 @@ public: // IUnknown members STDMETHOD(QueryInterface)( REFIID refiid, void FAR* FAR* ppvObject ) { - *ppvObject = ( refiid == IID_IUnknown || refiid == IID_IDropSource ) ? this : NULL; + *ppvObject = ( refiid == IID_IUnknown || refiid == IID_IDropSource ) ? this : nullptr; - if ( *ppvObject != NULL ) + if ( *ppvObject != nullptr ) ( (LPUNKNOWN)*ppvObject )->AddRef(); - return *ppvObject == NULL ? E_NOINTERFACE : S_OK; + return *ppvObject == nullptr ? E_NOINTERFACE : S_OK; } STDMETHOD_(ULONG, AddRef)( void ) @@ -179,12 +179,12 @@ public: // IUnknown members STDMETHOD(QueryInterface)( REFIID refiid, void FAR* FAR* ppvObject ) { - *ppvObject = ( refiid == IID_IUnknown || refiid == IID_IDataObject ) ? this : NULL; + *ppvObject = ( refiid == IID_IUnknown || refiid == IID_IDataObject ) ? this : nullptr; - if ( *ppvObject != NULL ) + if ( *ppvObject != nullptr ) ( (LPUNKNOWN)*ppvObject )->AddRef(); - return *ppvObject == NULL ? E_NOINTERFACE : S_OK; + return *ppvObject == nullptr ? E_NOINTERFACE : S_OK; } STDMETHOD_(ULONG, AddRef)( void ) @@ -203,7 +203,7 @@ public: // IDataObject members STDMETHOD(GetData)( FORMATETC __RPC_FAR *pformatetcIn, STGMEDIUM __RPC_FAR *pmedium ) { - if ( pformatetcIn == NULL || pmedium == NULL ) + if ( pformatetcIn == nullptr || pmedium == nullptr ) return E_INVALIDARG; ZeroMemory( pmedium, sizeof( STGMEDIUM ) ); @@ -232,7 +232,7 @@ public: STDMETHOD(QueryGetData)( FORMATETC __RPC_FAR *pformatetc ) { - if ( pformatetc == NULL ) + if ( pformatetc == nullptr ) return E_INVALIDARG; if ( !( pformatetc->dwAspect & DVASPECT_CONTENT ) ) @@ -258,12 +258,12 @@ public: STDMETHOD(GetCanonicalFormatEtc)( FORMATETC __RPC_FAR * /*pformatectIn*/, FORMATETC __RPC_FAR * pformatetcOut ) { - return pformatetcOut == NULL ? E_INVALIDARG : DATA_S_SAMEFORMATETC; + return pformatetcOut == nullptr ? E_INVALIDARG : DATA_S_SAMEFORMATETC; } STDMETHOD(SetData)( FORMATETC __RPC_FAR *pformatetc, STGMEDIUM __RPC_FAR *pmedium, BOOL bRelease ) { - if ( pformatetc == NULL || pmedium == NULL ) + if ( pformatetc == nullptr || pmedium == nullptr ) return E_INVALIDARG; m_vFormatEtc.push_back( *pformatetc ); @@ -280,7 +280,7 @@ public: STDMETHOD(EnumFormatEtc)( DWORD dwDirection, IEnumFORMATETC __RPC_FAR *__RPC_FAR *ppenumFormatEtc ) { - if ( ppenumFormatEtc == NULL ) + if ( ppenumFormatEtc == nullptr ) return E_POINTER; switch ( dwDirection ) @@ -288,7 +288,7 @@ public: case DATADIR_GET: *ppenumFormatEtc = new CEnumFormatEtc( m_vFormatEtc ); ( (CEnumFormatEtc*)*ppenumFormatEtc )->AddRef(); return S_OK; - default: *ppenumFormatEtc = NULL; + default: *ppenumFormatEtc = nullptr; return E_NOTIMPL; } } @@ -314,13 +314,13 @@ public: { case TYMED_HGLOBAL: pMedDest->hGlobal = (HGLOBAL)OleDuplicateData( MedSrc.hGlobal, FmtSrc.cfFormat, NULL ); break; - case TYMED_GDI: pMedDest->hBitmap = (HBITMAP)OleDuplicateData( MedSrc.hBitmap, FmtSrc.cfFormat, NULL ); + case TYMED_GDI: pMedDest->hBitmap = (HBITMAP)OleDuplicateData( MedSrc.hBitmap, FmtSrc.cfFormat, NULL); break; - case TYMED_MFPICT: pMedDest->hMetaFilePict = (HMETAFILEPICT)OleDuplicateData( MedSrc.hMetaFilePict, FmtSrc.cfFormat, NULL ); + case TYMED_MFPICT: pMedDest->hMetaFilePict = (HMETAFILEPICT)OleDuplicateData( MedSrc.hMetaFilePict, FmtSrc.cfFormat, NULL); break; - case TYMED_ENHMF: pMedDest->hEnhMetaFile = (HENHMETAFILE)OleDuplicateData( MedSrc.hEnhMetaFile, FmtSrc.cfFormat, NULL ); + case TYMED_ENHMF: pMedDest->hEnhMetaFile = (HENHMETAFILE)OleDuplicateData( MedSrc.hEnhMetaFile, FmtSrc.cfFormat, NULL); break; - case TYMED_FILE: pMedDest->lpszFileName = (LPOLESTR)OleDuplicateData( MedSrc.lpszFileName, FmtSrc.cfFormat, NULL ); + case TYMED_FILE: pMedDest->lpszFileName = (LPOLESTR)OleDuplicateData( MedSrc.lpszFileName, FmtSrc.cfFormat, NULL); break; case TYMED_ISTREAM: pMedDest->pstm = MedSrc.pstm; MedSrc.pstm->AddRef(); @@ -331,9 +331,9 @@ public: } pMedDest->tymed = MedSrc.tymed; - pMedDest->pUnkForRelease = NULL; + pMedDest->pUnkForRelease = nullptr; - if ( MedSrc.pUnkForRelease != NULL ) + if ( MedSrc.pUnkForRelease != nullptr ) { pMedDest->pUnkForRelease = MedSrc.pUnkForRelease; MedSrc.pUnkForRelease->AddRef(); @@ -354,20 +354,20 @@ public: m_hTargetWnd = hTargetWnd; m_nRefCount = 0; m_bAllowDrop = FALSE; - m_pDropTargetHelper = NULL; + m_pDropTargetHelper = nullptr; ZeroMemory( &m_FormatEtc, sizeof( FORMATETC ) ); ZeroMemory( &m_StgMedium, sizeof( STGMEDIUM ) ); - if ( FAILED( CoCreateInstance( CLSID_DragDropHelper, NULL, CLSCTX_INPROC_SERVER, IID_IDropTargetHelper, (LPVOID*)&m_pDropTargetHelper ) ) ) - m_pDropTargetHelper = NULL; + if ( FAILED( CoCreateInstance( CLSID_DragDropHelper, nullptr, CLSCTX_INPROC_SERVER, IID_IDropTargetHelper, (LPVOID*)&m_pDropTargetHelper ) ) ) + m_pDropTargetHelper = nullptr; } virtual ~CDropTarget() { - if ( m_pDropTargetHelper != NULL ) + if ( m_pDropTargetHelper != nullptr ) { m_pDropTargetHelper->Release(); - m_pDropTargetHelper = NULL; + m_pDropTargetHelper = nullptr; } } @@ -384,12 +384,12 @@ public: // IUnknown members STDMETHOD(QueryInterface)( REFIID refiid, void FAR* FAR* ppvObject ) { - *ppvObject = ( refiid == IID_IUnknown || refiid == IID_IDropTarget ) ? this : NULL; + *ppvObject = ( refiid == IID_IUnknown || refiid == IID_IDropTarget ) ? this : nullptr; - if ( *ppvObject != NULL ) + if ( *ppvObject != nullptr ) ( (LPUNKNOWN)*ppvObject )->AddRef(); - return *ppvObject == NULL ? E_NOINTERFACE : S_OK; + return *ppvObject == nullptr ? E_NOINTERFACE : S_OK; } STDMETHOD_(ULONG, AddRef)( void ) @@ -407,10 +407,10 @@ public: STDMETHOD(DragEnter)( IDataObject __RPC_FAR *pDataObject, DWORD dwKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect ) { - if ( pDataObject == NULL ) + if ( pDataObject == nullptr ) return E_INVALIDARG; - if ( m_pDropTargetHelper != NULL ) + if ( m_pDropTargetHelper != nullptr ) m_pDropTargetHelper->DragEnter( m_hTargetWnd, pDataObject, (LPPOINT)&pt, *pdwEffect ); ZeroMemory( &m_FormatEtc, sizeof( FORMATETC ) ); @@ -484,7 +484,7 @@ public: STDMETHOD(Drop)( IDataObject __RPC_FAR *pDataObject, DWORD dwKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect ) { - if ( pDataObject == NULL ) + if ( pDataObject == nullptr ) return E_INVALIDARG; if ( m_pDropTargetHelper ) @@ -589,7 +589,7 @@ class CDropTargetT : public CDropTarget public: CDropTargetT( HWND hTargetWnd ) : CDropTarget( hTargetWnd ) { - m_pDelegate = NULL; + m_pDelegate = nullptr; } protected: @@ -604,22 +604,22 @@ public: virtual DWORD OnDragEnter( FORMATETC& FormatEtc, STGMEDIUM& StgMedium, DWORD dwKeyState, CPoint point ) { - return m_pDelegate == NULL ? DROPEFFECT_NONE : m_pDelegate->OnDragEnter( FormatEtc, StgMedium, dwKeyState, point ); + return m_pDelegate == nullptr ? DROPEFFECT_NONE : m_pDelegate->OnDragEnter( FormatEtc, StgMedium, dwKeyState, point ); } virtual DWORD OnDragOver( FORMATETC& FormatEtc, STGMEDIUM& StgMedium, DWORD dwKeyState, CPoint point ) { - return m_pDelegate == NULL ? DROPEFFECT_NONE : m_pDelegate->OnDragOver( FormatEtc, StgMedium, dwKeyState, point ); + return m_pDelegate == nullptr ? DROPEFFECT_NONE : m_pDelegate->OnDragOver( FormatEtc, StgMedium, dwKeyState, point ); } virtual BOOL OnDrop( FORMATETC& FormatEtc, STGMEDIUM& StgMedium, DWORD dwEffect, CPoint point ) { - return m_pDelegate == NULL ? FALSE : m_pDelegate->OnDrop( FormatEtc, StgMedium, dwEffect, point ); + return m_pDelegate == nullptr ? FALSE : m_pDelegate->OnDrop( FormatEtc, StgMedium, dwEffect, point ); } virtual void OnDragLeave() { - if ( m_pDelegate != NULL ) + if ( m_pDelegate != nullptr ) m_pDelegate->OnDragLeave(); } }; @@ -645,7 +645,7 @@ public: virtual BOOL OnRenderData( FORMATETC& FormatEtc, STGMEDIUM *pStgMedium, BOOL bDropComplete ) { - return m_pDelegate == NULL ? FALSE : m_pDelegate->OnRenderData( FormatEtc, pStgMedium, bDropComplete ); + return m_pDelegate == nullptr ? FALSE : m_pDelegate->OnRenderData( FormatEtc, pStgMedium, bDropComplete ); } }; @@ -655,17 +655,17 @@ class CDragDrop public: CDragDrop() { - m_pDropSource = NULL; - m_pDataObject = NULL; - m_pDropTarget = NULL; - m_hTargetWnd = NULL; + m_pDropSource = nullptr; + m_pDataObject = nullptr; + m_pDropTarget = nullptr; + m_hTargetWnd = nullptr; } virtual ~CDragDrop() { - if ( m_pDropSource != NULL ) + if ( m_pDropSource != nullptr ) m_pDropSource->Release(); - if ( m_pDataObject != NULL ) + if ( m_pDataObject != nullptr ) m_pDataObject->Release(); } @@ -688,7 +688,7 @@ public: if ( FAILED( RegisterDragDrop( m_hTargetWnd, m_pDropTarget ) ) ) { delete m_pDropTarget; - m_pDropTarget = NULL; + m_pDropTarget = nullptr; return FALSE; } @@ -709,13 +709,13 @@ public: BOOL Revoke() { - m_pDropTarget = NULL; + m_pDropTarget = nullptr; return ( RevokeDragDrop( m_hTargetWnd ) == S_OK ); } BOOL AddTargetFormat( CLIPFORMAT cfFormat ) { - if ( m_pDropTarget == NULL ) + if ( m_pDropTarget == nullptr ) return FALSE; m_pDropTarget->AddSupportedFormat( cfFormat ); return TRUE; @@ -723,7 +723,7 @@ public: BOOL AddSourceFormat( CLIPFORMAT cfFormat ) { - if ( m_pDataObject == NULL ) + if ( m_pDataObject == nullptr ) return FALSE; FORMATETC FormatEtc; @@ -742,7 +742,7 @@ public: BOOL SetClipboard( FORMATETC& FormatEtc, STGMEDIUM& StgMedium ) { - if ( m_pDataObject == NULL ) + if ( m_pDataObject == nullptr ) return DROPEFFECT_NONE; if ( FAILED( m_pDataObject->SetData( &FormatEtc, &StgMedium, TRUE ) ) ) @@ -756,20 +756,20 @@ public: return ( OleFlushClipboard() == S_OK ); } - DWORD DoDragDrop( SHDRAGIMAGE *pDragImage = NULL, DWORD dwValidEffects = DROPEFFECT_COPY | DROPEFFECT_MOVE | DROPEFFECT_LINK ) + DWORD DoDragDrop( SHDRAGIMAGE *pDragImage = nullptr, DWORD dwValidEffects = DROPEFFECT_COPY | DROPEFFECT_MOVE | DROPEFFECT_LINK ) { - if ( m_pDataObject == NULL ) + if ( m_pDataObject == nullptr ) return DROPEFFECT_NONE; - IDragSourceHelper *pDragSourceHelper = NULL; + IDragSourceHelper *pDragSourceHelper = nullptr; // Instantiate drag source helper object - if ( pDragImage != NULL ) + if ( pDragImage != nullptr ) { - if ( FAILED( CoCreateInstance( CLSID_DragDropHelper, NULL, CLSCTX_INPROC_SERVER, IID_IDragSourceHelper, (LPVOID*)&pDragSourceHelper ) ) ) - pDragSourceHelper = NULL; + if ( FAILED( CoCreateInstance( CLSID_DragDropHelper, nullptr, CLSCTX_INPROC_SERVER, IID_IDragSourceHelper, (LPVOID*)&pDragSourceHelper ) ) ) + pDragSourceHelper = nullptr; - if ( pDragSourceHelper != NULL ) + if ( pDragSourceHelper != nullptr ) pDragSourceHelper->InitializeFromBitmap( pDragImage, m_pDataObject ); } @@ -777,7 +777,7 @@ public: dwEffects = ::DoDragDrop( m_pDataObject, m_pDropSource, dwValidEffects, &dwEffects ) == DRAGDROP_S_DROP ? DROPEFFECT_NONE : dwEffects; // Destroy drag source helper object - if ( pDragSourceHelper != NULL ) + if ( pDragSourceHelper != nullptr ) pDragSourceHelper->Release(); return dwEffects; diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/DropArrows.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/DropArrows.h index 7d06c2c89..98163dfdc 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/DropArrows.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/DropArrows.h @@ -32,7 +32,7 @@ public: m_nSpanLength = nSpanLength + 20; CRect area( 0, 0, m_bVertical ? 12 : m_nSpanLength, m_bVertical ? m_nSpanLength : 12 ); - if ( CWindowImpl< CDropArrows >::Create( hWndParent, area, NULL, WS_POPUP | WS_DISABLED, WS_EX_TOOLWINDOW ) == NULL ) + if ( CWindowImpl< CDropArrows >::Create( hWndParent, area, nullptr, WS_POPUP | WS_DISABLED, WS_EX_TOOLWINDOW ) == nullptr ) return FALSE; POINT ptArrow[ 7 ]; @@ -73,7 +73,7 @@ public: BOOL Show( CPoint point ) { - return IsWindow() ? SetWindowPos( NULL, m_bVertical ? point.x - 7 : point.x - ( m_nSpanLength / 2 ), m_bVertical ? point.y - ( m_nSpanLength / 2 ) : point.y - 5, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOACTIVATE ) : FALSE; + return IsWindow() ? SetWindowPos( nullptr, m_bVertical ? point.x - 7 : point.x - ( m_nSpanLength / 2 ), m_bVertical ? point.y - ( m_nSpanLength / 2 ) : point.y - 5, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOACTIVATE ) : FALSE; } BOOL Hide() diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCombo.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCombo.h index ca44769dc..effbc8a6b 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCombo.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCombo.h @@ -64,7 +64,7 @@ public: // Create combo control CRect Area( ( ( dwStyle & CBS_DROPDOWNLIST ) == CBS_DROPDOWNLIST ) ? rcRect.left + 3 : rcRect.left + 1, rcRect.top, rcRect.right, rcRect.bottom + ( 6 * rcRect.Height() ) ); - if ( CWindowImpl< CListCombo, CComboBox >::Create( hWndParent, Area, NULL, dwStyle ) == NULL ) + if ( CWindowImpl< CListCombo, CComboBox >::Create( hWndParent, Area, nullptr, dwStyle ) == nullptr ) return FALSE; // Get system message font @@ -72,13 +72,13 @@ public: logFont.SetMessageBoxFont(); if ( !m_fntComboFont.IsNull() ) m_fntComboFont.DeleteObject(); - if ( m_fntComboFont.CreateFontIndirect( &logFont ) == NULL ) + if ( m_fntComboFont.CreateFontIndirect( &logFont ) == nullptr ) return FALSE; SetFont( m_fntComboFont, FALSE ); // Subclass edit control to capture keyboard input HWND hEditControl = GetWindow( GW_CHILD ); - if ( hEditControl != NULL ) + if ( hEditControl != nullptr ) m_wndEditCtrl.SubclassWindow( hEditControl ); for ( int nComboItem = 0; nComboItem < aComboList.GetSize(); nComboItem++ ) @@ -326,7 +326,7 @@ public: if ( ( dwStyle & CBS_DROPDOWNLIST ) == CBS_DROPDOWNLIST && !rcClip.EqualRect( m_rcButton ) ) { dcMemory.SetBkColor( m_rgbStaticBackground ); - dcMemory.ExtTextOut( m_rcStatic.left, m_rcStatic.top, ETO_OPAQUE, m_rcStatic, _T( "" ), 0, NULL ); + dcMemory.ExtTextOut( m_rcStatic.left, m_rcStatic.top, ETO_OPAQUE, m_rcStatic, _T( "" ), 0, nullptr ); // Draw static text int nIndex = GetCurSel(); @@ -399,7 +399,7 @@ public: listNotify.m_nSubItem = m_nSubItem; listNotify.m_nExitChar = m_nExitChar; listNotify.m_lpszItemText = strValue.c_str(); - listNotify.m_lpItemDate = NULL; + listNotify.m_lpItemDate = nullptr; // Forward notification to parent FORWARD_WM_NOTIFY( wndParent, listNotify.m_hdrNotify.idFrom, &listNotify.m_hdrNotify, ::SendMessage ); diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCtrl.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCtrl.h index b1e316c90..72f9c16c6 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCtrl.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCtrl.h @@ -223,9 +223,9 @@ public: if ( !m_ilListItems.CreateFromImage( IDB_LISTITEMS, 16, 0, RGB( 255, 0, 255 ), IMAGE_BITMAP, LR_CREATEDIBSECTION ) ) return FALSE; - if ( m_curDivider.LoadCursor( IDC_DIVIDER ) == NULL ) + if ( m_curDivider.LoadCursor( IDC_DIVIDER ) == nullptr ) return FALSE; - if ( m_curHyperLink.LoadCursor( IDC_HYPERLINK ) == NULL ) + if ( m_curHyperLink.LoadCursor( IDC_HYPERLINK ) == nullptr ) return FALSE; // Load interface settings @@ -287,14 +287,14 @@ public: logFont.SetMessageBoxFont(); if ( !m_fntListFont.IsNull() ) m_fntListFont.DeleteObject(); - if ( m_fntListFont.CreateFontIndirect( &logFont ) == NULL ) + if ( m_fntListFont.CreateFontIndirect( &logFont ) == nullptr ) return FALSE; // Get system underline font logFont.lfUnderline = BYTE(TRUE); if ( !m_fntUnderlineFont.IsNull() ) m_fntUnderlineFont.DeleteObject(); - if ( m_fntUnderlineFont.CreateFontIndirect( &logFont ) == NULL ) + if ( m_fntUnderlineFont.CreateFontIndirect( &logFont ) == nullptr ) return FALSE; CClientDC dcClient( m_hWnd ); @@ -1326,7 +1326,7 @@ public: dcHeader.SelectBitmap( bmpHeader ); dcHeader.SetBkColor( m_rgbHeaderBackground ); - dcHeader.ExtTextOut( rcHeaderItem.left, rcHeaderItem.top, ETO_OPAQUE, rcHeaderItem, _T( "" ), 0, NULL ); + dcHeader.ExtTextOut( rcHeaderItem.left, rcHeaderItem.top, ETO_OPAQUE, rcHeaderItem, _T( "" ), 0, nullptr ); dcHeader.Draw3dRect( rcHeaderItem, m_rgbHeaderBorder, m_rgbHeaderShadow ); CRect rcHeaderText( rcHeaderItem ); @@ -1787,7 +1787,7 @@ public: // Format date to local format TCHAR szDateFormat[ DATE_STRING ]; - return GetDateFormat( LOCALE_USER_DEFAULT, DATE_SHORTDATE, &stFormatDate, NULL, szDateFormat, DATE_STRING ) == 0 ? _T( "" ) : szDateFormat; + return GetDateFormat( LOCALE_USER_DEFAULT, DATE_SHORTDATE, &stFormatDate, nullptr, szDateFormat, DATE_STRING ) == 0 ? _T( "" ) : szDateFormat; } stdstr FormatTime( SYSTEMTIME& stFormatDate ) @@ -1799,7 +1799,7 @@ public: // Format time to local format TCHAR szTimeFormat[ DATE_STRING ]; - return GetTimeFormat( LOCALE_USER_DEFAULT, 0, &stFormatTime, NULL, szTimeFormat, DATE_STRING ) == 0 ? _T( "" ) : szTimeFormat; + return GetTimeFormat( LOCALE_USER_DEFAULT, 0, &stFormatTime, nullptr, szTimeFormat, DATE_STRING ) == 0 ? _T( "" ) : szTimeFormat; } void NotifyParent( int nItem, int nSubItem, int nMessage ) @@ -1813,8 +1813,8 @@ public: listNotify.m_nItem = nItem; listNotify.m_nSubItem = GetColumnIndex( nSubItem ); listNotify.m_nExitChar = 0; - listNotify.m_lpszItemText = NULL; - listNotify.m_lpItemDate = NULL; + listNotify.m_lpszItemText = nullptr; + listNotify.m_lpItemDate = nullptr; // Forward notification to parent FORWARD_WM_NOTIFY( pT->GetParent(), listNotify.m_hdrNotify.idFrom, &listNotify.m_hdrNotify, ::SendMessage ); @@ -2799,7 +2799,7 @@ public: case VK_DELETE: pT->SetItemText( pListNotify->m_nItem, nIndex, _T( "" ) ); NotifyParent( pListNotify->m_nItem, pListNotify->m_nSubItem, LCN_MODIFIED ); break; - default: if ( pListNotify->m_lpItemDate == NULL ) + default: if ( pListNotify->m_lpItemDate == nullptr ) pT->SetItemText( pListNotify->m_nItem, nIndex, pListNotify->m_lpszItemText ); else { @@ -2826,7 +2826,7 @@ public: if ( FormatEtc.cfFormat == m_nHeaderClipboardFormat ) { LPBYTE lpDragHeader = (LPBYTE)GlobalLock( StgMedium.hGlobal ); - if ( lpDragHeader == NULL ) + if ( lpDragHeader == nullptr ) return DROPEFFECT_NONE; // Dragged column must originate from this control @@ -2846,7 +2846,7 @@ public: if ( FormatEtc.cfFormat == m_nHeaderClipboardFormat ) { LPBYTE lpDragHeader = (LPBYTE)GlobalLock( StgMedium.hGlobal ); - if ( lpDragHeader == NULL ) + if ( lpDragHeader == nullptr ) return DROPEFFECT_NONE; // Dragged column must originate from this control @@ -2892,11 +2892,11 @@ public: { pStgMedium->tymed = TYMED_HGLOBAL; pStgMedium->hGlobal = GlobalAlloc( GMEM_MOVEABLE, sizeof( HWND ) ); - if ( pStgMedium->hGlobal == NULL ) + if ( pStgMedium->hGlobal == nullptr ) return FALSE; LPBYTE lpDragHeader = (LPBYTE)GlobalLock( pStgMedium->hGlobal ); - if ( lpDragHeader == NULL ) + if ( lpDragHeader == nullptr ) return FALSE; // Store this window handle @@ -2931,7 +2931,7 @@ public: return; dcPaint.SetBkColor( m_rgbBackground ); - dcPaint.ExtTextOut( rcClip.left, rcClip.top, ETO_OPAQUE, rcClip, _T( "" ), 0, NULL ); + dcPaint.ExtTextOut( rcClip.left, rcClip.top, ETO_OPAQUE, rcClip, _T( "" ), 0, nullptr ); CRect rcClient; GetClientRect( rcClient ); @@ -3005,7 +3005,7 @@ public: return; dcPaint.SetBkColor( m_rgbHeaderBackground ); - dcPaint.ExtTextOut( rcHeader.left, rcHeader.top, ETO_OPAQUE, rcHeader, _T( "" ), 0, NULL ); + dcPaint.ExtTextOut( rcHeader.left, rcHeader.top, ETO_OPAQUE, rcHeader, _T( "" ), 0, nullptr ); CPen penHighlight; penHighlight.CreatePen( PS_SOLID, 1, m_rgbHeaderBorder ); @@ -3035,7 +3035,7 @@ public: if ( nColumn == m_nHighlightColumn ) { dcPaint.SetBkColor( m_rgbHeaderHighlight ); - dcPaint.ExtTextOut( rcHeaderItem.left, rcHeaderItem.top, ETO_OPAQUE, rcHeaderItem, _T( "" ), 0, NULL ); + dcPaint.ExtTextOut( rcHeaderItem.left, rcHeaderItem.top, ETO_OPAQUE, rcHeaderItem, _T( "" ), 0, nullptr ); } @@ -3217,7 +3217,7 @@ public: if ( bSelectedItem ) { dcPaint.SetBkColor( m_rgbSelectedItem ); - dcPaint.ExtTextOut( rcItem.left, rcItem.top, ETO_OPAQUE, rcItem, _T( "" ), 0, NULL ); + dcPaint.ExtTextOut( rcItem.left, rcItem.top, ETO_OPAQUE, rcItem, _T( "" ), 0, nullptr ); } CRect rcSubItem( rcItem ); @@ -3256,7 +3256,7 @@ public: if ( bFocusSubItem ) { dcPaint.SetBkColor( m_bEditItem ? m_rgbBackground : m_rgbItemFocus ); - dcPaint.ExtTextOut( rcSubItem.left, rcSubItem.top, ETO_OPAQUE, rcSubItem, _T( "" ), 0, NULL ); + dcPaint.ExtTextOut( rcSubItem.left, rcSubItem.top, ETO_OPAQUE, rcSubItem, _T( "" ), 0, nullptr ); if ( m_bEditItem ) { @@ -3448,7 +3448,7 @@ public: // Draw group select box dcGroupSelect.SetBkColor( m_rgbItemFocus ); - dcGroupSelect.ExtTextOut( 0, 0, ETO_OPAQUE, CRect( CPoint( 0 ), rcSelectArea.Size() ), _T( "" ), 0, NULL ); + dcGroupSelect.ExtTextOut( 0, 0, ETO_OPAQUE, CRect( CPoint( 0 ), rcSelectArea.Size() ), _T( "" ), 0, nullptr ); BLENDFUNCTION blendFunction; blendFunction.BlendOp = AC_SRC_OVER; @@ -3537,7 +3537,7 @@ public: listSubItem.m_nImage = ITEM_IMAGE_NONE; listSubItem.m_nFormat = nFormat; listSubItem.m_nFlags = ValidateFlags( nFlags ); - listSubItem.m_hFont = NULL; + listSubItem.m_hFont = nullptr; listSubItem.m_rgbBackground = m_rgbBackground; listSubItem.m_rgbText = m_rgbItemText; listSubItem.m_rgbSelectedText = m_rgbSelectedText; @@ -3560,7 +3560,7 @@ public: listSubItem.m_nImage = ITEM_IMAGE_NONE; listSubItem.m_nFormat = nFormat; listSubItem.m_nFlags = ValidateFlags( nFlags ); - listSubItem.m_hFont = NULL; + listSubItem.m_hFont = nullptr; listSubItem.m_rgbBackground = m_rgbBackground; listSubItem.m_rgbText = m_rgbItemText; listSubItem.m_rgbSelectedText = m_rgbSelectedText; @@ -3607,7 +3607,7 @@ public: { if ( nItem < 0 || nItem >= GetItemCount() ) { - listItem = NULL; + listItem = nullptr; return FALSE; } listItem = &m_aItems[ nItem ]; @@ -3630,12 +3630,12 @@ public: CListItem< TData > * listItem; if ( !GetItem( nItem, listItem ) ) { - listSubItem = NULL; + listSubItem = nullptr; return FALSE; } if ( nSubItem < 0 || nSubItem >= (int)listItem->m_aSubItems.GetSize() ) { - listSubItem = NULL; + listSubItem = nullptr; return FALSE; } listSubItem = &listItem->m_aSubItems[ nSubItem ]; @@ -3690,7 +3690,7 @@ public: CSubItem * listSubItem; if ( !GetSubItem( nItem, nSubItem, listSubItem ) ) return FALSE; - return listSubItem->m_hFont == NULL ? CListImpl< CListCtrlData >::GetItemFont( nItem, nSubItem ) : listSubItem->m_hFont; + return listSubItem->m_hFont == nullptr ? CListImpl< CListCtrlData >::GetItemFont( nItem, nSubItem ) : listSubItem->m_hFont; } BOOL GetItemColours( int nItem, int nSubItem, COLORREF& rgbBackground, COLORREF& rgbText ) diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListDate.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListDate.h index 980e649ad..be592ac1b 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListDate.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListDate.h @@ -48,7 +48,7 @@ public: // Create date-time control CRect Area( rcRect.left + 3, rcRect.top + 2, rcRect.right - 3, rcRect.bottom - 2 ); - if ( CWindowImpl< CListDate, CDateTimePickerCtrl >::Create( hWndParent, Area, NULL, dwStyle ) == NULL ) + if ( CWindowImpl< CListDate, CDateTimePickerCtrl >::Create( hWndParent, Area, nullptr, dwStyle ) == nullptr ) return FALSE; // Remove border @@ -59,7 +59,7 @@ public: logFont.SetMessageBoxFont(); if ( !m_fntDateFont.IsNull() ) m_fntDateFont.DeleteObject(); - if ( m_fntDateFont.CreateFontIndirect( &logFont ) == NULL ) + if ( m_fntDateFont.CreateFontIndirect( &logFont ) == nullptr ) return FALSE; SetMonthCalFont( m_fntDateFont ); SetFont( m_fntDateFont ); @@ -110,7 +110,7 @@ public: void OnKillFocus( HWND hNewWnd ) { // Have we dropped down the calendar control? - if ( hNewWnd != NULL && GetMonthCal() == hNewWnd ) + if ( hNewWnd != nullptr && GetMonthCal() == hNewWnd ) return; // Have we selected a new date from the calendar control? diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListEdit.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListEdit.h index d82968ba2..6c937b1a6 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListEdit.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListEdit.h @@ -49,7 +49,7 @@ public: // Create edit control CRect Area( rcRect.left - 2, rcRect.top - 3, rcRect.right + 3, rcRect.bottom + 2 ); - if ( CWindowImpl< CListEdit, CEdit >::Create( hWndParent, Area, NULL, dwStyle ) == NULL ) + if ( CWindowImpl< CListEdit, CEdit >::Create( hWndParent, Area, nullptr, dwStyle ) == nullptr ) return FALSE; // Get system message font @@ -57,7 +57,7 @@ public: logFont.SetMessageBoxFont(); if ( !m_fntEditFont.IsNull() ) m_fntEditFont.DeleteObject(); - if ( m_fntEditFont.CreateFontIndirect( &logFont ) == NULL ) + if ( m_fntEditFont.CreateFontIndirect( &logFont ) == nullptr ) return FALSE; SetFont( m_fntEditFont ); @@ -231,7 +231,7 @@ public: listNotify.m_nSubItem = m_nSubItem; listNotify.m_nExitChar = m_nExitChar; listNotify.m_lpszItemText = strValue.c_str(); - listNotify.m_lpItemDate = NULL; + listNotify.m_lpItemDate = nullptr; // Forward notification to parent FORWARD_WM_NOTIFY( wndParent, listNotify.m_hdrNotify.idFrom, &listNotify.m_hdrNotify, ::SendMessage ); diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListTypes.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListTypes.h index 74fd47be4..ce0f992c5 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListTypes.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListTypes.h @@ -129,7 +129,7 @@ public: { int nNewAllocSize = ( m_nAllocSize == 0 ) ? 1 : ( m_nSize * 2 ); T* aT = (T*)realloc( m_aT, nNewAllocSize * sizeof( T ) ); - if ( aT == NULL ) + if ( aT == nullptr ) return FALSE; m_nAllocSize = nNewAllocSize; m_aT = aT; diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/TitleTip.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/TitleTip.h index e299d2359..2294b9803 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/TitleTip.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/TitleTip.h @@ -6,7 +6,7 @@ class CTitleTip : public CWindowImpl< CTitleTip > public: CTitleTip() { - m_hWndParent = NULL; + m_hWndParent = nullptr; } ~CTitleTip() @@ -41,8 +41,8 @@ public: m_rgbBackgroundTop = RGB( 250, 250, 250 ); m_rgbBackgroundBottom = RGB( 235, 235, 235 ); - CRect Area(NULL); - if ( CWindowImpl< CTitleTip >::Create( hWndParent, Area, NULL, WS_POPUP, WS_EX_TOOLWINDOW | WS_EX_TOPMOST ) == NULL ) + CRect Area(nullptr); + if ( CWindowImpl< CTitleTip >::Create( hWndParent, Area, nullptr, WS_POPUP, WS_EX_TOOLWINDOW | WS_EX_TOPMOST ) == nullptr ) return FALSE; // Create the tooltip @@ -55,7 +55,7 @@ public: logFont.SetMessageBoxFont(); if ( !m_fntTitleFont.IsNull() ) m_fntTitleFont.DeleteObject(); - return ( m_fntTitleFont.CreateFontIndirect( &logFont ) != NULL ); + return ( m_fntTitleFont.CreateFontIndirect( &logFont ) != nullptr ); } BOOL Show( CRect& rcRect, LPCTSTR lpszItemText, LPCTSTR lpszToolTip ) @@ -93,7 +93,7 @@ public: } // Show title tip at new location - if ( !SetWindowPos( NULL, rcRect.left - 4, rcRect.top, rcTextExtent.Width() + 11, rcRect.Height(), SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOCOPYBITS ) ) + if ( !SetWindowPos( nullptr, rcRect.left - 4, rcRect.top, rcTextExtent.Width() + 11, rcRect.Height(), SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOCOPYBITS ) ) return FALSE; SetCapture(); @@ -119,7 +119,7 @@ public: { if ( m_ttToolTip.IsWindow() ) m_ttToolTip.DestroyWindow(); - m_ttToolTip.m_hWnd = NULL; + m_ttToolTip.m_hWnd = nullptr; } LRESULT OnMouseRange( UINT nMessage, WPARAM wParam, LPARAM lParam ) @@ -198,7 +198,7 @@ public: CRect rcTitleTip( rcClient ); dcPaint.SetBkColor( m_rgbBackground ); - dcPaint.ExtTextOut( rcTitleTip.left, rcTitleTip.top, ETO_OPAQUE, rcTitleTip, _T( "" ), 0, NULL ); + dcPaint.ExtTextOut( rcTitleTip.left, rcTitleTip.top, ETO_OPAQUE, rcTitleTip, _T( "" ), 0, nullptr ); CBrush bshTitleFrame; bshTitleFrame.CreateSolidBrush( m_rgbTextColour ); diff --git a/Source/Project64/UserInterface/WTLControls/EditNumber32.cpp b/Source/Project64/UserInterface/WTLControls/EditNumber32.cpp index ea895ebc7..de488de42 100644 --- a/Source/Project64/UserInterface/WTLControls/EditNumber32.cpp +++ b/Source/Project64/UserInterface/WTLControls/EditNumber32.cpp @@ -92,7 +92,7 @@ void CEditNumber32::FormatClipboard() return; } hglb = GetClipboardData(CF_UNICODETEXT); - if (hglb != NULL) + if (hglb != nullptr) { lptstr = (LPTSTR)GlobalLock(hglb); for (unsigned int i = 0; i < wcslen(lptstr); i++) @@ -111,7 +111,7 @@ void CEditNumber32::FormatClipboard() } } hglb = GlobalAlloc(GMEM_MOVEABLE, (wcslen(lptstr) + 1) * sizeof(TCHAR)); - if (hglb == NULL) + if (hglb == nullptr) { CloseClipboard(); return; @@ -148,7 +148,7 @@ LRESULT CEditNumber32::OnPaste(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam } HGLOBAL hglb = GetClipboardData(CF_UNICODETEXT); - if (hglb != NULL) + if (hglb != nullptr) { LPTSTR lptstr = (LPTSTR)GlobalLock(hglb); // Check invalid hex string diff --git a/Source/Project64/UserInterface/WTLControls/HexEditCtrl.cpp b/Source/Project64/UserInterface/WTLControls/HexEditCtrl.cpp index 308e6517b..3e58e9470 100644 --- a/Source/Project64/UserInterface/WTLControls/HexEditCtrl.cpp +++ b/Source/Project64/UserInterface/WTLControls/HexEditCtrl.cpp @@ -16,14 +16,14 @@ CHexEditCtrl::CHexEditCtrl(void) : m_bHaveCaret(false), m_bShowHotAddress(false), m_HotAddress(0), - m_Font(NULL), - m_BackBMP(NULL), - m_BackDC(NULL), + m_Font(nullptr), + m_BackBMP(nullptr), + m_BackDC(nullptr), m_CharWidth(0), m_CharHeight(0), m_FocusedColumn(HX_COL_NONE), - m_hCursorIBeam(NULL), - m_hCursorDefault(NULL), + m_hCursorIBeam(nullptr), + m_hCursorDefault(nullptr), m_DragScrollDelta(0), m_AddressColumnRect({0}), m_HexDataColumnRect({0}), @@ -32,8 +32,8 @@ CHexEditCtrl::CHexEditCtrl(void) : m_bLButtonDown(false), m_bMouseDragging(false), m_bLayoutChanged(false), - m_OldBytes(NULL), - m_NewBytes(NULL), + m_OldBytes(nullptr), + m_NewBytes(nullptr), m_NumBytesPerGroup(4), m_NumByteGroupsPerRow(0), m_NumVisibleRows(0), @@ -43,7 +43,7 @@ CHexEditCtrl::CHexEditCtrl(void) : m_bHaveRealSel(false) { WNDCLASS wc; - if (!GetClassInfo(GetModuleHandle(NULL), _T("HexEditCtrl"), &wc)) + if (!GetClassInfo(GetModuleHandle(nullptr), _T("HexEditCtrl"), &wc)) { GetWndClassInfo().m_wc.lpfnWndProc = m_pfnSuperWindowProc; GetWndClassInfo().Register(&m_pfnSuperWindowProc); @@ -75,7 +75,7 @@ bool CHexEditCtrl::HaveFont(HDC hdc, const char* name) BOOL CHexEditCtrl::Attach(HWND hWnd) { - if (m_hWnd != NULL) + if (m_hWnd != nullptr) { return FALSE; } @@ -100,8 +100,8 @@ BOOL CHexEditCtrl::Attach(HWND hWnd) hOldBMP = (HBITMAP)SelectObject(m_BackDC, m_BackBMP); DeleteObject(hOldBMP); - m_hCursorIBeam = LoadCursor(NULL, IDC_IBEAM); - m_hCursorDefault = LoadCursor(NULL, IDC_ARROW); + m_hCursorIBeam = LoadCursor(nullptr, IDC_IBEAM); + m_hCursorDefault = LoadCursor(nullptr, IDC_ARROW); float dpiScale = ::GetDeviceCaps(hdc, LOGPIXELSX) / 96.0f; @@ -140,8 +140,8 @@ BOOL CHexEditCtrl::Attach(HWND hWnd) FillRect(m_BackDC, clrRc, hbrush); DeleteObject(hbrush); - SetTimer(TIMER_ID_AUTO_REFRESH, 20, NULL); - SetTimer(TIMER_ID_DRAG_SCROLL, 50, NULL); + SetTimer(TIMER_ID_AUTO_REFRESH, 20, nullptr); + SetTimer(TIMER_ID_DRAG_SCROLL, 50, nullptr); ReleaseDC(hdc); @@ -150,42 +150,42 @@ BOOL CHexEditCtrl::Attach(HWND hWnd) HWND CHexEditCtrl::Detach(void) { - if (m_hWnd == NULL) + if (m_hWnd == nullptr) { - return NULL; + return nullptr; } KillTimer(TIMER_ID_AUTO_REFRESH); KillTimer(TIMER_ID_DRAG_SCROLL); - if (m_BackBMP != NULL) + if (m_BackBMP != nullptr) { DeleteObject(m_BackBMP); - m_BackBMP = NULL; + m_BackBMP = nullptr; } - if (m_BackDC != NULL) + if (m_BackDC != nullptr) { DeleteObject(m_BackDC); - m_BackDC = NULL; + m_BackDC = nullptr; } - if (m_Font != NULL) + if (m_Font != nullptr) { DeleteObject(m_Font); - m_Font = NULL; + m_Font = nullptr; } - if (m_NewBytes != NULL) + if (m_NewBytes != nullptr) { free(m_NewBytes); - m_NewBytes = NULL; + m_NewBytes = nullptr; } - if (m_OldBytes != NULL) + if (m_OldBytes != nullptr) { free(m_OldBytes); - m_OldBytes = NULL; + m_OldBytes = nullptr; } return CWindowImpl::UnsubclassWindow(); @@ -241,7 +241,7 @@ void CHexEditCtrl::Draw(void) memmove(&m_OldBytes[shiftDstIndex], &m_OldBytes[shiftSrcIndex], numBytesToShift * sizeof(HXBYTEINFO)); memmove(&m_NewBytes[shiftDstIndex], &m_NewBytes[shiftSrcIndex], numBytesToShift * sizeof(HXBYTEINFO)); - ScrollDC(m_BackDC, 0, -rowDelta * m_CharHeight, &rcScrollArea, &rcScrollArea, NULL, NULL); + ScrollDC(m_BackDC, 0, -rowDelta * m_CharHeight, &rcScrollArea, &rcScrollArea, nullptr, nullptr); InvalidateRect(&rcScrollArea, false); } @@ -1020,7 +1020,7 @@ BOOL CHexEditCtrl::OnMouseWheel(UINT /*nFlags*/, short zDelta, CPoint /*pt*/) void CHexEditCtrl::OnSetFocus(CWindow /*wndOld*/) { - ::CreateCaret(m_hWnd, NULL, 2, m_CharHeight); + ::CreateCaret(m_hWnd, nullptr, 2, m_CharHeight); m_bHaveCaret = true; UpdateCaretUI(false); } diff --git a/Source/Project64/UserInterface/WTLControls/ModifiedCheckBox.h b/Source/Project64/UserInterface/WTLControls/ModifiedCheckBox.h index 49a0ddf1e..7695460d1 100644 --- a/Source/Project64/UserInterface/WTLControls/ModifiedCheckBox.h +++ b/Source/Project64/UserInterface/WTLControls/ModifiedCheckBox.h @@ -11,12 +11,12 @@ class CModifiedButton : public: // Constructors - CModifiedButton(HWND hWnd = NULL) : + CModifiedButton(HWND hWnd = nullptr) : CButton(hWnd), m_Changed(false), m_Reset(false), - m_BoldFont(NULL), - m_OriginalFont(NULL) + m_BoldFont(nullptr), + m_OriginalFont(nullptr) { } @@ -43,7 +43,7 @@ public: if (m_Changed) { SetReset(false); - if (m_BoldFont == NULL) + if (m_BoldFont == nullptr) { m_OriginalFont = (HFONT)SendMessage(WM_GETFONT); @@ -54,12 +54,12 @@ public: m_BoldFont = CreateFontIndirect ( &lfSystemVariableFont ); } SendMessage(WM_SETFONT,(WPARAM)m_BoldFont); - InvalidateRect(NULL); + InvalidateRect(nullptr); } else { if (m_OriginalFont) { SendMessage(WM_SETFONT,(WPARAM)m_OriginalFont); - InvalidateRect(NULL); + InvalidateRect(nullptr); } } } diff --git a/Source/Project64/UserInterface/WTLControls/ModifiedComboBox.h b/Source/Project64/UserInterface/WTLControls/ModifiedComboBox.h index ff5b17e2b..a6d48b7d4 100644 --- a/Source/Project64/UserInterface/WTLControls/ModifiedComboBox.h +++ b/Source/Project64/UserInterface/WTLControls/ModifiedComboBox.h @@ -8,14 +8,14 @@ class CModifiedComboBoxT : public: // Constructors - CModifiedComboBoxT(TParam defaultValue, HWND hWnd = NULL, bool AllwaysSelected = true) : + CModifiedComboBoxT(TParam defaultValue, HWND hWnd = nullptr, bool AllwaysSelected = true) : CComboBox(hWnd), m_Changed(false), m_Reset(false), m_defaultValue(defaultValue), - m_BoldFont(NULL), - m_OriginalFont(NULL), - m_TextField(NULL), + m_BoldFont(nullptr), + m_OriginalFont(nullptr), + m_TextField(nullptr), m_AllwaysSelected(AllwaysSelected) { } @@ -64,7 +64,7 @@ public: if (m_Changed) { SetReset(false); - if (m_BoldFont == NULL) + if (m_BoldFont == nullptr) { m_OriginalFont = (HFONT)SendMessage(WM_GETFONT); @@ -75,22 +75,22 @@ public: m_BoldFont = CreateFontIndirect ( &lfSystemVariableFont ); } SendMessage(WM_SETFONT,(WPARAM)m_BoldFont); - InvalidateRect(NULL); + InvalidateRect(nullptr); if (m_TextField) { ::SendMessage(m_TextField,WM_SETFONT,(WPARAM)m_BoldFont,0); - ::InvalidateRect(m_TextField, NULL, true); + ::InvalidateRect(m_TextField, nullptr, true); } } else { if (m_OriginalFont) { SendMessage(WM_SETFONT,(WPARAM)m_OriginalFont); - InvalidateRect(NULL); + InvalidateRect(nullptr); if (m_TextField) { ::SendMessage(m_TextField,WM_SETFONT,(WPARAM)m_OriginalFont,0); - ::InvalidateRect(m_TextField, NULL, true); + ::InvalidateRect(m_TextField, nullptr, true); } } } diff --git a/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.cpp b/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.cpp index 7177a3837..eaeeddcdf 100644 --- a/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.cpp +++ b/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.cpp @@ -1,12 +1,12 @@ #include "stdafx.h" -CModifiedEditBox::CModifiedEditBox(bool bString /* = true */, HWND hWnd /* = NULL */) : +CModifiedEditBox::CModifiedEditBox(bool bString /* = true */, HWND hWnd /* = nullptr */) : CEdit(hWnd), m_Changed(false), m_Reset(false), -m_BoldFont(NULL), -m_OriginalFont(NULL), -m_TextField(NULL), +m_BoldFont(nullptr), +m_OriginalFont(nullptr), +m_TextField(nullptr), m_bString(bString) { } @@ -34,7 +34,7 @@ void CModifiedEditBox::SetChanged(bool Changed) if (m_Changed) { SetReset(false); - if (m_BoldFont == NULL) + if (m_BoldFont == nullptr) { m_OriginalFont = (HFONT)SendMessage(WM_GETFONT); @@ -45,11 +45,11 @@ void CModifiedEditBox::SetChanged(bool Changed) m_BoldFont = CreateFontIndirect(&lfSystemVariableFont); } SendMessage(WM_SETFONT, (WPARAM)m_BoldFont); - InvalidateRect(NULL); + InvalidateRect(nullptr); if (m_TextField) { ::SendMessage(m_TextField, WM_SETFONT, (WPARAM)m_BoldFont, 0); - ::InvalidateRect(m_TextField, NULL, true); + ::InvalidateRect(m_TextField, nullptr, true); } } else @@ -57,11 +57,11 @@ void CModifiedEditBox::SetChanged(bool Changed) if (m_OriginalFont) { SendMessage(WM_SETFONT, (WPARAM)m_OriginalFont); - InvalidateRect(NULL); + InvalidateRect(nullptr); if (m_TextField) { ::SendMessage(m_TextField, WM_SETFONT, (WPARAM)m_OriginalFont, 0); - ::InvalidateRect(m_TextField, NULL, true); + ::InvalidateRect(m_TextField, nullptr, true); } } } diff --git a/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.h b/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.h index 4199bfc99..a1d8aa8ea 100644 --- a/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.h +++ b/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.h @@ -12,7 +12,7 @@ class CModifiedEditBox : public: // Constructors - CModifiedEditBox(bool bString = true, HWND hWnd = NULL); + CModifiedEditBox(bool bString = true, HWND hWnd = nullptr); ~CModifiedEditBox(); void SetReset ( bool Reset ); diff --git a/Source/Project64/UserInterface/WTLControls/PartialGroupBox.cpp b/Source/Project64/UserInterface/WTLControls/PartialGroupBox.cpp index 7819e3591..19c74b396 100644 --- a/Source/Project64/UserInterface/WTLControls/PartialGroupBox.cpp +++ b/Source/Project64/UserInterface/WTLControls/PartialGroupBox.cpp @@ -2,7 +2,7 @@ BOOL CPartialGroupBox::Attach(HWND hWnd) { - ATLASSUME(m_hWnd == NULL); + ATLASSUME(m_hWnd == nullptr); ATLASSERT(::IsWindow(hWnd)); // Allocate the thunk structure here, where we can fail gracefully @@ -14,7 +14,7 @@ BOOL CPartialGroupBox::Attach(HWND hWnd) } WNDPROC pProc = m_thunk.GetWNDPROC(); WNDPROC pfnWndProc = (WNDPROC)::SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)pProc); - if (pfnWndProc == NULL) + if (pfnWndProc == nullptr) return FALSE; m_pfnSuperWindowProc = pfnWndProc; m_hWnd = hWnd; diff --git a/Source/Project64/UserInterface/WTLControls/TooltipDialog.h b/Source/Project64/UserInterface/WTLControls/TooltipDialog.h index fca8f600b..b34fd73ee 100644 --- a/Source/Project64/UserInterface/WTLControls/TooltipDialog.h +++ b/Source/Project64/UserInterface/WTLControls/TooltipDialog.h @@ -41,7 +41,7 @@ public: CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, pT->m_hWnd, NULL, - NULL, NULL); + NULL, NULL); const _ToolTipMap* map = pT->_GetToolTipMap(); diff --git a/Source/Project64/UserInterface/WTLControls/wtl-BitmapPicture.cpp b/Source/Project64/UserInterface/WTLControls/wtl-BitmapPicture.cpp index dc41f4e80..cc2f6d81a 100644 --- a/Source/Project64/UserInterface/WTLControls/wtl-BitmapPicture.cpp +++ b/Source/Project64/UserInterface/WTLControls/wtl-BitmapPicture.cpp @@ -2,7 +2,7 @@ #include "wtl-BitmapPicture.h" CBitmapPicture::CBitmapPicture() : - m_hBitmap(NULL), + m_hBitmap(nullptr), m_nResourceID(-1), m_ResourceIcon(false) { @@ -24,7 +24,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 diff --git a/Source/Project64/UserInterface/WelcomeScreen.cpp b/Source/Project64/UserInterface/WelcomeScreen.cpp index 83940ba4a..9a6afce50 100644 --- a/Source/Project64/UserInterface/WelcomeScreen.cpp +++ b/Source/Project64/UserInterface/WelcomeScreen.cpp @@ -15,13 +15,13 @@ void WelcomeScreen::SelectGameDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/) stdstr InitialDir = g_Settings->LoadStringVal(RomList_GameDir); std::wstring wTitle = L"Select Game Directory"; bi.hwndOwner = m_hWnd; - bi.pidlRoot = NULL; + bi.pidlRoot = nullptr; bi.pszDisplayName = Buffer; bi.lpszTitle = wTitle.c_str(); bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; bi.lpfn = (BFFCALLBACK)SelectDirCallBack; bi.lParam = (DWORD)InitialDir.c_str(); - if ((pidl = SHBrowseForFolder(&bi)) != NULL) + if ((pidl = SHBrowseForFolder(&bi)) != nullptr) { if (SHGetPathFromIDList(pidl, Directory)) { diff --git a/Source/Project64/WTLApp.h b/Source/Project64/WTLApp.h index 6609253b1..4fd83e0eb 100644 --- a/Source/Project64/WTLApp.h +++ b/Source/Project64/WTLApp.h @@ -33,7 +33,7 @@ class CPj64Module : public: CPj64Module(void) { - Init(NULL, GetModuleHandle(NULL)); + Init(nullptr, GetModuleHandle(nullptr)); } virtual ~CPj64Module(void) { diff --git a/Source/Project64/main.cpp b/Source/Project64/main.cpp index eed4a3621..f7d72ce2c 100644 --- a/Source/Project64/main.cpp +++ b/Source/Project64/main.cpp @@ -7,7 +7,7 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR / { try { - CoInitialize(NULL); + CoInitialize(nullptr); AppInit(&Notify(), CPath(CPath::MODULE_DIRECTORY), __argc, __argv); if (!g_Lang->IsLanguageLoaded()) { @@ -89,14 +89,14 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR / { g_BaseSystem->CloseCpu(); delete g_BaseSystem; - g_BaseSystem = NULL; + g_BaseSystem = nullptr; } WriteTrace(TraceUserInterface, TraceDebug, "System closed"); } catch (...) { WriteTrace(TraceUserInterface, TraceError, "Exception caught (File: \"%s\" Line: %d)", __FILE__, __LINE__); - MessageBox(NULL, stdstr_f("Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__).ToUTF16().c_str(), L"Exception", MB_OK); + MessageBox(nullptr, stdstr_f("Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__).ToUTF16().c_str(), L"Exception", MB_OK); } AppCleanup(); CoUninitialize(); diff --git a/Source/Settings/Settings.cpp b/Source/Settings/Settings.cpp index 5ef32ae0e..91ea3663c 100644 --- a/Source/Settings/Settings.cpp +++ b/Source/Settings/Settings.cpp @@ -137,7 +137,7 @@ void SetModuleName(const char * Name) void RegisterSetting(short SettingID, SETTING_DATA_TYPE Type, const char * Name, const char * Category, unsigned int DefaultDW, const char * DefaultStr) { - if (g_PluginSettings.RegisterSetting == NULL) + if (g_PluginSettings.RegisterSetting == nullptr) { return; } @@ -198,7 +198,7 @@ void RegisterSetting(short SettingID, SETTING_DATA_TYPE Type, const char * Name, case Data_String_Game: case Data_String_RDB: case Data_String_RDB_Setting: - if (DefaultStr != NULL && strlen(DefaultStr) > 0) + if (DefaultStr != nullptr && strlen(DefaultStr) > 0) { // Create default DefaultID = SettingID + g_PluginSettings.DefaultStartRange; @@ -284,7 +284,7 @@ void FlushSettings(void) unsigned int GetSetting(short SettingID) { - if (g_PluginSettings.GetSetting == NULL) + if (g_PluginSettings.GetSetting == nullptr) { return 0; } @@ -303,7 +303,7 @@ const char * GetSettingSz(short SettingID, char * Buffer, int BufferLen) const char * GetSystemSettingSz(short SettingID, char * Buffer, int BufferLen) { - if (g_PluginSettings.GetSettingSz == NULL) + if (g_PluginSettings.GetSettingSz == nullptr) { return ""; } @@ -348,7 +348,7 @@ void SettingsUnregisterChange(bool SystemSetting, int SettingID, void * Data, Se void CNotification::DisplayError(const char * Message) { - if (g_PluginNotification.BreakPoint != NULL) + if (g_PluginNotification.BreakPoint != nullptr) { g_PluginNotification.DisplayError(Message); } @@ -356,7 +356,7 @@ void CNotification::DisplayError(const char * Message) void CNotification::FatalError(const char * Message) { - if (g_PluginNotification.BreakPoint != NULL) + if (g_PluginNotification.BreakPoint != nullptr) { g_PluginNotification.FatalError(Message); } @@ -364,7 +364,7 @@ void CNotification::FatalError(const char * Message) void CNotification::DisplayMessage(int DisplayTime, const char * Message) { - if (g_PluginNotification.BreakPoint != NULL) + if (g_PluginNotification.BreakPoint != nullptr) { g_PluginNotification.DisplayMessage(DisplayTime, Message); } @@ -372,7 +372,7 @@ void CNotification::DisplayMessage(int DisplayTime, const char * Message) void CNotification::DisplayMessage2(const char * Message) { - if (g_PluginNotification.BreakPoint != NULL) + if (g_PluginNotification.BreakPoint != nullptr) { g_PluginNotification.DisplayMessage2(Message); } @@ -380,7 +380,7 @@ void CNotification::DisplayMessage2(const char * Message) void CNotification::BreakPoint(const char * FileName, int LineNumber) { - if (g_PluginNotification.BreakPoint != NULL) + if (g_PluginNotification.BreakPoint != nullptr) { g_PluginNotification.BreakPoint(FileName, LineNumber); }