From d802d392811be44d34ae9cd23f616db93e54c50f Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sun, 9 Mar 2014 21:14:26 +0100 Subject: [PATCH] clang-modernize -use-nullptr and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine --- Source/Core/AudioCommon/AOSoundStream.cpp | 4 +- Source/Core/AudioCommon/AlsaSoundStream.cpp | 6 +- .../Core/AudioCommon/CoreAudioSoundStream.cpp | 4 +- Source/Core/AudioCommon/DPL2Decoder.cpp | 6 +- Source/Core/AudioCommon/DSoundStream.cpp | 8 +- Source/Core/AudioCommon/OpenALStream.cpp | 4 +- Source/Core/AudioCommon/OpenALStream.h | 2 +- Source/Core/AudioCommon/OpenSLESStream.cpp | 32 ++--- Source/Core/AudioCommon/OpenSLESStream.h | 4 +- Source/Core/AudioCommon/PulseAudioStream.cpp | 14 +-- Source/Core/AudioCommon/WaveFile.cpp | 2 +- Source/Core/AudioCommon/XAudio2Stream.cpp | 2 +- Source/Core/AudioCommon/XAudio2_7Stream.cpp | 2 +- Source/Core/AudioCommon/aldlist.cpp | 20 +-- Source/Core/Common/ArmCPUDetect.cpp | 10 +- Source/Core/Common/ArmEmitter.h | 4 +- Source/Core/Common/BreakPoints.cpp | 4 +- Source/Core/Common/CDUtils.cpp | 12 +- Source/Core/Common/ChunkFile.h | 10 +- Source/Core/Common/CommonFuncs.h | 2 +- Source/Core/Common/ConsoleListener.cpp | 14 +-- Source/Core/Common/Crypto/ec.cpp | 2 +- Source/Core/Common/ExtendedTrace.cpp | 24 ++-- Source/Core/Common/FifoQueue.h | 8 +- Source/Core/Common/FileUtil.cpp | 38 +++--- Source/Core/Common/FileUtil.h | 6 +- Source/Core/Common/IniFile.cpp | 6 +- Source/Core/Common/LinearDiskCache.h | 2 +- Source/Core/Common/LogManager.cpp | 4 +- Source/Core/Common/MemArena.cpp | 12 +- Source/Core/Common/MemoryUtil.cpp | 16 +-- Source/Core/Common/Misc.cpp | 4 +- Source/Core/Common/StdConditionVariable.h | 4 +- Source/Core/Common/StdMutex.h | 10 +- Source/Core/Common/StdThread.h | 6 +- Source/Core/Common/StringUtil.cpp | 8 +- Source/Core/Common/SymbolDB.cpp | 2 +- Source/Core/Common/SymbolDB.h | 6 +- Source/Core/Common/Timer.cpp | 6 +- Source/Core/Common/x64Emitter.h | 6 +- Source/Core/Core/ActionReplay.cpp | 2 +- Source/Core/Core/ArmMemTools.cpp | 2 +- Source/Core/Core/Boot/Boot.cpp | 4 +- Source/Core/Core/Boot/Boot.h | 6 +- Source/Core/Core/Boot/Boot_DOL.cpp | 8 +- Source/Core/Core/Boot/Boot_WiiWAD.cpp | 4 +- Source/Core/Core/Boot/ElfReader.cpp | 6 +- Source/Core/Core/Boot/ElfReader.h | 4 +- Source/Core/Core/ConfigManager.cpp | 2 +- Source/Core/Core/Core.cpp | 2 +- Source/Core/Core/CoreParameter.cpp | 8 +- Source/Core/Core/CoreTiming.cpp | 6 +- Source/Core/Core/DSP/DSPAssembler.cpp | 50 ++++---- Source/Core/Core/DSP/DSPAssembler.h | 6 +- Source/Core/Core/DSP/DSPCodeUtil.cpp | 4 +- Source/Core/Core/DSP/DSPCore.cpp | 8 +- Source/Core/Core/DSP/DSPDisassembler.cpp | 6 +- Source/Core/Core/DSP/DSPEmitter.cpp | 10 +- Source/Core/Core/DSP/DSPTables.cpp | 114 +++++++++--------- Source/Core/Core/DSP/Jit/DSPJitBranch.cpp | 2 +- Source/Core/Core/DSP/Jit/DSPJitRegCache.cpp | 2 +- Source/Core/Core/DSP/Jit/DSPJitUtil.cpp | 4 +- Source/Core/Core/Debugger/Dump.cpp | 6 +- Source/Core/Core/FifoPlayer/FifoDataFile.cpp | 4 +- Source/Core/Core/FifoPlayer/FifoPlayer.cpp | 12 +- .../Core/FifoPlayer/FifoRecordAnalyzer.cpp | 2 +- Source/Core/Core/FifoPlayer/FifoRecorder.cpp | 8 +- Source/Core/Core/HLE/HLE.cpp | 6 +- Source/Core/Core/HW/BBA-TAP/TAP_Unix.cpp | 2 +- Source/Core/Core/HW/BBA-TAP/TAP_Win32.cpp | 16 +-- Source/Core/Core/HW/CPU.cpp | 8 +- Source/Core/Core/HW/CPU.h | 2 +- Source/Core/Core/HW/DSP.cpp | 6 +- Source/Core/Core/HW/DSPHLE/DSPHLE.cpp | 20 +-- .../Core/Core/HW/DSPHLE/UCodes/UCode_AX.cpp | 4 +- .../Core/HW/DSPHLE/UCodes/UCode_AXWii.cpp | 6 +- Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp | 2 +- Source/Core/Core/HW/DSPLLE/DSPLLE.cpp | 4 +- Source/Core/Core/HW/DSPLLE/DSPSymbols.cpp | 2 +- Source/Core/Core/HW/EXI.cpp | 4 +- Source/Core/Core/HW/EXI_Channel.cpp | 8 +- Source/Core/Core/HW/EXI_Device.cpp | 4 +- Source/Core/Core/HW/EXI_Device.h | 2 +- Source/Core/Core/HW/EXI_DeviceIPL.cpp | 2 +- Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp | 8 +- Source/Core/Core/HW/GCMemcard.cpp | 6 +- Source/Core/Core/HW/Memmap.cpp | 20 +-- Source/Core/Core/HW/SI.cpp | 2 +- .../Core/HW/WiimoteEmu/EmuSubroutines.cpp | 8 +- Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp | 2 +- Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h | 2 +- Source/Core/Core/HW/WiimoteReal/IODummy.cpp | 2 +- Source/Core/Core/HW/WiimoteReal/IONix.cpp | 8 +- Source/Core/Core/HW/WiimoteReal/IOWin.cpp | 70 +++++------ Source/Core/Core/HW/WiimoteReal/IOdarwin.mm | 18 +-- .../Core/Core/HW/WiimoteReal/WiimoteReal.cpp | 14 +-- Source/Core/Core/IPC_HLE/ICMPWin.cpp | 2 +- Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp | 24 ++-- .../Core/IPC_HLE/WII_IPC_HLE_Device_DI.cpp | 16 +-- .../Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 10 +- .../Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp | 2 +- .../Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp | 28 ++--- .../Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp | 38 +++--- .../IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp | 8 +- .../IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp | 2 +- .../Core/IPC_HLE/WII_IPC_HLE_Device_usb.cpp | 34 +++--- .../IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp | 2 +- .../Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.cpp | 4 +- Source/Core/Core/IPC_HLE/WII_Socket.cpp | 12 +- Source/Core/Core/IPC_HLE/WiiMote_HID_Attr.cpp | 2 +- Source/Core/Core/IPC_HLE/fakepoll.h | 12 +- Source/Core/Core/Movie.cpp | 28 ++--- Source/Core/Core/NetPlayClient.cpp | 6 +- Source/Core/Core/NetPlayServer.cpp | 8 +- Source/Core/Core/PowerPC/GDBStub.cpp | 24 ++-- .../Interpreter_SystemRegisters.cpp | 2 +- .../Interpreter/Interpreter_Tables.cpp | 10 +- .../Core/Core/PowerPC/Jit64/JitRegCache.cpp | 2 +- Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp | 26 ++-- Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp | 4 +- Source/Core/Core/PowerPC/Jit64IL/JitIL.h | 2 +- Source/Core/Core/PowerPC/JitArmIL/JitIL.h | 2 +- .../Core/PowerPC/JitCommon/JitBackpatch.cpp | 8 +- .../Core/Core/PowerPC/JitCommon/JitCache.cpp | 22 ++-- Source/Core/Core/PowerPC/JitCommon/JitCache.h | 4 +- Source/Core/Core/PowerPC/JitILCommon/IR.cpp | 32 ++--- Source/Core/Core/PowerPC/JitILCommon/IR.h | 20 +-- .../PowerPC/JitILCommon/JitILBase_Branch.cpp | 2 +- .../PowerPC/JitILCommon/JitILBase_Integer.cpp | 2 +- .../JitILCommon/JitILBase_LoadStore.cpp | 2 +- Source/Core/Core/PowerPC/JitInterface.cpp | 8 +- Source/Core/Core/PowerPC/PPCSymbolDB.cpp | 12 +- Source/Core/Core/PowerPC/PPCTables.cpp | 12 +- Source/Core/Core/PowerPC/PowerPC.cpp | 2 +- Source/Core/Core/State.cpp | 8 +- Source/Core/Core/VolumeHandler.cpp | 18 +-- Source/Core/Core/ec_wii.cpp | 12 +- Source/Core/Core/x64MemTools.cpp | 6 +- Source/Core/DiscIO/BannerLoader.cpp | 2 +- Source/Core/DiscIO/BannerLoaderGC.cpp | 4 +- Source/Core/DiscIO/BannerLoaderWii.cpp | 6 +- Source/Core/DiscIO/Blob.cpp | 2 +- Source/Core/DiscIO/Blob.h | 4 +- Source/Core/DiscIO/CISOBlob.cpp | 2 +- Source/Core/DiscIO/CompressedBlob.cpp | 2 +- Source/Core/DiscIO/DiscScrubber.cpp | 8 +- Source/Core/DiscIO/DriveBlob.cpp | 18 +-- Source/Core/DiscIO/DriveBlob.h | 2 +- Source/Core/DiscIO/FileBlob.cpp | 2 +- Source/Core/DiscIO/FileHandlerARC.cpp | 24 ++-- Source/Core/DiscIO/FileMonitor.cpp | 22 ++-- Source/Core/DiscIO/FileSystemGCWii.cpp | 14 +-- Source/Core/DiscIO/Filesystem.cpp | 4 +- Source/Core/DiscIO/NANDContentLoader.cpp | 12 +- Source/Core/DiscIO/VolumeCreator.cpp | 18 +-- Source/Core/DiscIO/VolumeDirectory.cpp | 18 +-- Source/Core/DiscIO/VolumeGC.cpp | 14 +-- Source/Core/DiscIO/VolumeWad.cpp | 2 +- Source/Core/DiscIO/VolumeWiiCrypted.cpp | 20 +-- Source/Core/DiscIO/WbfsBlob.cpp | 4 +- Source/Core/DiscIO/WiiWad.cpp | 8 +- Source/Core/DolphinWX/ARCodeAddEdit.cpp | 4 +- Source/Core/DolphinWX/CheatsWindow.cpp | 10 +- Source/Core/DolphinWX/ConfigMain.cpp | 2 +- Source/Core/DolphinWX/Debugger/CodeView.cpp | 4 +- Source/Core/DolphinWX/Debugger/CodeWindow.cpp | 20 +-- .../Debugger/CodeWindowFunctions.cpp | 20 +-- .../DolphinWX/Debugger/DSPDebugWindow.cpp | 10 +- .../Core/DolphinWX/Debugger/DebuggerPanel.cpp | 6 +- Source/Core/DolphinWX/Debugger/MemoryView.cpp | 4 +- .../Core/DolphinWX/Debugger/MemoryWindow.cpp | 10 +- .../DolphinWX/Debugger/RegisterWindow.cpp | 4 +- Source/Core/DolphinWX/FifoPlayerDlg.cpp | 8 +- Source/Core/DolphinWX/Frame.cpp | 26 ++-- Source/Core/DolphinWX/Frame.h | 4 +- Source/Core/DolphinWX/FrameAui.cpp | 8 +- Source/Core/DolphinWX/FrameTools.cpp | 16 +-- Source/Core/DolphinWX/GLInterface/EGL.cpp | 8 +- Source/Core/DolphinWX/GLInterface/GLX.cpp | 18 +-- .../DolphinWX/GLInterface/InterfaceBase.h | 2 +- .../Core/DolphinWX/GLInterface/Platform.cpp | 4 +- Source/Core/DolphinWX/GLInterface/WGL.cpp | 22 ++-- .../DolphinWX/GLInterface/Wayland_Util.cpp | 32 ++--- .../Core/DolphinWX/GLInterface/X11_Util.cpp | 8 +- Source/Core/DolphinWX/GameListCtrl.cpp | 22 ++-- Source/Core/DolphinWX/Globals.h | 2 +- Source/Core/DolphinWX/HotkeyDlg.cpp | 6 +- Source/Core/DolphinWX/ISOFile.cpp | 10 +- Source/Core/DolphinWX/ISOProperties.cpp | 24 ++-- Source/Core/DolphinWX/InputConfigDiag.cpp | 10 +- Source/Core/DolphinWX/InputConfigDiag.h | 2 +- Source/Core/DolphinWX/LogConfigWindow.cpp | 2 +- Source/Core/DolphinWX/LogWindow.cpp | 2 +- Source/Core/DolphinWX/Main.cpp | 16 +-- Source/Core/DolphinWX/MainAndroid.cpp | 36 +++--- Source/Core/DolphinWX/MainNoGUI.cpp | 14 +-- Source/Core/DolphinWX/MemcardManager.cpp | 14 +-- Source/Core/DolphinWX/NetWindow.cpp | 18 +-- Source/Core/DolphinWX/TASInputDlg.cpp | 2 +- Source/Core/DolphinWX/VideoConfigDiag.cpp | 4 +- Source/Core/DolphinWX/VideoConfigDiag.h | 4 +- Source/Core/DolphinWX/X11Utils.cpp | 12 +- .../ControllerInterface.cpp | 10 +- .../ControllerInterface/ControllerInterface.h | 4 +- .../ControllerInterface/DInput/DInput.cpp | 2 +- .../DInput/DInputJoystick.cpp | 46 +++---- .../DInput/DInputKeyboardMouse.cpp | 12 +- .../ControllerInterface/Device.cpp | 8 +- .../InputCommon/ControllerInterface/Device.h | 4 +- .../ControllerInterface/ExpressionParser.cpp | 6 +- .../ControllerInterface/ExpressionParser.h | 2 +- .../ForceFeedback/ForceFeedbackDevice.cpp | 4 +- .../ForceFeedback/ForceFeedbackDevice.h | 2 +- .../ForceFeedback/OSX/DirectInputAdapter.h | 4 +- .../ControllerInterface/OSX/OSX.mm | 12 +- .../ControllerInterface/OSX/OSXJoystick.mm | 4 +- .../ControllerInterface/OSX/OSXKeyboard.mm | 6 +- .../ControllerInterface/Xlib/XInput2.cpp | 6 +- .../ControllerInterface/Xlib/Xlib.cpp | 4 +- Source/Core/InputCommon/UDPWiimote.cpp | 8 +- Source/Core/InputCommon/UDPWrapper.cpp | 6 +- Source/Core/VideoBackends/D3D/D3DBase.cpp | 74 ++++++------ Source/Core/VideoBackends/D3D/D3DBase.h | 6 +- Source/Core/VideoBackends/D3D/D3DBlob.cpp | 2 +- Source/Core/VideoBackends/D3D/D3DBlob.h | 2 +- Source/Core/VideoBackends/D3D/D3DShader.cpp | 48 ++++---- Source/Core/VideoBackends/D3D/D3DShader.h | 8 +- Source/Core/VideoBackends/D3D/D3DTexture.cpp | 8 +- Source/Core/VideoBackends/D3D/D3DUtil.cpp | 64 +++++----- .../VideoBackends/D3D/FramebufferManager.cpp | 28 ++--- Source/Core/VideoBackends/D3D/GfxState.cpp | 6 +- .../VideoBackends/D3D/LineGeometryShader.cpp | 10 +- .../VideoBackends/D3D/NativeVertexFormat.cpp | 2 +- .../VideoBackends/D3D/PSTextureEncoder.cpp | 80 ++++++------ .../VideoBackends/D3D/PixelShaderCache.cpp | 42 +++---- .../Core/VideoBackends/D3D/PixelShaderCache.h | 2 +- .../VideoBackends/D3D/PointGeometryShader.cpp | 10 +- Source/Core/VideoBackends/D3D/Render.cpp | 36 +++--- Source/Core/VideoBackends/D3D/Television.cpp | 4 +- .../Core/VideoBackends/D3D/TextureCache.cpp | 14 +-- .../Core/VideoBackends/D3D/VertexManager.cpp | 12 +- .../VideoBackends/D3D/VertexShaderCache.cpp | 30 ++--- .../VideoBackends/D3D/VertexShaderCache.h | 2 +- Source/Core/VideoBackends/D3D/XFBEncoder.cpp | 34 +++--- Source/Core/VideoBackends/D3D/main.cpp | 6 +- .../VideoBackends/OGL/FramebufferManager.cpp | 12 +- .../OGL/GLExtensions/GLExtensions.cpp | 14 +-- Source/Core/VideoBackends/OGL/GLUtil.cpp | 4 +- .../VideoBackends/OGL/NativeVertexFormat.cpp | 4 +- .../Core/VideoBackends/OGL/PostProcessing.cpp | 4 +- .../VideoBackends/OGL/ProgramShaderCache.cpp | 10 +- Source/Core/VideoBackends/OGL/RasterFont.cpp | 4 +- Source/Core/VideoBackends/OGL/Render.cpp | 20 +-- .../Core/VideoBackends/OGL/StreamBuffer.cpp | 12 +- .../Core/VideoBackends/OGL/TextureCache.cpp | 2 +- .../VideoBackends/OGL/TextureConverter.cpp | 6 +- .../Core/VideoBackends/OGL/VertexManager.cpp | 6 +- Source/Core/VideoBackends/OGL/main.cpp | 10 +- .../VideoBackends/Software/BPMemLoader.cpp | 2 +- .../Core/VideoBackends/Software/DebugUtil.cpp | 2 +- .../VideoBackends/Software/OpcodeDecoder.cpp | 2 +- .../Software/SWCommandProcessor.cpp | 2 +- .../VideoBackends/Software/SWRenderer.cpp | 4 +- .../VideoBackends/Software/SWVertexLoader.cpp | 10 +- Source/Core/VideoBackends/Software/SWmain.cpp | 2 +- .../VideoBackends/Software/TextureSampler.cpp | 2 +- Source/Core/VideoCommon/AVIDump.cpp | 46 +++---- Source/Core/VideoCommon/BPStructs.cpp | 2 +- Source/Core/VideoCommon/Debugger.cpp | 12 +- Source/Core/VideoCommon/EmuWindow.cpp | 18 +-- Source/Core/VideoCommon/Fifo.cpp | 2 +- .../VideoCommon/FramebufferManagerBase.cpp | 8 +- .../Core/VideoCommon/FramebufferManagerBase.h | 2 +- Source/Core/VideoCommon/HiresTextures.cpp | 4 +- Source/Core/VideoCommon/ImageWrite.cpp | 16 +-- Source/Core/VideoCommon/IndexGenerator.cpp | 2 +- Source/Core/VideoCommon/OpcodeDecoding.cpp | 4 +- Source/Core/VideoCommon/PerfQueryBase.cpp | 2 +- Source/Core/VideoCommon/PixelShaderGen.cpp | 8 +- Source/Core/VideoCommon/RenderBase.cpp | 2 +- Source/Core/VideoCommon/ShaderGenCommon.h | 8 +- Source/Core/VideoCommon/TextureCacheBase.cpp | 20 +-- .../VideoCommon/TextureConversionShader.cpp | 2 +- Source/Core/VideoCommon/VertexLoader.cpp | 8 +- .../Core/VideoCommon/VertexLoaderManager.cpp | 2 +- .../VideoCommon/VertexLoader_Position.cpp | 10 +- .../VideoCommon/VertexLoader_TextCoord.cpp | 10 +- Source/Core/VideoCommon/VertexShaderGen.cpp | 6 +- Source/Core/VideoCommon/VideoBackendBase.cpp | 8 +- Source/DSPSpy/main_spy.cpp | 4 +- Source/DSPSpy/real_dsp.cpp | 2 +- docs/DSP/DSP_InterC/DSP_InterC/DSP_InterC.cpp | 2 +- 292 files changed, 1526 insertions(+), 1526 deletions(-) diff --git a/Source/Core/AudioCommon/AOSoundStream.cpp b/Source/Core/AudioCommon/AOSoundStream.cpp index 4925d3aa52..20ec4261c2 100644 --- a/Source/Core/AudioCommon/AOSoundStream.cpp +++ b/Source/Core/AudioCommon/AOSoundStream.cpp @@ -22,7 +22,7 @@ void AOSound::SoundLoop() format.rate = m_mixer->GetSampleRate(); format.byte_format = AO_FMT_LITTLE; - device = ao_open_live(default_driver, &format, NULL /* no options */); + device = ao_open_live(default_driver, &format, nullptr /* no options */); if (!device) { PanicAlertT("AudioCommon: Error opening AO device.\n"); @@ -73,7 +73,7 @@ void AOSound::Stop() ao_shutdown(); - device = NULL; + device = nullptr; } } diff --git a/Source/Core/AudioCommon/AlsaSoundStream.cpp b/Source/Core/AudioCommon/AlsaSoundStream.cpp index a88fae0b65..ba4855400f 100644 --- a/Source/Core/AudioCommon/AlsaSoundStream.cpp +++ b/Source/Core/AudioCommon/AlsaSoundStream.cpp @@ -12,7 +12,7 @@ #define BUFFER_SIZE_MAX 8192 #define BUFFER_SIZE_BYTES (BUFFER_SIZE_MAX*2*2) -AlsaSound::AlsaSound(CMixer *mixer) : SoundStream(mixer), thread_data(0), handle(NULL), frames_to_deliver(FRAME_COUNT_MIN) +AlsaSound::AlsaSound(CMixer *mixer) : SoundStream(mixer), thread_data(0), handle(nullptr), frames_to_deliver(FRAME_COUNT_MIN) { mix_buffer = new u8[BUFFER_SIZE_BYTES]; } @@ -204,11 +204,11 @@ bool AlsaSound::AlsaInit() void AlsaSound::AlsaShutdown() { - if (handle != NULL) + if (handle != nullptr) { snd_pcm_drop(handle); snd_pcm_close(handle); - handle = NULL; + handle = nullptr; } } diff --git a/Source/Core/AudioCommon/CoreAudioSoundStream.cpp b/Source/Core/AudioCommon/CoreAudioSoundStream.cpp index a46edbb660..e311adc230 100644 --- a/Source/Core/AudioCommon/CoreAudioSoundStream.cpp +++ b/Source/Core/AudioCommon/CoreAudioSoundStream.cpp @@ -40,8 +40,8 @@ bool CoreAudioSound::Start() desc.componentFlags = 0; desc.componentFlagsMask = 0; desc.componentManufacturer = kAudioUnitManufacturer_Apple; - component = FindNextComponent(NULL, &desc); - if (component == NULL) { + component = FindNextComponent(nullptr, &desc); + if (component == nullptr) { ERROR_LOG(AUDIO, "error finding audio component"); return false; } diff --git a/Source/Core/AudioCommon/DPL2Decoder.cpp b/Source/Core/AudioCommon/DPL2Decoder.cpp index 418239fae4..29a5f73d14 100644 --- a/Source/Core/AudioCommon/DPL2Decoder.cpp +++ b/Source/Core/AudioCommon/DPL2Decoder.cpp @@ -123,7 +123,7 @@ float* design_fir(unsigned int *n, float* fc, float opt) float fc1; // Cutoff frequencies // Sanity check - if(*n==0) return NULL; + if(*n==0) return nullptr; MathUtil::Clamp(&fc[0],float(0.001),float(1)); float *w=(float*)calloc(sizeof(float),*n); @@ -188,7 +188,7 @@ void done(void) { free(filter_coefs_lfe); } - filter_coefs_lfe = NULL; + filter_coefs_lfe = nullptr; } float* calc_coefficients_125Hz_lowpass(int rate) @@ -378,5 +378,5 @@ void dpl2reset() { olddelay = -1; oldfreq = 0; - filter_coefs_lfe = NULL; + filter_coefs_lfe = nullptr; } diff --git a/Source/Core/AudioCommon/DSoundStream.cpp b/Source/Core/AudioCommon/DSoundStream.cpp index 76eb404665..742019a1b4 100644 --- a/Source/Core/AudioCommon/DSoundStream.cpp +++ b/Source/Core/AudioCommon/DSoundStream.cpp @@ -32,7 +32,7 @@ bool DSound::CreateBuffer() dsbdesc.lpwfxFormat = (WAVEFORMATEX *)&pcmwf; dsbdesc.guid3DAlgorithm = DS3DALG_DEFAULT; - HRESULT res = ds->CreateSoundBuffer(&dsbdesc, &dsBuffer, NULL); + HRESULT res = ds->CreateSoundBuffer(&dsbdesc, &dsBuffer, nullptr); if (SUCCEEDED(res)) { dsBuffer->SetCurrentPosition(0); @@ -43,7 +43,7 @@ bool DSound::CreateBuffer() { // Failed. PanicAlertT("Sound buffer creation failed: %08x", res); - dsBuffer = NULL; + dsBuffer = nullptr; return false; } } @@ -130,7 +130,7 @@ void DSound::SetVolume(int volume) // This is in "dBA attenuation" from 0 to -10000, logarithmic m_volume = (int)floor(log10((float)volume) * 5000.0f) - 10000; - if (dsBuffer != NULL) + if (dsBuffer != nullptr) dsBuffer->SetVolume(m_volume); } @@ -143,7 +143,7 @@ void DSound::Clear(bool mute) { m_muted = mute; - if (dsBuffer != NULL) + if (dsBuffer != nullptr) { if (m_muted) { diff --git a/Source/Core/AudioCommon/OpenALStream.cpp b/Source/Core/AudioCommon/OpenALStream.cpp index 99aebc6d05..38e57beca2 100644 --- a/Source/Core/AudioCommon/OpenALStream.cpp +++ b/Source/Core/AudioCommon/OpenALStream.cpp @@ -27,7 +27,7 @@ bool OpenALStream::Start() ALCdevice *pDevice = alcOpenDevice(defDevName); if (pDevice) { - ALCcontext *pContext = alcCreateContext(pDevice, NULL); + ALCcontext *pContext = alcCreateContext(pDevice, nullptr); if (pContext) { // Used to determine an appropriate period size (2x period = total buffer size) @@ -83,7 +83,7 @@ void OpenALStream::Stop() ALCcontext *pContext = alcGetCurrentContext(); ALCdevice *pDevice = alcGetContextsDevice(pContext); - alcMakeContextCurrent(NULL); + alcMakeContextCurrent(nullptr); alcDestroyContext(pContext); alcCloseDevice(pDevice); } diff --git a/Source/Core/AudioCommon/OpenALStream.h b/Source/Core/AudioCommon/OpenALStream.h index 5137ce3e43..fa394d70c0 100644 --- a/Source/Core/AudioCommon/OpenALStream.h +++ b/Source/Core/AudioCommon/OpenALStream.h @@ -44,7 +44,7 @@ class OpenALStream: public SoundStream { #if defined HAVE_OPENAL && HAVE_OPENAL public: - OpenALStream(CMixer *mixer, void *hWnd = NULL) + OpenALStream(CMixer *mixer, void *hWnd = nullptr) : SoundStream(mixer) , uiSource(0) {} diff --git a/Source/Core/AudioCommon/OpenSLESStream.cpp b/Source/Core/AudioCommon/OpenSLESStream.cpp index 847fcdffaa..a3fefebb4c 100644 --- a/Source/Core/AudioCommon/OpenSLESStream.cpp +++ b/Source/Core/AudioCommon/OpenSLESStream.cpp @@ -17,7 +17,7 @@ static SLEngineItf engineEngine; static SLObjectItf outputMixObject; // buffer queue player interfaces -static SLObjectItf bqPlayerObject = NULL; +static SLObjectItf bqPlayerObject = nullptr; static SLPlayItf bqPlayerPlay; static SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue; static SLMuteSoloItf bqPlayerMuteSolo; @@ -32,7 +32,7 @@ static int curBuffer = 0; static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context) { assert(bq == bqPlayerBufferQueue); - assert(NULL == context); + assert(nullptr == context); short *nextBuffer = buffer[curBuffer]; int nextSize = sizeof(buffer[0]); @@ -53,7 +53,7 @@ bool OpenSLESStream::Start() { SLresult result; // create engine - result = slCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL); + result = slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr); assert(SL_RESULT_SUCCESS == result); result = (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); assert(SL_RESULT_SUCCESS == result); @@ -79,7 +79,7 @@ bool OpenSLESStream::Start() // configure audio sink SLDataLocator_OutputMix loc_outmix = {SL_DATALOCATOR_OUTPUTMIX, outputMixObject}; - SLDataSink audioSnk = {&loc_outmix, NULL}; + SLDataSink audioSnk = {&loc_outmix, nullptr}; // create audio player const SLInterfaceID ids[2] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME}; @@ -94,7 +94,7 @@ bool OpenSLESStream::Start() result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_BUFFERQUEUE, &bqPlayerBufferQueue); assert(SL_RESULT_SUCCESS == result); - result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, NULL); + result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, nullptr); assert(SL_RESULT_SUCCESS == result); result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING); assert(SL_RESULT_SUCCESS == result); @@ -113,22 +113,22 @@ bool OpenSLESStream::Start() void OpenSLESStream::Stop() { - if (bqPlayerObject != NULL) { + if (bqPlayerObject != nullptr) { (*bqPlayerObject)->Destroy(bqPlayerObject); - bqPlayerObject = NULL; - bqPlayerPlay = NULL; - bqPlayerBufferQueue = NULL; - bqPlayerMuteSolo = NULL; - bqPlayerVolume = NULL; + bqPlayerObject = nullptr; + bqPlayerPlay = nullptr; + bqPlayerBufferQueue = nullptr; + bqPlayerMuteSolo = nullptr; + bqPlayerVolume = nullptr; } - if (outputMixObject != NULL) { + if (outputMixObject != nullptr) { (*outputMixObject)->Destroy(outputMixObject); - outputMixObject = NULL; + outputMixObject = nullptr; } - if (engineObject != NULL) { + if (engineObject != nullptr) { (*engineObject)->Destroy(engineObject); - engineObject = NULL; - engineEngine = NULL; + engineObject = nullptr; + engineEngine = nullptr; } } #endif diff --git a/Source/Core/AudioCommon/OpenSLESStream.h b/Source/Core/AudioCommon/OpenSLESStream.h index dcc94cd43b..ee81b30ff6 100644 --- a/Source/Core/AudioCommon/OpenSLESStream.h +++ b/Source/Core/AudioCommon/OpenSLESStream.h @@ -11,7 +11,7 @@ class OpenSLESStream : public SoundStream { #ifdef ANDROID public: - OpenSLESStream(CMixer *mixer, void *hWnd = NULL) + OpenSLESStream(CMixer *mixer, void *hWnd = nullptr) : SoundStream(mixer) {}; @@ -27,6 +27,6 @@ private: Common::Event soundSyncEvent; #else public: - OpenSLESStream(CMixer *mixer, void *hWnd = NULL): SoundStream(mixer) {} + OpenSLESStream(CMixer *mixer, void *hWnd = nullptr): SoundStream(mixer) {} #endif // HAVE_OPENSL }; diff --git a/Source/Core/AudioCommon/PulseAudioStream.cpp b/Source/Core/AudioCommon/PulseAudioStream.cpp index 647798c39f..bc5d0f3f5f 100644 --- a/Source/Core/AudioCommon/PulseAudioStream.cpp +++ b/Source/Core/AudioCommon/PulseAudioStream.cpp @@ -47,7 +47,7 @@ void PulseAudio::SoundLoop() if (PulseInit()) { while (m_run_thread.load() && m_pa_connected == 1 && m_pa_error >= 0) - m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, NULL); + m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, nullptr); if(m_pa_error < 0) ERROR_LOG(AUDIO, "PulseAudio error: %s", pa_strerror(m_pa_error)); @@ -66,12 +66,12 @@ bool PulseAudio::PulseInit() m_pa_ml = pa_mainloop_new(); m_pa_mlapi = pa_mainloop_get_api(m_pa_ml); m_pa_ctx = pa_context_new(m_pa_mlapi, "dolphin-emu"); - m_pa_error = pa_context_connect(m_pa_ctx, NULL, PA_CONTEXT_NOFLAGS, NULL); + m_pa_error = pa_context_connect(m_pa_ctx, nullptr, PA_CONTEXT_NOFLAGS, nullptr); pa_context_set_state_callback(m_pa_ctx, StateCallback, this); // wait until we're connected to the pulseaudio server while (m_pa_connected == 0 && m_pa_error >= 0) - m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, NULL); + m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, nullptr); if (m_pa_connected == 2 || m_pa_error < 0) { @@ -85,7 +85,7 @@ bool PulseAudio::PulseInit() ss.format = PA_SAMPLE_S16LE; ss.channels = 2; ss.rate = m_mixer->GetSampleRate(); - m_pa_s = pa_stream_new(m_pa_ctx, "Playback", &ss, NULL); + m_pa_s = pa_stream_new(m_pa_ctx, "Playback", &ss, nullptr); pa_stream_set_write_callback(m_pa_s, WriteCallback, this); pa_stream_set_underflow_callback(m_pa_s, UnderflowCallback, this); @@ -97,7 +97,7 @@ bool PulseAudio::PulseInit() m_pa_ba.prebuf = -1; // start as early as possible m_pa_ba.tlength = BUFFER_SIZE; // designed latency, only change this flag for low latency output pa_stream_flags flags = pa_stream_flags(PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_ADJUST_LATENCY | PA_STREAM_AUTO_TIMING_UPDATE); - m_pa_error = pa_stream_connect_playback(m_pa_s, NULL, &m_pa_ba, flags, NULL, NULL); + m_pa_error = pa_stream_connect_playback(m_pa_s, nullptr, &m_pa_ba, flags, nullptr, nullptr); if (m_pa_error < 0) { ERROR_LOG(AUDIO, "PulseAudio failed to initialize: %s", pa_strerror(m_pa_error)); @@ -135,7 +135,7 @@ void PulseAudio::StateCallback(pa_context* c) void PulseAudio::UnderflowCallback(pa_stream* s) { m_pa_ba.tlength += BUFFER_SIZE; - pa_stream_set_buffer_attr(s, &m_pa_ba, NULL, NULL); + pa_stream_set_buffer_attr(s, &m_pa_ba, nullptr, nullptr); WARN_LOG(AUDIO, "pulseaudio underflow, new latency: %d bytes", m_pa_ba.tlength); } @@ -150,7 +150,7 @@ void PulseAudio::WriteCallback(pa_stream* s, size_t length) return; // error will be printed from main loop m_mixer->Mix((s16*) buffer, length / sizeof(s16) / CHANNEL_COUNT); - m_pa_error = pa_stream_write(s, buffer, length, NULL, 0, PA_SEEK_RELATIVE); + m_pa_error = pa_stream_write(s, buffer, length, nullptr, 0, PA_SEEK_RELATIVE); } // Callbacks that forward to internal methods (required because PulseAudio is a C API). diff --git a/Source/Core/AudioCommon/WaveFile.cpp b/Source/Core/AudioCommon/WaveFile.cpp index 776d0d6fa4..facf59a79a 100644 --- a/Source/Core/AudioCommon/WaveFile.cpp +++ b/Source/Core/AudioCommon/WaveFile.cpp @@ -11,7 +11,7 @@ enum {BUF_SIZE = 32*1024}; WaveFileWriter::WaveFileWriter(): skip_silence(false), audio_size(0), - conv_buffer(NULL) + conv_buffer(nullptr) { } diff --git a/Source/Core/AudioCommon/XAudio2Stream.cpp b/Source/Core/AudioCommon/XAudio2Stream.cpp index 117484ca80..d5964f0e0e 100644 --- a/Source/Core/AudioCommon/XAudio2Stream.cpp +++ b/Source/Core/AudioCommon/XAudio2Stream.cpp @@ -158,7 +158,7 @@ XAudio2::XAudio2(CMixer *mixer) : SoundStream(mixer) , m_mastering_voice(nullptr) , m_volume(1.0f) - , m_cleanup_com(SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) + , m_cleanup_com(SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED))) { } diff --git a/Source/Core/AudioCommon/XAudio2_7Stream.cpp b/Source/Core/AudioCommon/XAudio2_7Stream.cpp index 3a98dc0e0a..ea2e43708d 100644 --- a/Source/Core/AudioCommon/XAudio2_7Stream.cpp +++ b/Source/Core/AudioCommon/XAudio2_7Stream.cpp @@ -159,7 +159,7 @@ XAudio2_7::XAudio2_7(CMixer *mixer) : SoundStream(mixer) , m_mastering_voice(nullptr) , m_volume(1.0f) - , m_cleanup_com(SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) + , m_cleanup_com(SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED))) { } diff --git a/Source/Core/AudioCommon/aldlist.cpp b/Source/Core/AudioCommon/aldlist.cpp index d7c7a287c4..6e506d57c2 100644 --- a/Source/Core/AudioCommon/aldlist.cpp +++ b/Source/Core/AudioCommon/aldlist.cpp @@ -50,13 +50,13 @@ ALDeviceList::ALDeviceList() defaultDeviceIndex = 0; // grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices - //if (LoadOAL10Library(NULL, &ALFunction) == TRUE) { - if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) + //if (LoadOAL10Library(nullptr, &ALFunction) == TRUE) { + if (alcIsExtensionPresent(nullptr, "ALC_ENUMERATION_EXT")) { - const char *devices = alcGetString(NULL, ALC_DEVICE_SPECIFIER); - const char *defaultDeviceName = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); - // go through device list (each device terminated with a single NULL, list terminated with double NULL) - for (s32 index = 0; devices != NULL && strlen(devices) > 0; index++, devices += strlen(devices) + 1) + const char *devices = alcGetString(nullptr, ALC_DEVICE_SPECIFIER); + const char *defaultDeviceName = alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER); + // go through device list (each device terminated with a single nullptr, list terminated with double nullptr) + for (s32 index = 0; devices != nullptr && strlen(devices) > 0; index++, devices += strlen(devices) + 1) { if (strcmp(defaultDeviceName, devices) == 0) { @@ -65,7 +65,7 @@ ALDeviceList::ALDeviceList() ALCdevice *device = alcOpenDevice(devices); if (device) { - ALCcontext *context = alcCreateContext(device, NULL); + ALCcontext *context = alcCreateContext(device, nullptr); if (context) { alcMakeContextCurrent(context); @@ -79,7 +79,7 @@ ALDeviceList::ALDeviceList() bNewName = false; } } - if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) + if ((bNewName) && (actualDeviceName != nullptr) && (strlen(actualDeviceName) > 0)) { ALDeviceInfo.bSelected = true; ALDeviceInfo.strDeviceName = actualDeviceName; @@ -120,7 +120,7 @@ ALDeviceList::ALDeviceList() vDeviceInfo.push_back(ALDeviceInfo); } - alcMakeContextCurrent(NULL); + alcMakeContextCurrent(nullptr); alcDestroyContext(context); } alcCloseDevice(device); @@ -163,7 +163,7 @@ char * ALDeviceList::GetDeviceName(s32 index) if (index < GetNumDevices()) return (char *)vDeviceInfo[index].strDeviceName.c_str(); else - return NULL; + return nullptr; } /* diff --git a/Source/Core/Common/ArmCPUDetect.cpp b/Source/Core/Common/ArmCPUDetect.cpp index 12998e1bde..80908b8992 100644 --- a/Source/Core/Common/ArmCPUDetect.cpp +++ b/Source/Core/Common/ArmCPUDetect.cpp @@ -14,7 +14,7 @@ const char procfile[] = "/proc/cpuinfo"; char *GetCPUString() { const char marker[] = "Hardware\t: "; - char *cpu_string = 0; + char *cpu_string = nullptr; // Count the number of processor lines in /proc/cpuinfo char buf[1024]; @@ -38,7 +38,7 @@ char *GetCPUString() unsigned char GetCPUImplementer() { const char marker[] = "CPU implementer\t: "; - char *implementer_string = 0; + char *implementer_string = nullptr; unsigned char implementer = 0; char buf[1024]; @@ -65,7 +65,7 @@ unsigned char GetCPUImplementer() unsigned short GetCPUPart() { const char marker[] = "CPU part\t: "; - char *part_string = 0; + char *part_string = nullptr; unsigned short part = 0; char buf[1024]; @@ -105,11 +105,11 @@ bool CheckCPUFeature(const char *feature) continue; char *featurestring = buf + sizeof(marker) - 1; char *token = strtok(featurestring, " "); - while (token != NULL) + while (token != nullptr) { if (strstr(token, feature)) return true; - token = strtok(NULL, " "); + token = strtok(nullptr, " "); } } diff --git a/Source/Core/Common/ArmEmitter.h b/Source/Core/Common/ArmEmitter.h index 405cacf991..841cc70176 100644 --- a/Source/Core/Common/ArmEmitter.h +++ b/Source/Core/Common/ArmEmitter.h @@ -710,7 +710,7 @@ protected: size_t region_size; public: - ARMXCodeBlock() : region(NULL), region_size(0) {} + ARMXCodeBlock() : region(nullptr), region_size(0) {} virtual ~ARMXCodeBlock() { if (region) FreeCodeSpace(); } // Call this before you generate any code. @@ -735,7 +735,7 @@ public: { #ifndef __SYMBIAN32__ FreeMemoryPages(region, region_size); - region = NULL; + region = nullptr; #endif region_size = 0; } diff --git a/Source/Core/Common/BreakPoints.cpp b/Source/Core/Common/BreakPoints.cpp index 4ee96a0a64..02924d639a 100644 --- a/Source/Core/Common/BreakPoints.cpp +++ b/Source/Core/Common/BreakPoints.cpp @@ -152,7 +152,7 @@ void MemChecks::AddFromStrings(const TMemChecksStr& mcstrs) void MemChecks::Add(const TMemCheck& _rMemoryCheck) { - if (GetMemCheck(_rMemoryCheck.StartAddress) == 0) + if (GetMemCheck(_rMemoryCheck.StartAddress) == nullptr) m_MemChecks.push_back(_rMemoryCheck); } @@ -184,7 +184,7 @@ TMemCheck *MemChecks::GetMemCheck(u32 address) } // none found - return 0; + return nullptr; } void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr, bool write, int size, u32 pc) diff --git a/Source/Core/Common/CDUtils.cpp b/Source/Core/Common/CDUtils.cpp index 9652b98f08..2f1c24f146 100644 --- a/Source/Core/Common/CDUtils.cpp +++ b/Source/Core/Common/CDUtils.cpp @@ -41,7 +41,7 @@ std::vector cdio_get_devices() { std::vector drives; - const DWORD buffsize = GetLogicalDriveStrings(0, NULL); + const DWORD buffsize = GetLogicalDriveStrings(0, nullptr); std::vector buff(buffsize); if (GetLogicalDriveStrings(buffsize, buff.data()) == buffsize - 1) { @@ -77,7 +77,7 @@ std::vector cdio_get_devices() return( drives ); classes_to_match = IOServiceMatching( kIOCDMediaClass ); - if( classes_to_match == NULL ) + if( classes_to_match == nullptr ) return( drives ); CFDictionarySetValue( classes_to_match, @@ -101,7 +101,7 @@ std::vector cdio_get_devices() IORegistryEntryCreateCFProperty( next_media, CFSTR( kIOBSDNameKey ), kCFAllocatorDefault, 0 ); - if( str_bsd_path == NULL ) + if( str_bsd_path == nullptr ) { IOObjectRelease( next_media ); continue; @@ -118,7 +118,7 @@ std::vector cdio_get_devices() sizeof(psz_buf) - dev_path_length, kCFStringEncodingASCII)) { - if(psz_buf != NULL) + if(psz_buf != nullptr) { std::string str = psz_buf; drives.push_back(str); @@ -151,7 +151,7 @@ static struct { "/dev/acd%d", 0, 27 }, { "/dev/cd%d", 0, 27 }, #endif - { NULL, 0, 0 } + { nullptr, 0, 0 } }; // Returns true if a device is a block or char device and not a symbolic link @@ -196,7 +196,7 @@ std::vector cdio_get_devices () for (unsigned int j = checklist[i].num_min; j <= checklist[i].num_max; ++j) { std::string drive = StringFromFormat(checklist[i].format, j); - if (is_cdrom(drive, NULL)) + if (is_cdrom(drive, nullptr)) { drives.push_back(std::move(drive)); } diff --git a/Source/Core/Common/ChunkFile.h b/Source/Core/Common/ChunkFile.h index bc9da61b4d..e19d97793b 100644 --- a/Source/Core/Common/ChunkFile.h +++ b/Source/Core/Common/ChunkFile.h @@ -206,7 +206,7 @@ public: void DoLinkedList(LinkedListItem*& list_start, LinkedListItem** list_end=0) { LinkedListItem* list_cur = list_start; - LinkedListItem* prev = 0; + LinkedListItem* prev = nullptr; while (true) { @@ -220,7 +220,7 @@ public: { if (mode == MODE_READ) { - cur->next = 0; + cur->next = nullptr; list_cur = cur; if (prev) prev->next = cur; @@ -239,13 +239,13 @@ public: if (mode == MODE_READ) { if (prev) - prev->next = 0; + prev->next = nullptr; if (list_end) *list_end = prev; if (list_cur) { if (list_start == list_cur) - list_start = 0; + list_start = nullptr; do { LinkedListItem* next = list_cur->next; @@ -393,7 +393,7 @@ public: } // Get data - u8 *ptr = 0; + u8 *ptr = nullptr; PointerWrap p(&ptr, PointerWrap::MODE_MEASURE); _class.DoState(p); size_t const sz = (size_t)ptr; diff --git a/Source/Core/Common/CommonFuncs.h b/Source/Core/Common/CommonFuncs.h index f46cc47572..11f460ed96 100644 --- a/Source/Core/Common/CommonFuncs.h +++ b/Source/Core/Common/CommonFuncs.h @@ -127,7 +127,7 @@ inline u64 _rotr64(u64 x, unsigned int shift){ // Restore the global locale _configthreadlocale(_DISABLE_PER_THREAD_LOCALE); } - else if(new_locale != NULL) + else if(new_locale != nullptr) { // Configure the thread to set the locale only for this thread _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); diff --git a/Source/Core/Common/ConsoleListener.cpp b/Source/Core/Common/ConsoleListener.cpp index 5c4fbfd940..928c052756 100644 --- a/Source/Core/Common/ConsoleListener.cpp +++ b/Source/Core/Common/ConsoleListener.cpp @@ -18,7 +18,7 @@ ConsoleListener::ConsoleListener() { #ifdef _WIN32 - hConsole = NULL; + hConsole = nullptr; bUseColor = true; #else bUseColor = isatty(fileno(stdout)); @@ -68,19 +68,19 @@ void ConsoleListener::UpdateHandle() void ConsoleListener::Close() { #ifdef _WIN32 - if (hConsole == NULL) + if (hConsole == nullptr) return; FreeConsole(); - hConsole = NULL; + hConsole = nullptr; #else - fflush(NULL); + fflush(nullptr); #endif } bool ConsoleListener::IsOpen() { #ifdef _WIN32 - return (hConsole != NULL); + return (hConsole != nullptr); #else return true; #endif @@ -280,11 +280,11 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text) { // First 10 chars white SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY); - WriteConsole(hConsole, Text, 10, &cCharsWritten, NULL); + WriteConsole(hConsole, Text, 10, &cCharsWritten, nullptr); Text += 10; } SetConsoleTextAttribute(hConsole, Color); - WriteConsole(hConsole, Text, (DWORD)strlen(Text), &cCharsWritten, NULL); + WriteConsole(hConsole, Text, (DWORD)strlen(Text), &cCharsWritten, nullptr); #else char ColorAttr[16] = ""; char ResetAttr[16] = ""; diff --git a/Source/Core/Common/Crypto/ec.cpp b/Source/Core/Common/Crypto/ec.cpp index acbbac1a8c..3a7968ba7d 100644 --- a/Source/Core/Common/Crypto/ec.cpp +++ b/Source/Core/Common/Crypto/ec.cpp @@ -316,7 +316,7 @@ void point_mul(u8 *d, const u8 *a, const u8 *b) // a is bignum static void silly_random(u8 * rndArea, u8 count) { u16 i; - srand((unsigned) (time(NULL))); + srand((unsigned) (time(nullptr))); for(i=0;inext); - // set the next element to NULL to stop the recursive deletion - tmpptr->next = NULL; + // set the next element to nullptr to stop the recursive deletion + tmpptr->next = nullptr; delete tmpptr; // this also deletes the element } @@ -81,7 +81,7 @@ public: ElementPtr *tmpptr = m_read_ptr; m_read_ptr = AtomicLoadAcquire(tmpptr->next); t = std::move(tmpptr->current); - tmpptr->next = NULL; + tmpptr->next = nullptr; delete tmpptr; return true; } @@ -100,7 +100,7 @@ private: class ElementPtr { public: - ElementPtr() : next(NULL) {} + ElementPtr() : next(nullptr) {} ~ElementPtr() { diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 9765af6267..7483ec693f 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -150,7 +150,7 @@ bool CreateDir(const std::string &path) { INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str()); #ifdef _WIN32 - if (::CreateDirectory(UTF8ToTStr(path).c_str(), NULL)) + if (::CreateDirectory(UTF8ToTStr(path).c_str(), nullptr)) return true; DWORD error = GetLastError(); if (error == ERROR_ALREADY_EXISTS) @@ -250,7 +250,7 @@ bool Rename(const std::string &srcFilename, const std::string &destFilename) auto df = UTF8ToTStr(destFilename); // The Internet seems torn about whether ReplaceFile is atomic or not. // Hopefully it's atomic enough... - if (ReplaceFile(df.c_str(), sf.c_str(), NULL, REPLACEFILE_IGNORE_MERGE_ERRORS, NULL, NULL)) + if (ReplaceFile(df.c_str(), sf.c_str(), nullptr, REPLACEFILE_IGNORE_MERGE_ERRORS, nullptr, nullptr)) return true; // Might have failed because the destination doesn't exist. if (GetLastError() == ERROR_FILE_NOT_FOUND) @@ -481,7 +481,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry) FSTEntry entry; const std::string virtualName(TStrToUTF8(ffd.cFileName)); #else - struct dirent dirent, *result = NULL; + struct dirent dirent, *result = nullptr; DIR *dirp = opendir(directory.c_str()); if (!dirp) @@ -549,7 +549,7 @@ bool DeleteDirRecursively(const std::string &directory) { const std::string virtualName(TStrToUTF8(ffd.cFileName)); #else - struct dirent dirent, *result = NULL; + struct dirent dirent, *result = nullptr; DIR *dirp = opendir(directory.c_str()); if (!dirp) return false; @@ -623,7 +623,7 @@ void CopyDir(const std::string &source_path, const std::string &dest_path) { const std::string virtualName(TStrToUTF8(ffd.cFileName)); #else - struct dirent dirent, *result = NULL; + struct dirent dirent, *result = nullptr; DIR *dirp = opendir(source_path.c_str()); if (!dirp) return; @@ -660,11 +660,11 @@ std::string GetCurrentDir() { char *dir; // Get the current working directory (getcwd uses malloc) - if (!(dir = __getcwd(NULL, 0))) { + if (!(dir = __getcwd(nullptr, 0))) { ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", GetLastErrorMsg()); - return NULL; + return nullptr; } std::string strDir = dir; free(dir); @@ -682,11 +682,11 @@ std::string GetTempFilenameForAtomicWrite(const std::string &path) std::string abs = path; #ifdef _WIN32 TCHAR absbuf[MAX_PATH]; - if (_tfullpath(absbuf, UTF8ToTStr(path).c_str(), MAX_PATH) != NULL) + if (_tfullpath(absbuf, UTF8ToTStr(path).c_str(), MAX_PATH) != nullptr) abs = TStrToUTF8(absbuf); #else char absbuf[PATH_MAX]; - if (realpath(path.c_str(), absbuf) != NULL) + if (realpath(path.c_str(), absbuf) != nullptr) abs = absbuf; #endif return abs + ".xxx"; @@ -715,7 +715,7 @@ std::string& GetExeDirectory() if (DolphinPath.empty()) { TCHAR Dolphin_exe_Path[2048]; - GetModuleFileName(NULL, Dolphin_exe_Path, 2048); + GetModuleFileName(nullptr, Dolphin_exe_Path, 2048); DolphinPath = TStrToUTF8(Dolphin_exe_Path); DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of('\\')); } @@ -767,14 +767,14 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new HKEY hkey; DWORD local = 0; TCHAR configPath[MAX_PATH] = {0}; - if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Dolphin Emulator"), NULL, KEY_QUERY_VALUE, &hkey) == ERROR_SUCCESS) + if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Dolphin Emulator"), 0, KEY_QUERY_VALUE, &hkey) == ERROR_SUCCESS) { DWORD size = 4; - if (RegQueryValueEx(hkey, TEXT("LocalUserConfig"), NULL, NULL, reinterpret_cast(&local), &size) != ERROR_SUCCESS) + if (RegQueryValueEx(hkey, TEXT("LocalUserConfig"), nullptr, nullptr, reinterpret_cast(&local), &size) != ERROR_SUCCESS) local = 0; size = MAX_PATH; - if (RegQueryValueEx(hkey, TEXT("UserConfigPath"), NULL, NULL, (LPBYTE)configPath, &size) != ERROR_SUCCESS) + if (RegQueryValueEx(hkey, TEXT("UserConfigPath"), nullptr, nullptr, (LPBYTE)configPath, &size) != ERROR_SUCCESS) configPath[0] = 0; RegCloseKey(hkey); } @@ -783,7 +783,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new // Get Program Files path in case we need it. TCHAR my_documents[MAX_PATH]; - bool my_documents_found = SUCCEEDED(SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, my_documents)); + bool my_documents_found = SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, my_documents)); if (local) // Case 1-2 paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP; @@ -960,7 +960,7 @@ bool ReadFileToString(const char *filename, std::string &str) } IOFile::IOFile() - : m_file(NULL), m_good(true) + : m_file(nullptr), m_good(true) {} IOFile::IOFile(std::FILE* file) @@ -968,7 +968,7 @@ IOFile::IOFile(std::FILE* file) {} IOFile::IOFile(const std::string& filename, const char openmode[]) - : m_file(NULL), m_good(true) + : m_file(nullptr), m_good(true) { Open(filename, openmode); } @@ -979,7 +979,7 @@ IOFile::~IOFile() } IOFile::IOFile(IOFile&& other) - : m_file(NULL), m_good(true) + : m_file(nullptr), m_good(true) { Swap(other); } @@ -1014,14 +1014,14 @@ bool IOFile::Close() if (!IsOpen() || 0 != std::fclose(m_file)) m_good = false; - m_file = NULL; + m_file = nullptr; return m_good; } std::FILE* IOFile::ReleaseHandle() { std::FILE* const ret = m_file; - m_file = NULL; + m_file = nullptr; return ret; } diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h index 06ee32f326..deac3814c0 100644 --- a/Source/Core/Common/FileUtil.h +++ b/Source/Core/Common/FileUtil.h @@ -167,7 +167,7 @@ public: bool Close(); template - bool ReadArray(T* data, size_t length, size_t* pReadBytes = NULL) + bool ReadArray(T* data, size_t length, size_t* pReadBytes = nullptr) { size_t read_bytes = 0; if (!IsOpen() || length != (read_bytes = std::fread(data, sizeof(T), length, m_file))) @@ -198,11 +198,11 @@ public: return WriteArray(reinterpret_cast(data), length); } - bool IsOpen() { return NULL != m_file; } + bool IsOpen() { return nullptr != m_file; } // m_good is set to false when a read, write or other function fails bool IsGood() { return m_good; } - operator void*() { return m_good ? m_file : NULL; } + operator void*() { return m_good ? m_file : nullptr; } std::FILE* ReleaseHandle(); diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp index 2cc1a97e60..604aefc89c 100644 --- a/Source/Core/Common/IniFile.cpp +++ b/Source/Core/Common/IniFile.cpp @@ -212,7 +212,7 @@ const IniFile::Section* IniFile::GetSection(const std::string& sectionName) cons for (const Section& sect : sections) if (!strcasecmp(sect.name.c_str(), sectionName.c_str())) return (&(sect)); - return 0; + return nullptr; } IniFile::Section* IniFile::GetSection(const std::string& sectionName) @@ -220,7 +220,7 @@ IniFile::Section* IniFile::GetSection(const std::string& sectionName) for (Section& sect : sections) if (!strcasecmp(sect.name.c_str(), sectionName.c_str())) return (&(sect)); - return 0; + return nullptr; } IniFile::Section* IniFile::GetOrCreateSection(const std::string& sectionName) @@ -335,7 +335,7 @@ bool IniFile::Load(const std::string& filename, bool keep_current_data) if (in.fail()) return false; - Section* current_section = NULL; + Section* current_section = nullptr; while (!in.eof()) { char templine[MAX_BYTES]; diff --git a/Source/Core/Common/LinearDiskCache.h b/Source/Core/Common/LinearDiskCache.h index ea7ee1bcd1..876124ac2d 100644 --- a/Source/Core/Common/LinearDiskCache.h +++ b/Source/Core/Common/LinearDiskCache.h @@ -70,7 +70,7 @@ public: // good header, read some key/value pairs K key; - V *value = NULL; + V *value = nullptr; u32 value_size; u32 entry_number; diff --git a/Source/Core/Common/LogManager.cpp b/Source/Core/Common/LogManager.cpp index f87bd0c3d9..0dfe90445e 100644 --- a/Source/Core/Common/LogManager.cpp +++ b/Source/Core/Common/LogManager.cpp @@ -30,7 +30,7 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, va_end(args); } -LogManager *LogManager::m_logManager = NULL; +LogManager *LogManager::m_logManager = nullptr; LogManager::LogManager() { @@ -145,7 +145,7 @@ void LogManager::Init() void LogManager::Shutdown() { delete m_logManager; - m_logManager = NULL; + m_logManager = nullptr; } LogContainer::LogContainer(const char* shortName, const char* fullName, bool enable) diff --git a/Source/Core/Common/MemArena.cpp b/Source/Core/Common/MemArena.cpp index ac55dc0371..3ec119a79c 100644 --- a/Source/Core/Common/MemArena.cpp +++ b/Source/Core/Common/MemArena.cpp @@ -52,7 +52,7 @@ int AshmemCreateFileMapping(const char *name, size_t size) void MemArena::GrabLowMemSpace(size_t size) { #ifdef _WIN32 - hMemoryMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, (DWORD)(size), NULL); + hMemoryMapping = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, (DWORD)(size), nullptr); #elif defined(ANDROID) fd = AshmemCreateFileMapping("Dolphin-emu", size); if (fd < 0) @@ -190,9 +190,9 @@ static bool Memory_TryBase(u8 *base, const MemoryView *views, int num_views, u32 for (int i = 0; i < num_views; i++) { if (views[i].out_ptr_low) - *views[i].out_ptr_low = 0; + *views[i].out_ptr_low = nullptr; if (views[i].out_ptr) - *views[i].out_ptr = 0; + *views[i].out_ptr = nullptr; } int i; @@ -255,13 +255,13 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena { PanicAlert("MemoryMap_Setup: Failed finding a memory base."); exit(0); - return 0; + return nullptr; } #else #ifdef _WIN32 // Try a whole range of possible bases. Return once we got a valid one. u32 max_base_addr = 0x7FFF0000 - 0x31000000; - u8 *base = NULL; + u8 *base = nullptr; for (u32 base_addr = 0x40000; base_addr < max_base_addr; base_addr += 0x40000) { @@ -304,7 +304,7 @@ void MemoryMap_Shutdown(const MemoryView *views, int num_views, u32 flags, MemAr { arena->ReleaseView(*outptr, view->size); freeset.insert(*outptr); - *outptr = NULL; + *outptr = nullptr; } } } diff --git a/Source/Core/Common/MemoryUtil.cpp b/Source/Core/Common/MemoryUtil.cpp index 441ba2f10b..e664752910 100644 --- a/Source/Core/Common/MemoryUtil.cpp +++ b/Source/Core/Common/MemoryUtil.cpp @@ -31,7 +31,7 @@ void* AllocateExecutableMemory(size_t size, bool low) #if defined(_WIN32) void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); #else - static char *map_hint = 0; + static char *map_hint = nullptr; #if defined(__x86_64__) && !defined(MAP_32BIT) // This OS has no flag to enforce allocation below the 4 GB boundary, // but if we hint that we want a low address it is very likely we will @@ -56,9 +56,9 @@ void* AllocateExecutableMemory(size_t size, bool low) #if defined(__FreeBSD__) if (ptr == MAP_FAILED) { - ptr = NULL; + ptr = nullptr; #else - if (ptr == NULL) + if (ptr == nullptr) { #endif PanicAlert("Failed to allocate executable memory"); @@ -88,14 +88,14 @@ void* AllocateMemoryPages(size_t size) #ifdef _WIN32 void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE); #else - void* ptr = mmap(0, size, PROT_READ | PROT_WRITE, + void* ptr = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); #endif // printf("Mapped memory at %p (size %ld)\n", ptr, // (unsigned long)size); - if (ptr == NULL) + if (ptr == nullptr) PanicAlert("Failed to allocate raw memory"); return ptr; @@ -106,7 +106,7 @@ void* AllocateAlignedMemory(size_t size,size_t alignment) #ifdef _WIN32 void* ptr = _aligned_malloc(size,alignment); #else - void* ptr = NULL; + void* ptr = nullptr; #ifdef ANDROID ptr = memalign(alignment, size); #else @@ -118,7 +118,7 @@ void* AllocateAlignedMemory(size_t size,size_t alignment) // printf("Mapped memory at %p (size %ld)\n", ptr, // (unsigned long)size); - if (ptr == NULL) + if (ptr == nullptr) PanicAlert("Failed to allocate aligned memory"); return ptr; @@ -185,7 +185,7 @@ std::string MemUsage() // Print information about the memory usage of the process. hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); - if (NULL == hProcess) return "MemUsage Error"; + if (nullptr == hProcess) return "MemUsage Error"; if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc))) Ret = StringFromFormat("%s K", ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str()); diff --git a/Source/Core/Common/Misc.cpp b/Source/Core/Common/Misc.cpp index fdc11146dd..05293aa358 100644 --- a/Source/Core/Common/Misc.cpp +++ b/Source/Core/Common/Misc.cpp @@ -21,9 +21,9 @@ const char* GetLastErrorMsg() #ifdef _WIN32 static __declspec(thread) char err_str[buff_size] = {}; - FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), + FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - err_str, buff_size, NULL); + err_str, buff_size, nullptr); #else static __thread char err_str[buff_size] = {}; diff --git a/Source/Core/Common/StdConditionVariable.h b/Source/Core/Common/StdConditionVariable.h index 05b753df73..f639acfdfd 100644 --- a/Source/Core/Common/StdConditionVariable.h +++ b/Source/Core/Common/StdConditionVariable.h @@ -72,9 +72,9 @@ public: #if defined(_WIN32) && defined(USE_CONDITION_VARIABLES) InitializeConditionVariable(&m_handle); #elif defined(_WIN32) - m_handle = CreateEvent(NULL, false, false, NULL); + m_handle = CreateEvent(nullptr, false, false, nullptr); #else - pthread_cond_init(&m_handle, NULL); + pthread_cond_init(&m_handle, nullptr); #endif } diff --git a/Source/Core/Common/StdMutex.h b/Source/Core/Common/StdMutex.h index 0559ee8fc9..94afc354f0 100644 --- a/Source/Core/Common/StdMutex.h +++ b/Source/Core/Common/StdMutex.h @@ -143,7 +143,7 @@ public: #ifdef _WIN32 InitializeSRWLock(&m_handle); #else - pthread_mutex_init(&m_handle, NULL); + pthread_mutex_init(&m_handle, nullptr); #endif } @@ -238,7 +238,7 @@ public: typedef Mutex mutex_type; unique_lock() - : pm(NULL), owns(false) + : pm(nullptr), owns(false) {} /*explicit*/ unique_lock(mutex_type& m) @@ -290,11 +290,11 @@ public: unique_lock(const unique_lock&) /*= delete*/; unique_lock(unique_lock&& other) - : pm(NULL), owns(false) + : pm(nullptr), owns(false) { #else unique_lock(const unique_lock& u) - : pm(NULL), owns(false) + : pm(nullptr), owns(false) { // ugly const_cast to get around lack of rvalue references unique_lock& other = const_cast(u); @@ -335,7 +335,7 @@ public: { auto const ret = mutex(); - pm = NULL; + pm = nullptr; owns = false; return ret; diff --git a/Source/Core/Common/StdThread.h b/Source/Core/Common/StdThread.h index 8b8357fd89..787f25a167 100644 --- a/Source/Core/Common/StdThread.h +++ b/Source/Core/Common/StdThread.h @@ -193,7 +193,7 @@ public: WaitForSingleObject(m_handle, INFINITE); detach(); #else - pthread_join(m_id.m_thread, NULL); + pthread_join(m_id.m_thread, nullptr); m_id = id(); #endif } @@ -238,9 +238,9 @@ private: void StartThread(F* param) { #ifdef USE_BEGINTHREADEX - m_handle = (HANDLE)_beginthreadex(NULL, 0, &RunAndDelete, param, 0, &m_id.m_thread); + m_handle = (HANDLE)_beginthreadex(nullptr, 0, &RunAndDelete, param, 0, &m_id.m_thread); #elif defined(_WIN32) - m_handle = CreateThread(NULL, 0, &RunAndDelete, param, 0, &m_id.m_thread); + m_handle = CreateThread(nullptr, 0, &RunAndDelete, param, 0, &m_id.m_thread); #else pthread_attr_t attr; pthread_attr_init(&attr); diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index 7f7ce5d794..1919083162 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -28,7 +28,7 @@ // faster than sscanf bool AsciiToHex(const char* _szValue, u32& result) { - char *endptr = NULL; + char *endptr = nullptr; const u32 value = strtoul(_szValue, &endptr, 16); if (!endptr || *endptr) @@ -66,7 +66,7 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar // will be present in the middle of a multibyte sequence. // // This is why we lookup an ANSI (cp1252) locale here and use _vsnprintf_l. - static locale_t c_locale = NULL; + static locale_t c_locale = nullptr; if (!c_locale) c_locale = _create_locale(LC_ALL, ".1252"); writtenCount = _vsnprintf_l(out, outsize, format, c_locale, args); @@ -89,7 +89,7 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar std::string StringFromFormat(const char* format, ...) { va_list args; - char *buf = NULL; + char *buf = nullptr; #ifdef _WIN32 int required = 0; @@ -159,7 +159,7 @@ std::string StripQuotes(const std::string& s) bool TryParse(const std::string &str, u32 *const output) { - char *endptr = NULL; + char *endptr = nullptr; // Reset errno to a value other than ERANGE errno = 0; diff --git a/Source/Core/Common/SymbolDB.cpp b/Source/Core/Common/SymbolDB.cpp index 44a0913d22..c78a61ea8b 100644 --- a/Source/Core/Common/SymbolDB.cpp +++ b/Source/Core/Common/SymbolDB.cpp @@ -46,7 +46,7 @@ Symbol *SymbolDB::GetSymbolFromName(const char *name) if (!strcmp(func.second.name.c_str(), name)) return &func.second; } - return 0; + return nullptr; } void SymbolDB::AddCompleteSymbol(const Symbol &symbol) diff --git a/Source/Core/Common/SymbolDB.h b/Source/Core/Common/SymbolDB.h index b30fd3218b..26d0d2c4be 100644 --- a/Source/Core/Common/SymbolDB.h +++ b/Source/Core/Common/SymbolDB.h @@ -79,8 +79,8 @@ protected: public: SymbolDB() {} virtual ~SymbolDB() {} - virtual Symbol *GetSymbolFromAddr(u32 addr) { return 0; } - virtual Symbol *AddFunction(u32 startAddr) { return 0;} + virtual Symbol *GetSymbolFromAddr(u32 addr) { return nullptr; } + virtual Symbol *AddFunction(u32 startAddr) { return nullptr;} void AddCompleteSymbol(const Symbol &symbol); @@ -90,7 +90,7 @@ public: if (iter != checksumToFunction.end()) return iter->second; else - return 0; + return nullptr; } const XFuncMap &Symbols() const {return functions;} diff --git a/Source/Core/Common/Timer.cpp b/Source/Core/Common/Timer.cpp index b1e52bb0d3..a8143c85f8 100644 --- a/Source/Core/Common/Timer.cpp +++ b/Source/Core/Common/Timer.cpp @@ -27,7 +27,7 @@ u32 Timer::GetTimeMs() return timeGetTime(); #else struct timeval t; - (void)gettimeofday(&t, NULL); + (void)gettimeofday(&t, nullptr); return ((u32)(t.tv_sec * 1000 + t.tv_usec / 1000)); #endif } @@ -184,7 +184,7 @@ std::string Timer::GetTimeFormatted() return StringFromFormat("%s:%03i", tmp, tp.millitm); #else struct timeval t; - (void)gettimeofday(&t, NULL); + (void)gettimeofday(&t, nullptr); return StringFromFormat("%s:%03d", tmp, (int)(t.tv_usec / 1000)); #endif } @@ -198,7 +198,7 @@ double Timer::GetDoubleTime() (void)::ftime(&tp); #else struct timeval t; - (void)gettimeofday(&t, NULL); + (void)gettimeofday(&t, nullptr); #endif // Get continuous timestamp u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970(); diff --git a/Source/Core/Common/x64Emitter.h b/Source/Core/Common/x64Emitter.h index b35fff3319..0af6b3b92a 100644 --- a/Source/Core/Common/x64Emitter.h +++ b/Source/Core/Common/x64Emitter.h @@ -265,7 +265,7 @@ protected: inline void Write64(u64 value) {*(u64*)code = (value); code += 8;} public: - XEmitter() { code = NULL; } + XEmitter() { code = nullptr; } XEmitter(u8 *code_ptr) { code = code_ptr; } virtual ~XEmitter() {} @@ -773,7 +773,7 @@ protected: size_t region_size; public: - XCodeBlock() : region(NULL), region_size(0) {} + XCodeBlock() : region(nullptr), region_size(0) {} virtual ~XCodeBlock() { if (region) FreeCodeSpace(); } // Call this before you generate any code. @@ -797,7 +797,7 @@ public: void FreeCodeSpace() { FreeMemoryPages(region, region_size); - region = NULL; + region = nullptr; region_size = 0; } diff --git a/Source/Core/Core/ActionReplay.cpp b/Source/Core/Core/ActionReplay.cpp index 9afe0f2027..8b3b36b13a 100644 --- a/Source/Core/Core/ActionReplay.cpp +++ b/Source/Core/Core/ActionReplay.cpp @@ -72,7 +72,7 @@ enum }; // pointer to the code currently being run, (used by log messages that include the code name) -static ARCode const* current_code = NULL; +static ARCode const* current_code = nullptr; static bool b_RanOnce = false; static std::vector arCodes; diff --git a/Source/Core/Core/ArmMemTools.cpp b/Source/Core/Core/ArmMemTools.cpp index 29a578e495..8f27160330 100644 --- a/Source/Core/Core/ArmMemTools.cpp +++ b/Source/Core/Core/ArmMemTools.cpp @@ -81,6 +81,6 @@ void InstallExceptionHandler() sa.sa_sigaction = &sigsegv_handler; sa.sa_flags = SA_SIGINFO; sigemptyset(&sa.sa_mask); - sigaction(SIGSEGV, &sa, NULL); + sigaction(SIGSEGV, &sa, nullptr); } } // namespace diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index 6c79bd2f21..7025a8c035 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -125,7 +125,7 @@ bool CBoot::FindMapFile(std::string* existing_map_file, bool CBoot::LoadMapFromFilename() { std::string strMapFilename; - bool found = FindMapFile(&strMapFilename, NULL); + bool found = FindMapFile(&strMapFilename, nullptr); if (found && g_symbolDB.LoadMap(strMapFilename.c_str())) { UpdateDebugger_MapLoaded(); @@ -201,7 +201,7 @@ bool CBoot::BootUp() case SCoreStartupParameter::BOOT_ISO: { DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_StartupPara.m_strFilename); - if (pVolume == NULL) + if (pVolume == nullptr) break; bool isoWii = DiscIO::IsVolumeWiiDisc(pVolume); diff --git a/Source/Core/Core/Boot/Boot.h b/Source/Core/Core/Boot/Boot.h index f580e8a98a..e2a1be41bf 100644 --- a/Source/Core/Core/Boot/Boot.h +++ b/Source/Core/Core/Boot/Boot.h @@ -30,10 +30,10 @@ public: // Tries to find a map file for the current game by looking first in the // local user directory, then in the shared user directory. // - // If existing_map_file is not NULL and a map file exists, it is set to the + // If existing_map_file is not nullptr and a map file exists, it is set to the // path to the existing map file. // - // If writable_map_file is not NULL, it is set to the path to where a map + // If writable_map_file is not nullptr, it is set to the path to where a map // file should be saved. // // Returns true if a map file exists, false if none could be found. @@ -43,7 +43,7 @@ public: private: static void RunFunction(u32 _iAddr); - static void UpdateDebugger_MapLoaded(const char* _gameID = NULL); + static void UpdateDebugger_MapLoaded(const char* _gameID = nullptr); static bool LoadMapFromFilename(); static bool Boot_ELF(const char *filename); diff --git a/Source/Core/Core/Boot/Boot_DOL.cpp b/Source/Core/Core/Boot/Boot_DOL.cpp index a641a9b947..009d122f35 100644 --- a/Source/Core/Core/Boot/Boot_DOL.cpp +++ b/Source/Core/Core/Boot/Boot_DOL.cpp @@ -34,13 +34,13 @@ CDolLoader::~CDolLoader() for (auto& sect : text_section) { delete [] sect; - sect = NULL; + sect = nullptr; } for (auto& sect : data_section) { delete [] sect; - sect = NULL; + sect = nullptr; } } @@ -54,9 +54,9 @@ void CDolLoader::Initialize(u8* _pBuffer, u32 _Size) p[i] = Common::swap32(p[i]); for (auto& sect : text_section) - sect = NULL; + sect = nullptr; for (auto& sect : data_section) - sect = NULL; + sect = nullptr; u32 HID4_pattern = 0x7c13fba6; u32 HID4_mask = 0xfc1fffff; diff --git a/Source/Core/Core/Boot/Boot_WiiWAD.cpp b/Source/Core/Core/Boot/Boot_WiiWAD.cpp index 68eb39691f..983084bfb1 100644 --- a/Source/Core/Core/Boot/Boot_WiiWAD.cpp +++ b/Source/Core/Core/Boot/Boot_WiiWAD.cpp @@ -90,7 +90,7 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename) // DOL const DiscIO::SNANDContent* pContent = ContentLoader.GetContentByIndex(ContentLoader.GetBootIndex()); - if (pContent == NULL) + if (pContent == nullptr) return false; WII_IPC_HLE_Interface::SetDefaultContentFile(_pFilename); @@ -119,7 +119,7 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename) // Load patches and run startup patches const DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_pFilename); - if (pVolume != NULL) + if (pVolume != nullptr) PatchEngine::LoadPatches(); return true; diff --git a/Source/Core/Core/Boot/ElfReader.cpp b/Source/Core/Core/Boot/ElfReader.cpp index 21fc4188ac..2621f84586 100644 --- a/Source/Core/Core/Boot/ElfReader.cpp +++ b/Source/Core/Core/Boot/ElfReader.cpp @@ -82,7 +82,7 @@ ElfReader::ElfReader(void *ptr) const char *ElfReader::GetSectionName(int section) const { if (sections[section].sh_type == SHT_NULL) - return NULL; + return nullptr; int nameOffset = sections[section].sh_name; char *ptr = (char*)GetSectionDataPtr(header->e_shstrndx); @@ -90,7 +90,7 @@ const char *ElfReader::GetSectionName(int section) const if (ptr) return ptr + nameOffset; else - return NULL; + return nullptr; } bool ElfReader::LoadInto(u32 vaddr) @@ -181,7 +181,7 @@ SectionID ElfReader::GetSectionByName(const char *name, int firstSection) const { const char *secname = GetSectionName(i); - if (secname != NULL && strcmp(name, secname) == 0) + if (secname != nullptr && strcmp(name, secname) == 0) return i; } return -1; diff --git a/Source/Core/Core/Boot/ElfReader.h b/Source/Core/Core/Boot/ElfReader.h index a789515af8..de1342d4cd 100644 --- a/Source/Core/Core/Boot/ElfReader.h +++ b/Source/Core/Core/Boot/ElfReader.h @@ -51,11 +51,11 @@ public: const u8 *GetSectionDataPtr(int section) const { if (section < 0 || section >= header->e_shnum) - return 0; + return nullptr; if (sections[section].sh_type != SHT_NOBITS) return GetPtr(sections[section].sh_offset); else - return 0; + return nullptr; } bool IsCodeSection(int section) const { diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index b7dd41b333..4932e0c0b2 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -125,7 +125,7 @@ void SConfig::Init() void SConfig::Shutdown() { delete m_Instance; - m_Instance = NULL; + m_Instance = nullptr; } SConfig::~SConfig() diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index 529951f624..4c1ceb3d4e 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -79,7 +79,7 @@ void EmuThread(); bool g_bStopping = false; bool g_bHwInit = false; bool g_bStarted = false; -void *g_pWindowHandle = NULL; +void *g_pWindowHandle = nullptr; std::string g_stateFileName; std::thread g_EmuThread; diff --git a/Source/Core/Core/CoreParameter.cpp b/Source/Core/Core/CoreParameter.cpp index 4cfec8c7c6..c18d7e1f47 100644 --- a/Source/Core/Core/CoreParameter.cpp +++ b/Source/Core/Core/CoreParameter.cpp @@ -21,7 +21,7 @@ #include "DiscIO/VolumeCreator.h" SCoreStartupParameter::SCoreStartupParameter() -: hInstance(0), +: hInstance(nullptr), bEnableDebugging(false), bAutomaticStart(false), bBootToPause(false), bJITNoBlockCache(false), bJITBlockLinking(true), bJITOff(false), @@ -125,7 +125,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) } std::string Extension; - SplitPath(m_strFilename, NULL, NULL, &Extension); + SplitPath(m_strFilename, nullptr, nullptr, &Extension); if (!strcasecmp(Extension.c_str(), ".gcm") || !strcasecmp(Extension.c_str(), ".iso") || !strcasecmp(Extension.c_str(), ".wbfs") || @@ -135,7 +135,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) { m_BootType = BOOT_ISO; DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(m_strFilename); - if (pVolume == NULL) + if (pVolume == nullptr) { if (bootDrive) PanicAlertT("Could not read \"%s\". " @@ -223,7 +223,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) const DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(m_strFilename); const DiscIO::INANDContentLoader& ContentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename); - if (ContentLoader.GetContentByIndex(ContentLoader.GetBootIndex()) == NULL) + if (ContentLoader.GetContentByIndex(ContentLoader.GetBootIndex()) == nullptr) { //WAD is valid yet cannot be booted. Install instead. u64 installed = DiscIO::CNANDContentManager::Access().Install_WiiWAD(m_strFilename); diff --git a/Source/Core/Core/CoreTiming.cpp b/Source/Core/Core/CoreTiming.cpp index 248ca85e15..0f1d5a514b 100644 --- a/Source/Core/Core/CoreTiming.cpp +++ b/Source/Core/Core/CoreTiming.cpp @@ -43,7 +43,7 @@ static std::mutex tsWriteLock; Common::FifoQueue tsQueue; // event pools -Event *eventPool = 0; +Event *eventPool = nullptr; int downcount, slicelength; int maxSliceLength = MAX_SLICE_LENGTH; @@ -59,7 +59,7 @@ u64 fakeTBStartTicks; int ev_lost; -void (*advanceCallback)(int cyclesExecuted) = NULL; +void (*advanceCallback)(int cyclesExecuted) = nullptr; Event* GetNewEvent() { @@ -236,7 +236,7 @@ void ClearPendingEvents() void AddEventToQueue(Event* ne) { - Event* prev = NULL; + Event* prev = nullptr; Event** pNext = &first; for(;;) { diff --git a/Source/Core/Core/DSP/DSPAssembler.cpp b/Source/Core/Core/DSP/DSPAssembler.cpp index 5778e02170..c5afe21674 100644 --- a/Source/Core/Core/DSP/DSPAssembler.cpp +++ b/Source/Core/Core/DSP/DSPAssembler.cpp @@ -79,7 +79,7 @@ static const char *err_string[] = }; DSPAssembler::DSPAssembler(const AssemblerSettings &settings) : - gdg_buffer(NULL), + gdg_buffer(nullptr), m_cur_addr(0), m_cur_pass(0), m_current_param(0), @@ -127,7 +127,7 @@ bool DSPAssembler::Assemble(const char *text, std::vector &code, std::vecto if(gdg_buffer) { free(gdg_buffer); - gdg_buffer = NULL; + gdg_buffer = nullptr; } last_error_str = "(no errors)"; @@ -310,7 +310,7 @@ char *DSPAssembler::FindBrackets(char *src, char *dst) } if (count) ShowError(ERR_NO_MATCHING_BRACKETS); - return NULL; + return nullptr; } // Bizarre in-place expression evaluator. @@ -323,7 +323,7 @@ u32 DSPAssembler::ParseExpression(const char *ptr) char *s_buffer = (char *)malloc(1024); strcpy(s_buffer, ptr); - while ((pbuf = FindBrackets(s_buffer, d_buffer)) != NULL) + while ((pbuf = FindBrackets(s_buffer, d_buffer)) != nullptr) { val = ParseExpression(d_buffer); sprintf(d_buffer, "%s%d%s", s_buffer, val, pbuf); @@ -359,14 +359,14 @@ u32 DSPAssembler::ParseExpression(const char *ptr) d_buffer[i] = c; } - while ((pbuf = strstr(d_buffer, "+")) != NULL) + while ((pbuf = strstr(d_buffer, "+")) != nullptr) { *pbuf = 0x0; val = ParseExpression(d_buffer) + ParseExpression(pbuf+1); sprintf(d_buffer, "%d", val); } - while ((pbuf = strstr(d_buffer, "-")) != NULL) + while ((pbuf = strstr(d_buffer, "-")) != nullptr) { *pbuf = 0x0; val = ParseExpression(d_buffer) - ParseExpression(pbuf+1); @@ -378,28 +378,28 @@ u32 DSPAssembler::ParseExpression(const char *ptr) sprintf(d_buffer, "%d", val); } - while ((pbuf = strstr(d_buffer, "*")) != NULL) + while ((pbuf = strstr(d_buffer, "*")) != nullptr) { *pbuf = 0x0; val = ParseExpression(d_buffer) * ParseExpression(pbuf+1); sprintf(d_buffer, "%d", val); } - while ((pbuf = strstr(d_buffer, "/")) != NULL) + while ((pbuf = strstr(d_buffer, "/")) != nullptr) { *pbuf = 0x0; val = ParseExpression(d_buffer) / ParseExpression(pbuf+1); sprintf(d_buffer, "%d", val); } - while ((pbuf = strstr(d_buffer, "|")) != NULL) + while ((pbuf = strstr(d_buffer, "|")) != nullptr) { *pbuf = 0x0; val = ParseExpression(d_buffer) | ParseExpression(pbuf+1); sprintf(d_buffer, "%d", val); } - while ((pbuf = strstr(d_buffer, "&")) != NULL) + while ((pbuf = strstr(d_buffer, "&")) != nullptr) { *pbuf = 0x0; val = ParseExpression(d_buffer) & ParseExpression(pbuf+1); @@ -420,7 +420,7 @@ u32 DSPAssembler::GetParams(char *parstr, param_t *par) tmpstr = strtok(tmpstr, ",\x00"); for (int i = 0; i < 10; i++) { - if (tmpstr == NULL) + if (tmpstr == nullptr) break; tmpstr = skip_spaces(tmpstr); if (strlen(tmpstr) == 0) @@ -463,7 +463,7 @@ u32 DSPAssembler::GetParams(char *parstr, param_t *par) par[i].type = P_VAL; break; } - tmpstr = strtok(NULL, ",\x00"); + tmpstr = strtok(nullptr, ",\x00"); } return count; } @@ -493,7 +493,7 @@ const opc_t *DSPAssembler::FindOpcode(const char *opcode, u32 par_count, const o } } ShowError(ERR_UNKNOWN_OPCODE); - return NULL; + return nullptr; } // weird... @@ -780,8 +780,8 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass) //printf("A: %s\n", line); code_line++; - param_t params[10] = {{0, P_NONE, NULL}}; - param_t params_ext[10] = {{0, P_NONE, NULL}}; + param_t params[10] = {{0, P_NONE, nullptr}}; + param_t params_ext[10] = {{0, P_NONE, nullptr}}; bool upper = true; for (int i = 0; i < LINEBUF_SIZE; i++) @@ -851,33 +851,33 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass) } } - char *opcode = NULL; + char *opcode = nullptr; opcode = strtok(ptr, " "); - char *opcode_ext = NULL; + char *opcode_ext = nullptr; u32 params_count = 0; u32 params_count_ext = 0; if (opcode) { - if ((opcode_ext = strstr(opcode, "'")) != NULL) + if ((opcode_ext = strstr(opcode, "'")) != nullptr) { opcode_ext[0] = '\0'; opcode_ext++; if (strlen(opcode_ext) == 0) - opcode_ext = NULL; + opcode_ext = nullptr; } // now we have opcode and label params_count = 0; params_count_ext = 0; - char *paramstr = strtok(NULL, "\0"); - char *paramstr_ext = 0; + char *paramstr = strtok(nullptr, "\0"); + char *paramstr_ext = nullptr; // there is valid opcode so probably we have parameters if (paramstr) { - if ((paramstr_ext = strstr(paramstr, ":")) != NULL) + if ((paramstr_ext = strstr(paramstr, ":")) != nullptr) { paramstr_ext[0] = '\0'; paramstr_ext++; @@ -899,14 +899,14 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass) if (strcmp(opcode, "EQU") == 0) { lval = params[0].val; - opcode = NULL; + opcode = nullptr; } } if (pass == 1) labels.RegisterLabel(label, lval); } - if (opcode == NULL) + if (opcode == nullptr) continue; // check if opcode is reserved compiler word @@ -981,7 +981,7 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass) VerifyParams(opc, params, params_count); - const opc_t *opc_ext = NULL; + const opc_t *opc_ext = nullptr; // Check for opcode extensions. if (opc->extended) { diff --git a/Source/Core/Core/DSP/DSPAssembler.h b/Source/Core/Core/DSP/DSPAssembler.h index 6ee790627e..bc9e290c9d 100644 --- a/Source/Core/Core/DSP/DSPAssembler.h +++ b/Source/Core/Core/DSP/DSPAssembler.h @@ -73,7 +73,7 @@ public: // one for each word of code, indicating the source assembler code line number it came from. // If returns false, call GetErrorString to get some text to present to the user. - bool Assemble(const char *text, std::vector &code, std::vector *line_numbers = NULL); + bool Assemble(const char *text, std::vector &code, std::vector *line_numbers = nullptr); std::string GetErrorString() const { return last_error_str; } err_t GetError() const { return last_error; } @@ -103,8 +103,8 @@ private: void InitPass(int pass); bool AssembleFile(const char *fname, int pass); - void ShowError(err_t err_code, const char *extra_info = NULL); - // void ShowWarning(err_t err_code, const char *extra_info = NULL); + void ShowError(err_t err_code, const char *extra_info = nullptr); + // void ShowWarning(err_t err_code, const char *extra_info = nullptr); char *FindBrackets(char *src, char *dst); const opc_t *FindOpcode(const char *opcode, u32 par_count, const opc_t * const opcod, int opcod_size); diff --git a/Source/Core/Core/DSP/DSPCodeUtil.cpp b/Source/Core/Core/DSP/DSPCodeUtil.cpp index 60c9b4e59d..a27980044c 100644 --- a/Source/Core/Core/DSP/DSPCodeUtil.cpp +++ b/Source/Core/Core/DSP/DSPCodeUtil.cpp @@ -114,7 +114,7 @@ void CodeToHeader(const std::vector &code, std::string _filename, header.reserve(code_padded.size() * 4); header.append("#define NUM_UCODES 1\n\n"); std::string filename; - SplitPath(_filename, NULL, &filename, NULL); + SplitPath(_filename, nullptr, &filename, nullptr); header.append(StringFromFormat("const char* UCODE_NAMES[NUM_UCODES] = {\"%s\"};\n\n", filename.c_str())); header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n"); @@ -151,7 +151,7 @@ void CodesToHeader(const std::vector *codes, const std::vector for (u32 i = 0; i < numCodes; i++) { std::string filename; - if (! SplitPath(filenames->at(i), NULL, &filename, NULL)) + if (! SplitPath(filenames->at(i), nullptr, &filename, nullptr)) filename = filenames->at(i); header.append(StringFromFormat("\t\"%s\",\n", filename.c_str())); } diff --git a/Source/Core/Core/DSP/DSPCore.cpp b/Source/Core/Core/DSP/DSPCore.cpp index 4f47183914..72835fb14c 100644 --- a/Source/Core/Core/DSP/DSPCore.cpp +++ b/Source/Core/Core/DSP/DSPCore.cpp @@ -41,7 +41,7 @@ DSPBreakpoints dsp_breakpoints; DSPCoreState core_state = DSPCORE_STOP; u16 cyclesLeft = 0; bool init_hax = false; -DSPEmitter *dspjit = NULL; +DSPEmitter *dspjit = nullptr; Common::Event step_event; static bool LoadRom(const char *fname, int size_in_words, u16 *rom) @@ -133,7 +133,7 @@ static void DSPCore_FreeMemoryPages() FreeMemoryPages(g_dsp.iram, DSP_IRAM_BYTE_SIZE); FreeMemoryPages(g_dsp.dram, DSP_DRAM_BYTE_SIZE); FreeMemoryPages(g_dsp.coef, DSP_COEF_BYTE_SIZE); - g_dsp.irom = g_dsp.iram = g_dsp.dram = g_dsp.coef = NULL; + g_dsp.irom = g_dsp.iram = g_dsp.dram = g_dsp.coef = nullptr; } bool DSPCore_Init(const char *irom_filename, const char *coef_filename, @@ -142,7 +142,7 @@ bool DSPCore_Init(const char *irom_filename, const char *coef_filename, g_dsp.step_counter = 0; cyclesLeft = 0; init_hax = false; - dspjit = NULL; + dspjit = nullptr; g_dsp.irom = (u16*)AllocateMemoryPages(DSP_IROM_BYTE_SIZE); g_dsp.iram = (u16*)AllocateMemoryPages(DSP_IRAM_BYTE_SIZE); @@ -218,7 +218,7 @@ void DSPCore_Shutdown() if(dspjit) { delete dspjit; - dspjit = NULL; + dspjit = nullptr; } DSPCore_FreeMemoryPages(); } diff --git a/Source/Core/Core/DSP/DSPDisassembler.cpp b/Source/Core/Core/DSP/DSPDisassembler.cpp index 8df83f33a2..74195e5df8 100644 --- a/Source/Core/Core/DSP/DSPDisassembler.cpp +++ b/Source/Core/Core/DSP/DSPDisassembler.cpp @@ -208,8 +208,8 @@ bool DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 const u32 op1 = binbuf[*pc & 0x0fff]; - const DSPOPCTemplate *opc = NULL; - const DSPOPCTemplate *opc_ext = NULL; + const DSPOPCTemplate *opc = nullptr; + const DSPOPCTemplate *opc_ext = nullptr; // find opcode for (int j = 0; j < opcodes_size; j++) @@ -222,7 +222,7 @@ bool DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 break; } } - const DSPOPCTemplate fake_op = {"CW", 0x0000, 0x0000, nop, NULL, 1, 1, {{P_VAL, 2, 0, 0, 0xffff}}, false, false, false, false, false}; + const DSPOPCTemplate fake_op = {"CW", 0x0000, 0x0000, nop, nullptr, 1, 1, {{P_VAL, 2, 0, 0, 0xffff}}, false, false, false, false, false}; if (!opc) opc = &fake_op; diff --git a/Source/Core/Core/DSP/DSPEmitter.cpp b/Source/Core/Core/DSP/DSPEmitter.cpp index 5e5a7e38b8..dc1cbd696a 100644 --- a/Source/Core/Core/DSP/DSPEmitter.cpp +++ b/Source/Core/Core/DSP/DSPEmitter.cpp @@ -18,7 +18,7 @@ using namespace Gen; DSPEmitter::DSPEmitter() : gpr(*this), storeIndex(-1), storeIndex2(-1) { - m_compiledCode = NULL; + m_compiledCode = nullptr; AllocCodeSpace(COMPILED_CODE_SIZE); @@ -37,7 +37,7 @@ DSPEmitter::DSPEmitter() : gpr(*this), storeIndex(-1), storeIndex2(-1) for(int i = 0x0000; i < MAX_BLOCKS; i++) { blocks[i] = (DSPCompiledCode)stubEntryPoint; - blockLinks[i] = 0; + blockLinks[i] = nullptr; blockSize[i] = 0; } } @@ -55,7 +55,7 @@ void DSPEmitter::ClearIRAM() for(int i = 0x0000; i < 0x1000; i++) { blocks[i] = (DSPCompiledCode)stubEntryPoint; - blockLinks[i] = 0; + blockLinks[i] = nullptr; blockSize[i] = 0; unresolvedJumps[i].clear(); } @@ -71,7 +71,7 @@ void DSPEmitter::ClearIRAMandDSPJITCodespaceReset() for(int i = 0x0000; i < 0x10000; i++) { blocks[i] = (DSPCompiledCode)stubEntryPoint; - blockLinks[i] = 0; + blockLinks[i] = nullptr; blockSize[i] = 0; unresolvedJumps[i].clear(); } @@ -345,7 +345,7 @@ void DSPEmitter::Compile(u16 start_addr) { // Mark the block to be recompiled again blocks[i] = (DSPCompiledCode)stubEntryPoint; - blockLinks[i] = 0; + blockLinks[i] = nullptr; blockSize[i] = 0; } } diff --git a/Source/Core/Core/DSP/DSPTables.cpp b/Source/Core/Core/DSP/DSPTables.cpp index 5a48edb240..05af073f9f 100644 --- a/Source/Core/Core/DSP/DSPTables.cpp +++ b/Source/Core/Core/DSP/DSPTables.cpp @@ -292,7 +292,7 @@ const DSPOPCTemplate opcodes[] = }; const DSPOPCTemplate cw = - {"CW", 0x0000, 0x0000, nop, NULL, 1, 1, {{P_VAL, 2, 0, 0, 0xffff}}, false, false, false, false, false}; + {"CW", 0x0000, 0x0000, nop, nullptr, 1, 1, {{P_VAL, 2, 0, 0, 0xffff}}, false, false, false, false, false}; // extended opcodes @@ -353,43 +353,43 @@ const pdlabel_t pdlabels[] = {0xffae, "COEF_A1_7", "COEF_A1_7",}, {0xffaf, "COEF_A2_7", "COEF_A2_7",}, - {0xffb0, "0xffb0", 0,}, - {0xffb1, "0xffb1", 0,}, - {0xffb2, "0xffb2", 0,}, - {0xffb3, "0xffb3", 0,}, - {0xffb4, "0xffb4", 0,}, - {0xffb5, "0xffb5", 0,}, - {0xffb6, "0xffb6", 0,}, - {0xffb7, "0xffb7", 0,}, - {0xffb8, "0xffb8", 0,}, - {0xffb9, "0xffb9", 0,}, - {0xffba, "0xffba", 0,}, - {0xffbb, "0xffbb", 0,}, - {0xffbc, "0xffbc", 0,}, - {0xffbd, "0xffbd", 0,}, - {0xffbe, "0xffbe", 0,}, - {0xffbf, "0xffbf", 0,}, + {0xffb0, "0xffb0", nullptr,}, + {0xffb1, "0xffb1", nullptr,}, + {0xffb2, "0xffb2", nullptr,}, + {0xffb3, "0xffb3", nullptr,}, + {0xffb4, "0xffb4", nullptr,}, + {0xffb5, "0xffb5", nullptr,}, + {0xffb6, "0xffb6", nullptr,}, + {0xffb7, "0xffb7", nullptr,}, + {0xffb8, "0xffb8", nullptr,}, + {0xffb9, "0xffb9", nullptr,}, + {0xffba, "0xffba", nullptr,}, + {0xffbb, "0xffbb", nullptr,}, + {0xffbc, "0xffbc", nullptr,}, + {0xffbd, "0xffbd", nullptr,}, + {0xffbe, "0xffbe", nullptr,}, + {0xffbf, "0xffbf", nullptr,}, - {0xffc0, "0xffc0", 0,}, - {0xffc1, "0xffc1", 0,}, - {0xffc2, "0xffc2", 0,}, - {0xffc3, "0xffc3", 0,}, - {0xffc4, "0xffc4", 0,}, - {0xffc5, "0xffc5", 0,}, - {0xffc6, "0xffc6", 0,}, - {0xffc7, "0xffc7", 0,}, - {0xffc8, "0xffc8", 0,}, + {0xffc0, "0xffc0", nullptr,}, + {0xffc1, "0xffc1", nullptr,}, + {0xffc2, "0xffc2", nullptr,}, + {0xffc3, "0xffc3", nullptr,}, + {0xffc4, "0xffc4", nullptr,}, + {0xffc5, "0xffc5", nullptr,}, + {0xffc6, "0xffc6", nullptr,}, + {0xffc7, "0xffc7", nullptr,}, + {0xffc8, "0xffc8", nullptr,}, {0xffc9, "DSCR", "DSP DMA Control Reg",}, - {0xffca, "0xffca", 0,}, + {0xffca, "0xffca", nullptr,}, {0xffcb, "DSBL", "DSP DMA Block Length",}, - {0xffcc, "0xffcc", 0,}, + {0xffcc, "0xffcc", nullptr,}, {0xffcd, "DSPA", "DSP DMA DMEM Address",}, {0xffce, "DSMAH", "DSP DMA Mem Address H",}, {0xffcf, "DSMAL", "DSP DMA Mem Address L",}, - {0xffd0, "0xffd0",0,}, + {0xffd0, "0xffd0",nullptr,}, {0xffd1, "SampleFormat", "SampleFormat",}, - {0xffd2, "0xffd2",0,}, + {0xffd2, "0xffd2",nullptr,}, {0xffd3, "UnkZelda", "Unk Zelda reads/writes from/to it",}, {0xffd4, "ACSAH", "Accelerator start address H",}, {0xffd5, "ACSAL", "Accelerator start address L",}, @@ -402,36 +402,36 @@ const pdlabel_t pdlabels[] = {0xffdc, "yn2", "yn2",}, {0xffdd, "ARAM", "Direct Read from ARAM (uses ADPCM)",}, {0xffde, "GAIN", "Gain",}, - {0xffdf, "0xffdf", 0,}, + {0xffdf, "0xffdf", nullptr,}, - {0xffe0, "0xffe0",0,}, - {0xffe1, "0xffe1",0,}, - {0xffe2, "0xffe2",0,}, - {0xffe3, "0xffe3",0,}, - {0xffe4, "0xffe4",0,}, - {0xffe5, "0xffe5",0,}, - {0xffe6, "0xffe6",0,}, - {0xffe7, "0xffe7",0,}, - {0xffe8, "0xffe8",0,}, - {0xffe9, "0xffe9",0,}, - {0xffea, "0xffea",0,}, - {0xffeb, "0xffeb",0,}, - {0xffec, "0xffec",0,}, - {0xffed, "0xffed",0,}, - {0xffee, "0xffee",0,}, + {0xffe0, "0xffe0",nullptr,}, + {0xffe1, "0xffe1",nullptr,}, + {0xffe2, "0xffe2",nullptr,}, + {0xffe3, "0xffe3",nullptr,}, + {0xffe4, "0xffe4",nullptr,}, + {0xffe5, "0xffe5",nullptr,}, + {0xffe6, "0xffe6",nullptr,}, + {0xffe7, "0xffe7",nullptr,}, + {0xffe8, "0xffe8",nullptr,}, + {0xffe9, "0xffe9",nullptr,}, + {0xffea, "0xffea",nullptr,}, + {0xffeb, "0xffeb",nullptr,}, + {0xffec, "0xffec",nullptr,}, + {0xffed, "0xffed",nullptr,}, + {0xffee, "0xffee",nullptr,}, {0xffef, "AMDM", "ARAM DMA Request Mask",}, - {0xfff0, "0xfff0",0,}, - {0xfff1, "0xfff1",0,}, - {0xfff2, "0xfff2",0,}, - {0xfff3, "0xfff3",0,}, - {0xfff4, "0xfff4",0,}, - {0xfff5, "0xfff5",0,}, - {0xfff6, "0xfff6",0,}, - {0xfff7, "0xfff7",0,}, - {0xfff8, "0xfff8",0,}, - {0xfff9, "0xfff9",0,}, - {0xfffa, "0xfffa",0,}, + {0xfff0, "0xfff0",nullptr,}, + {0xfff1, "0xfff1",nullptr,}, + {0xfff2, "0xfff2",nullptr,}, + {0xfff3, "0xfff3",nullptr,}, + {0xfff4, "0xfff4",nullptr,}, + {0xfff5, "0xfff5",nullptr,}, + {0xfff6, "0xfff6",nullptr,}, + {0xfff7, "0xfff7",nullptr,}, + {0xfff8, "0xfff8",nullptr,}, + {0xfff9, "0xfff9",nullptr,}, + {0xfffa, "0xfffa",nullptr,}, {0xfffb, "DIRQ", "DSP IRQ Request",}, {0xfffc, "DMBH", "DSP Mailbox H",}, {0xfffd, "DMBL", "DSP Mailbox L",}, diff --git a/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp b/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp index d8eb87f499..d7b67ced90 100644 --- a/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp +++ b/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp @@ -95,7 +95,7 @@ static void WriteBlockLink(DSPEmitter& emitter, u16 dest) // Jump directly to the called block if it has already been compiled. if (!(dest >= emitter.startAddr && dest <= emitter.compilePC)) { - if (emitter.blockLinks[dest] != 0 ) + if (emitter.blockLinks[dest] != nullptr ) { emitter.gpr.flushRegs(); // Check if we have enough cycles to execute the next block diff --git a/Source/Core/Core/DSP/Jit/DSPJitRegCache.cpp b/Source/Core/Core/DSP/Jit/DSPJitRegCache.cpp index 818049ad46..f09672ef34 100644 --- a/Source/Core/Core/DSP/Jit/DSPJitRegCache.cpp +++ b/Source/Core/Core/DSP/Jit/DSPJitRegCache.cpp @@ -71,7 +71,7 @@ static void *reg_ptr(int reg) #endif default: _assert_msg_(DSPLLE, 0, "cannot happen"); - return NULL; + return nullptr; } } diff --git a/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp b/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp index da951be040..79b380847e 100644 --- a/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp +++ b/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp @@ -31,7 +31,7 @@ void DSPEmitter::dsp_reg_stack_push(int stack_reg) MOVZX(32, 8, EAX, R(AL)); #endif MOV(16, MComplex(EAX, EAX, 1, - PtrOffset(&g_dsp.reg_stack[stack_reg][0],0)), R(tmp1)); + PtrOffset(&g_dsp.reg_stack[stack_reg][0],nullptr)), R(tmp1)); gpr.putXReg(tmp1); } @@ -50,7 +50,7 @@ void DSPEmitter::dsp_reg_stack_pop(int stack_reg) MOVZX(32, 8, EAX, R(AL)); #endif MOV(16, R(tmp1), MComplex(EAX, EAX, 1, - PtrOffset(&g_dsp.reg_stack[stack_reg][0],0))); + PtrOffset(&g_dsp.reg_stack[stack_reg][0],nullptr))); MOV(16, M(&g_dsp.r.st[stack_reg]), R(tmp1)); gpr.putXReg(tmp1); diff --git a/Source/Core/Core/Debugger/Dump.cpp b/Source/Core/Core/Debugger/Dump.cpp index a4c23ab07d..c55f61cf12 100644 --- a/Source/Core/Core/Debugger/Dump.cpp +++ b/Source/Core/Core/Debugger/Dump.cpp @@ -10,7 +10,7 @@ #include "Core/Debugger/Dump.h" CDump::CDump(const char* _szFilename) : - m_pData(NULL) + m_pData(nullptr) { File::IOFile pStream(_szFilename, "rb"); if (pStream) @@ -25,10 +25,10 @@ CDump::CDump(const char* _szFilename) : CDump::~CDump(void) { - if (m_pData != NULL) + if (m_pData != nullptr) { delete[] m_pData; - m_pData = NULL; + m_pData = nullptr; } } diff --git a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp index 7bee8c6a41..c6fecdac1b 100644 --- a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp +++ b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp @@ -129,7 +129,7 @@ FifoDataFile *FifoDataFile::Load(const std::string &filename, bool flagsOnly) File::IOFile file; file.Open(filename, "rb"); if (!file) - return NULL; + return nullptr; FileHeader header; file.ReadBytes(&header, sizeof(header)); @@ -137,7 +137,7 @@ FifoDataFile *FifoDataFile::Load(const std::string &filename, bool flagsOnly) if (header.fileId != FILE_ID || header.min_loader_version > VERSION_NUMBER) { file.Close(); - return NULL; + return nullptr; } FifoDataFile* dataFile = new FifoDataFile; diff --git a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp index 55731f3162..ab88f00765 100644 --- a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp +++ b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp @@ -39,13 +39,13 @@ bool FifoPlayer::Open(const std::string& filename) if (m_FileLoadedCb) m_FileLoadedCb(); - return (m_File != NULL); + return (m_File != nullptr); } void FifoPlayer::Close() { delete m_File; - m_File = NULL; + m_File = nullptr; m_FrameRangeStart = 0; m_FrameRangeEnd = 0; @@ -158,9 +158,9 @@ FifoPlayer::FifoPlayer() : m_ObjectRangeStart(0), m_ObjectRangeEnd(10000), m_EarlyMemoryUpdates(false), - m_FileLoadedCb(NULL), - m_FrameWrittenCb(NULL), - m_File(NULL) + m_FileLoadedCb(nullptr), + m_FrameWrittenCb(nullptr), + m_File(nullptr) { m_Loop = SConfig::GetInstance().m_LocalCoreStartupParameter.bLoopFifoReplay; } @@ -271,7 +271,7 @@ void FifoPlayer::WriteAllMemoryUpdates() void FifoPlayer::WriteMemory(const MemoryUpdate& memUpdate) { - u8 *mem = NULL; + u8 *mem = nullptr; if (memUpdate.address & 0x10000000) mem = &Memory::m_pEXRAM[memUpdate.address & Memory::EXRAM_MASK]; diff --git a/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.cpp b/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.cpp index 7e16ddb3de..1e50ff3a77 100644 --- a/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.cpp +++ b/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.cpp @@ -16,7 +16,7 @@ using namespace FifoAnalyzer; FifoRecordAnalyzer::FifoRecordAnalyzer() : m_DrawingObject(false), - m_BpMem(NULL) + m_BpMem(nullptr) { } diff --git a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp index 7207812044..6da4325db5 100644 --- a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp +++ b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp @@ -19,13 +19,13 @@ FifoRecorder::FifoRecorder() : m_WasRecording(false), m_RequestedRecordingEnd(false), m_RecordFramesRemaining(0), - m_FinishedCb(NULL), - m_File(NULL), + m_FinishedCb(nullptr), + m_File(nullptr), m_SkipNextData(true), m_SkipFutureData(true), m_FrameEnded(false), - m_Ram(NULL), - m_ExRam(NULL) + m_Ram(nullptr), + m_ExRam(nullptr) { } diff --git a/Source/Core/Core/HLE/HLE.cpp b/Source/Core/Core/HLE/HLE.cpp index a8f540d223..56f8e3e457 100644 --- a/Source/Core/Core/HLE/HLE.cpp +++ b/Source/Core/Core/HLE/HLE.cpp @@ -88,7 +88,7 @@ void PatchFunctions() for (u32 i = 0; i < sizeof(OSPatches) / sizeof(SPatch); i++) { Symbol *symbol = g_symbolDB.GetSymbolFromName(OSPatches[i].m_szPatchName); - if (symbol > 0) + if (symbol) { for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4) { @@ -103,7 +103,7 @@ void PatchFunctions() for (size_t i = 1; i < sizeof(OSBreakPoints) / sizeof(SPatch); i++) { Symbol *symbol = g_symbolDB.GetSymbolFromName(OSPatches[i].m_szPatchName); - if (symbol > 0) + if (symbol) { PowerPC::breakpoints.Add(symbol->address, false); INFO_LOG(OSHLE, "Adding BP to %s %08x", OSBreakPoints[i].m_szPatchName, symbol->address); @@ -159,7 +159,7 @@ bool IsEnabled(int flags) u32 UnPatch(std::string patchName) { Symbol *symbol = g_symbolDB.GetSymbolFromName(patchName.c_str()); - if (symbol > 0) + if (symbol) { for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4) { diff --git a/Source/Core/Core/HW/BBA-TAP/TAP_Unix.cpp b/Source/Core/Core/HW/BBA-TAP/TAP_Unix.cpp index c81659eeed..de4bbe6320 100644 --- a/Source/Core/Core/HW/BBA-TAP/TAP_Unix.cpp +++ b/Source/Core/Core/HW/BBA-TAP/TAP_Unix.cpp @@ -120,7 +120,7 @@ void ReadThreadHandler(CEXIETHERNET* self) struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 50000; - if (select(self->fd + 1, &rfds, NULL, NULL, &timeout) <= 0) + if (select(self->fd + 1, &rfds, nullptr, nullptr, &timeout) <= 0) continue; int readBytes = read(self->fd, self->mRecvBuffer, BBA_RECV_SIZE); diff --git a/Source/Core/Core/HW/BBA-TAP/TAP_Win32.cpp b/Source/Core/Core/HW/BBA-TAP/TAP_Win32.cpp index 4d8fc3c709..725a6e7e00 100644 --- a/Source/Core/Core/HW/BBA-TAP/TAP_Win32.cpp +++ b/Source/Core/Core/HW/BBA-TAP/TAP_Win32.cpp @@ -35,7 +35,7 @@ bool IsTAPDevice(const TCHAR *guid) DWORD data_type; len = sizeof(enum_name); - status = RegEnumKeyEx(netcard_key, i, enum_name, &len, NULL, NULL, NULL, NULL); + status = RegEnumKeyEx(netcard_key, i, enum_name, &len, nullptr, nullptr, nullptr, nullptr); if (status == ERROR_NO_MORE_ITEMS) break; @@ -53,13 +53,13 @@ bool IsTAPDevice(const TCHAR *guid) else { len = sizeof(component_id); - status = RegQueryValueEx(unit_key, component_id_string, NULL, + status = RegQueryValueEx(unit_key, component_id_string, nullptr, &data_type, (LPBYTE)component_id, &len); if (!(status != ERROR_SUCCESS || data_type != REG_SZ)) { len = sizeof(net_cfg_instance_id); - status = RegQueryValueEx(unit_key, net_cfg_instance_id_string, NULL, + status = RegQueryValueEx(unit_key, net_cfg_instance_id_string, nullptr, &data_type, (LPBYTE)net_cfg_instance_id, &len); if (status == ERROR_SUCCESS && data_type == REG_SZ) @@ -106,7 +106,7 @@ bool GetGUIDs(std::vector>& guids) len = sizeof(enum_name); status = RegEnumKeyEx(control_net_key, i, enum_name, - &len, NULL, NULL, NULL, NULL); + &len, nullptr, nullptr, nullptr, nullptr); if (status == ERROR_NO_MORE_ITEMS) break; @@ -122,7 +122,7 @@ bool GetGUIDs(std::vector>& guids) if (status == ERROR_SUCCESS) { len = sizeof(name_data); - status = RegQueryValueEx(connection_key, name_string, NULL, + status = RegQueryValueEx(connection_key, name_string, nullptr, &name_type, (LPBYTE)name_data, &len); if (status != ERROR_SUCCESS || name_type != REG_SZ) @@ -199,7 +199,7 @@ bool CEXIETHERNET::Activate() /* get driver version info */ ULONG info[3]; if (DeviceIoControl(mHAdapter, TAP_IOCTL_GET_VERSION, - &info, sizeof(info), &info, sizeof(info), &len, NULL)) + &info, sizeof(info), &info, sizeof(info), &len, nullptr)) { INFO_LOG(SP1, "TAP-Win32 Driver Version %d.%d %s", info[0], info[1], info[2] ? "(DEBUG)" : ""); @@ -217,7 +217,7 @@ bool CEXIETHERNET::Activate() /* set driver media status to 'connected' */ ULONG status = TRUE; if (!DeviceIoControl(mHAdapter, TAP_IOCTL_SET_MEDIA_STATUS, - &status, sizeof(status), &status, sizeof(status), &len, NULL)) + &status, sizeof(status), &status, sizeof(status), &len, nullptr)) { ERROR_LOG(SP1, "WARNING: The TAP-Win32 driver rejected a" "TAP_IOCTL_SET_MEDIA_STATUS DeviceIoControl call."); @@ -283,7 +283,7 @@ bool CEXIETHERNET::RecvInit() { // Set up recv event - if ((mHRecvEvent = CreateEvent(NULL, false, false, NULL)) == NULL) + if ((mHRecvEvent = CreateEvent(nullptr, false, false, nullptr)) == nullptr) { ERROR_LOG(SP1, "Failed to create recv event:%x", GetLastError()); return false; diff --git a/Source/Core/Core/HW/CPU.cpp b/Source/Core/Core/HW/CPU.cpp index 5a2869425e..13717b395c 100644 --- a/Source/Core/Core/HW/CPU.cpp +++ b/Source/Core/Core/HW/CPU.cpp @@ -18,20 +18,20 @@ namespace { static Common::Event m_StepEvent; - static Common::Event *m_SyncEvent = NULL; + static Common::Event *m_SyncEvent = nullptr; static std::mutex m_csCpuOccupied; } void CCPU::Init(int cpu_core) { PowerPC::Init(cpu_core); - m_SyncEvent = NULL; + m_SyncEvent = nullptr; } void CCPU::Shutdown() { PowerPC::Shutdown(); - m_SyncEvent = NULL; + m_SyncEvent = nullptr; } void CCPU::Run() @@ -68,7 +68,7 @@ reswitch: if (m_SyncEvent) { m_SyncEvent->Set(); - m_SyncEvent = NULL; + m_SyncEvent = nullptr; } Host_UpdateDisasmDialog(); break; diff --git a/Source/Core/Core/HW/CPU.h b/Source/Core/Core/HW/CPU.h index cbdfa91dfa..0925363d76 100644 --- a/Source/Core/Core/HW/CPU.h +++ b/Source/Core/Core/HW/CPU.h @@ -28,7 +28,7 @@ public: static void Reset(); // StepOpcode (Steps one Opcode) - static void StepOpcode(Common::Event *event = 0); + static void StepOpcode(Common::Event *event = nullptr); // one step only static void SingleStep(); diff --git a/Source/Core/Core/HW/DSP.cpp b/Source/Core/Core/HW/DSP.cpp index 1372881f0f..858f7ff748 100644 --- a/Source/Core/Core/HW/DSP.cpp +++ b/Source/Core/Core/HW/DSP.cpp @@ -174,7 +174,7 @@ struct ARAMInfo wii_mode = false; size = ARAM_SIZE; mask = ARAM_MASK; - ptr = NULL; + ptr = nullptr; } }; @@ -282,12 +282,12 @@ void Shutdown() if (!g_ARAM.wii_mode) { FreeMemoryPages(g_ARAM.ptr, g_ARAM.size); - g_ARAM.ptr = NULL; + g_ARAM.ptr = nullptr; } dsp_emulator->Shutdown(); delete dsp_emulator; - dsp_emulator = NULL; + dsp_emulator = nullptr; } void RegisterMMIO(MMIO::Mapping* mmio, u32 base) diff --git a/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp b/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp index 17838c4428..cdbff7fa8c 100644 --- a/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp +++ b/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp @@ -21,7 +21,7 @@ DSPHLE::DSPHLE() { m_InitMixer = false; - soundStream = NULL; + soundStream = nullptr; } // Mailbox utility @@ -46,8 +46,8 @@ bool DSPHLE::Initialize(void *hWnd, bool bWii, bool bDSPThread) { m_hWnd = hWnd; m_bWii = bWii; - m_pUCode = NULL; - m_lastUCode = NULL; + m_pUCode = nullptr; + m_lastUCode = nullptr; m_bHalt = false; m_bAssertInt = false; @@ -74,7 +74,7 @@ void DSPHLE::DSP_Update(int cycles) { // This is called OFTEN - better not do anything expensive! // ~1/6th as many cycles as the period PPC-side. - if (m_pUCode != NULL) + if (m_pUCode != nullptr) m_pUCode->Update(cycles / 6); } @@ -82,7 +82,7 @@ u32 DSPHLE::DSP_UpdateRate() { // AX HLE uses 3ms (Wii) or 5ms (GC) timing period int fields = VideoInterface::GetNumFields(); - if (m_pUCode != NULL) + if (m_pUCode != nullptr) return (SystemTimers::GetTicksPerSecond() / 1000) * m_pUCode->GetUpdateMs() / fields; else return SystemTimers::GetTicksPerSecond() / 1000; @@ -90,7 +90,7 @@ u32 DSPHLE::DSP_UpdateRate() void DSPHLE::SendMailToDSP(u32 _uMail) { - if (m_pUCode != NULL) { + if (m_pUCode != nullptr) { DEBUG_LOG(DSP_MAIL, "CPU writes 0x%08x", _uMail); m_pUCode->HandleMail(_uMail); } @@ -105,7 +105,7 @@ void DSPHLE::SetUCode(u32 _crc) { delete m_pUCode; - m_pUCode = NULL; + m_pUCode = nullptr; m_MailHandler.Clear(); m_pUCode = UCodeFactory(_crc, this, m_bWii); } @@ -117,7 +117,7 @@ void DSPHLE::SwapUCode(u32 _crc) { m_MailHandler.Clear(); - if (m_lastUCode == NULL) + if (m_lastUCode == nullptr) { m_lastUCode = m_pUCode; m_pUCode = UCodeFactory(_crc, this, m_bWii); @@ -126,7 +126,7 @@ void DSPHLE::SwapUCode(u32 _crc) { delete m_pUCode; m_pUCode = m_lastUCode; - m_lastUCode = NULL; + m_lastUCode = nullptr; } } @@ -154,7 +154,7 @@ void DSPHLE::DoState(PointerWrap &p) AudioCommon::PauseAndLock(false); soundStream->Stop(); delete soundStream; - soundStream = NULL; + soundStream = nullptr; } } diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.cpp index b91337d4af..2141b9c383 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.cpp @@ -468,7 +468,7 @@ void CUCode_AX::ProcessPBList(u32 pb_addr) ApplyUpdatesForMs(curr_ms, (u16*)&pb, pb.updates.num_updates, updates); ProcessVoice(pb, buffers, spms, ConvertMixerControl(pb.mixer_control), - m_coeffs_available ? m_coeffs : NULL); + m_coeffs_available ? m_coeffs : nullptr); // Forward the buffers for (u32 i = 0; i < sizeof (buffers.ptrs) / sizeof (buffers.ptrs[0]); ++i) @@ -482,7 +482,7 @@ void CUCode_AX::ProcessPBList(u32 pb_addr) void CUCode_AX::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr) { - int* buffers[3] = { 0 }; + int* buffers[3] = { nullptr }; switch (aux_id) { diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AXWii.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AXWii.cpp index f22706e1c1..8ebef6e80e 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AXWii.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AXWii.cpp @@ -467,7 +467,7 @@ void CUCode_AXWii::ProcessPBList(u32 pb_addr) ApplyUpdatesForMs(curr_ms, (u16*)&pb, num_updates, updates); ProcessVoice(pb, buffers, 32, ConvertMixerControl(HILO_TO_32(pb.mixer_control)), - m_coeffs_available ? m_coeffs : NULL); + m_coeffs_available ? m_coeffs : nullptr); // Forward the buffers for (u32 i = 0; i < sizeof (buffers.ptrs) / sizeof (buffers.ptrs[0]); ++i) @@ -479,7 +479,7 @@ void CUCode_AXWii::ProcessPBList(u32 pb_addr) { ProcessVoice(pb, buffers, 96, ConvertMixerControl(HILO_TO_32(pb.mixer_control)), - m_coeffs_available ? m_coeffs : NULL); + m_coeffs_available ? m_coeffs : nullptr); } WritePB(pb_addr, pb); @@ -493,7 +493,7 @@ void CUCode_AXWii::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr, u16 GenerateVolumeRamp(volume_ramp, m_last_aux_volumes[aux_id], volume, 96); m_last_aux_volumes[aux_id] = volume; - int* buffers[3] = { 0 }; + int* buffers[3] = { nullptr }; int* main_buffers[3] = { m_samples_left, m_samples_right, diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp index 4dad9783b0..7253723561 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp @@ -99,7 +99,7 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii) break; } - return NULL; + return nullptr; } bool IUCode::NeedsResumeMail() diff --git a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp index ee419024a4..df5795f83b 100644 --- a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp +++ b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp @@ -33,7 +33,7 @@ DSPLLE::DSPLLE() { - soundStream = NULL; + soundStream = nullptr; m_InitMixer = false; m_bIsRunning = false; m_cycle_count = 0; @@ -95,7 +95,7 @@ void DSPLLE::DoState(PointerWrap &p) AudioCommon::PauseAndLock(false); soundStream->Stop(); delete soundStream; - soundStream = NULL; + soundStream = nullptr; } } } diff --git a/Source/Core/Core/HW/DSPLLE/DSPSymbols.cpp b/Source/Core/Core/HW/DSPLLE/DSPSymbols.cpp index d4e5318bdd..09609b6304 100644 --- a/Source/Core/Core/HW/DSPLLE/DSPSymbols.cpp +++ b/Source/Core/Core/HW/DSPLLE/DSPSymbols.cpp @@ -70,7 +70,7 @@ Symbol *DSPSymbolDB::GetSymbolFromAddr(u32 addr) return &func.second; } } - return 0; + return nullptr; } // lower case only diff --git a/Source/Core/Core/HW/EXI.cpp b/Source/Core/Core/HW/EXI.cpp index b5492ac3be..f722c5a9ce 100644 --- a/Source/Core/Core/HW/EXI.cpp +++ b/Source/Core/Core/HW/EXI.cpp @@ -47,7 +47,7 @@ void Shutdown() for (auto& channel : g_Channels) { delete channel; - channel = NULL; + channel = nullptr; } } @@ -102,7 +102,7 @@ IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex) if (device) return device; } - return NULL; + return nullptr; } // Unused (?!) diff --git a/Source/Core/Core/HW/EXI_Channel.cpp b/Source/Core/Core/HW/EXI_Channel.cpp index 902f50e7d4..817579fef0 100644 --- a/Source/Core/Core/HW/EXI_Channel.cpp +++ b/Source/Core/Core/HW/EXI_Channel.cpp @@ -87,7 +87,7 @@ void CEXIChannel::RegisterMMIO(MMIO::Mapping* mmio, u32 base) IEXIDevice* pDevice = GetDevice(m_Status.CHIP_SELECT ^ newStatus.CHIP_SELECT); m_Status.CHIP_SELECT = newStatus.CHIP_SELECT; - if (pDevice != NULL) + if (pDevice != nullptr) pDevice->SetCS(m_Status.CHIP_SELECT); CoreTiming::ScheduleEvent_Threadsafe_Immediate(updateInterrupts, 0); @@ -110,7 +110,7 @@ void CEXIChannel::RegisterMMIO(MMIO::Mapping* mmio, u32 base) if (m_Control.TSTART) { IEXIDevice* pDevice = GetDevice(m_Status.CHIP_SELECT); - if (pDevice == NULL) + if (pDevice == nullptr) return; if (m_Control.DMA == 0) @@ -216,7 +216,7 @@ IEXIDevice* CEXIChannel::GetDevice(const u8 chip_select) case 2: return m_pDevices[1].get(); case 4: return m_pDevices[2].get(); } - return NULL; + return nullptr; } void CEXIChannel::Update() @@ -273,5 +273,5 @@ IEXIDevice* CEXIChannel::FindDevice(TEXIDevices device_type, int customIndex) if (device) return device; } - return NULL; + return nullptr; } diff --git a/Source/Core/Core/HW/EXI_Device.cpp b/Source/Core/Core/HW/EXI_Device.cpp index 86833c270d..69c21cb713 100644 --- a/Source/Core/Core/HW/EXI_Device.cpp +++ b/Source/Core/Core/HW/EXI_Device.cpp @@ -90,7 +90,7 @@ public: // F A C T O R Y IEXIDevice* EXIDevice_Create(TEXIDevices device_type, const int channel_num) { - IEXIDevice* result = NULL; + IEXIDevice* result = nullptr; switch (device_type) { @@ -132,7 +132,7 @@ IEXIDevice* EXIDevice_Create(TEXIDevices device_type, const int channel_num) break; } - if (result != NULL) + if (result != nullptr) result->m_deviceType = device_type; return result; diff --git a/Source/Core/Core/HW/EXI_Device.h b/Source/Core/Core/HW/EXI_Device.h index 69a7761075..3c0eab8a30 100644 --- a/Source/Core/Core/HW/EXI_Device.h +++ b/Source/Core/Core/HW/EXI_Device.h @@ -40,7 +40,7 @@ public: virtual void SetCS(int) {} virtual void DoState(PointerWrap&) {} virtual void PauseAndLock(bool doLock, bool unpauseOnUnlock=true) {} - virtual IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex=-1) { return (device_type == m_deviceType) ? this : NULL; } + virtual IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex=-1) { return (device_type == m_deviceType) ? this : nullptr; } // Update virtual void Update() {} diff --git a/Source/Core/Core/HW/EXI_DeviceIPL.cpp b/Source/Core/Core/HW/EXI_DeviceIPL.cpp index ae41037dbd..dfba7927b0 100644 --- a/Source/Core/Core/HW/EXI_DeviceIPL.cpp +++ b/Source/Core/Core/HW/EXI_DeviceIPL.cpp @@ -130,7 +130,7 @@ CEXIIPL::~CEXIIPL() } FreeMemoryPages(m_pIPL, ROM_SIZE); - m_pIPL = NULL; + m_pIPL = nullptr; // SRAM File::IOFile file(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strSRAM, "wb"); diff --git a/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp index 1b638b2d04..b933664f80 100644 --- a/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp +++ b/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp @@ -108,7 +108,7 @@ void innerFlush(FlushData* data) if (!pFile) { std::string dir; - SplitPath(data->filename, &dir, 0, 0); + SplitPath(data->filename, &dir, nullptr, nullptr); if (!File::IsDirectory(dir)) File::CreateFullPath(dir); pFile.Open(data->filename, "wb"); @@ -166,7 +166,7 @@ CEXIMemoryCard::~CEXIMemoryCard() CoreTiming::RemoveEvent(et_this_card); Flush(true); delete[] memory_card_content; - memory_card_content = NULL; + memory_card_content = nullptr; if (flushThread.joinable()) { @@ -482,8 +482,8 @@ void CEXIMemoryCard::DoState(PointerWrap &p) IEXIDevice* CEXIMemoryCard::FindDevice(TEXIDevices device_type, int customIndex) { if (device_type != m_deviceType) - return NULL; + return nullptr; if (customIndex != card_index) - return NULL; + return nullptr; return this; } diff --git a/Source/Core/Core/HW/GCMemcard.cpp b/Source/Core/Core/HW/GCMemcard.cpp index cc1f397970..e5a4a2063d 100644 --- a/Source/Core/Core/HW/GCMemcard.cpp +++ b/Source/Core/Core/HW/GCMemcard.cpp @@ -34,7 +34,7 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis) { //This function can be removed once more about hdr is known and we can check for a valid header std::string fileType; - SplitPath(filename, NULL, NULL, &fileType); + SplitPath(filename, nullptr, nullptr, &fileType); if (strcasecmp(fileType.c_str(), ".raw") && strcasecmp(fileType.c_str(), ".gcp")) { PanicAlertT("File has the extension \"%s\"\nvalid extensions are (.raw/.gcp)", fileType.c_str()); @@ -814,7 +814,7 @@ u32 GCMemcard::ImportGciInternal(FILE* gcih, const char *inputFile, const std::s File::IOFile gci(gcih); unsigned int offset; std::string fileType; - SplitPath(inputFile, NULL, NULL, &fileType); + SplitPath(inputFile, nullptr, nullptr, &fileType); if (!strcasecmp(fileType.c_str(), ".gci")) offset = GCI; @@ -913,7 +913,7 @@ u32 GCMemcard::ExportGci(u8 index, const char *fileName, const std::string &dire gci.Open(fileName, "wb"); std::string fileType; - SplitPath(fileName, NULL, NULL, &fileType); + SplitPath(fileName, nullptr, nullptr, &fileType); if (!strcasecmp(fileType.c_str(), ".gcs")) { offset = GCS; diff --git a/Source/Core/Core/HW/Memmap.cpp b/Source/Core/Core/HW/Memmap.cpp index d61507f205..b740971c56 100644 --- a/Source/Core/Core/HW/Memmap.cpp +++ b/Source/Core/Core/HW/Memmap.cpp @@ -53,7 +53,7 @@ bool bMMU = false; // Init() declarations // ---------------- // Store the MemArena here -u8* base = NULL; +u8* base = nullptr; // The MemArena class MemArena g_arena; @@ -121,8 +121,8 @@ bool IsInitialized() static const MemoryView views[] = { {&m_pRAM, &m_pPhysicalRAM, 0x00000000, RAM_SIZE, 0}, - {NULL, &m_pVirtualCachedRAM, 0x80000000, RAM_SIZE, MV_MIRROR_PREVIOUS}, - {NULL, &m_pVirtualUncachedRAM, 0xC0000000, RAM_SIZE, MV_MIRROR_PREVIOUS}, + {nullptr, &m_pVirtualCachedRAM, 0x80000000, RAM_SIZE, MV_MIRROR_PREVIOUS}, + {nullptr, &m_pVirtualUncachedRAM, 0xC0000000, RAM_SIZE, MV_MIRROR_PREVIOUS}, // Don't map any memory for the EFB. We want all access to this area to go // through the hardware access handlers. @@ -134,8 +134,8 @@ static const MemoryView views[] = {&m_pFakeVMEM, &m_pVirtualFakeVMEM, 0x7E000000, FAKEVMEM_SIZE, MV_FAKE_VMEM}, {&m_pEXRAM, &m_pPhysicalEXRAM, 0x10000000, EXRAM_SIZE, MV_WII_ONLY}, - {NULL, &m_pVirtualCachedEXRAM, 0x90000000, EXRAM_SIZE, MV_WII_ONLY | MV_MIRROR_PREVIOUS}, - {NULL, &m_pVirtualUncachedEXRAM, 0xD0000000, EXRAM_SIZE, MV_WII_ONLY | MV_MIRROR_PREVIOUS}, + {nullptr, &m_pVirtualCachedEXRAM, 0x90000000, EXRAM_SIZE, MV_WII_ONLY | MV_MIRROR_PREVIOUS}, + {nullptr, &m_pVirtualUncachedEXRAM, 0xD0000000, EXRAM_SIZE, MV_WII_ONLY | MV_MIRROR_PREVIOUS}, }; static const int num_views = sizeof(views) / sizeof(MemoryView); @@ -185,7 +185,7 @@ void Shutdown() if (bFakeVMEM) flags |= MV_FAKE_VMEM; MemoryMap_Shutdown(views, num_views, flags, &g_arena); g_arena.ReleaseSpace(); - base = NULL; + base = nullptr; delete mmio_mapping; INFO_LOG(MEMMAP, "Memory system shut down."); } @@ -223,7 +223,7 @@ void WriteBigEData(const u8 *_pData, const u32 _Address, const size_t _iSize) void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength) { u8 *ptr = GetPointer(_Address); - if (ptr != NULL) + if (ptr != nullptr) { memset(ptr,_iValue,_iLength); } @@ -239,7 +239,7 @@ void DMA_LCToMemory(const u32 _MemAddr, const u32 _CacheAddr, const u32 _iNumBlo const u8 *src = GetCachePtr() + (_CacheAddr & 0x3FFFF); u8 *dst = GetPointer(_MemAddr); - if ((dst != NULL) && (src != NULL) && (_MemAddr & 3) == 0 && (_CacheAddr & 3) == 0) + if ((dst != nullptr) && (src != nullptr) && (_MemAddr & 3) == 0 && (_CacheAddr & 3) == 0) { memcpy(dst, src, 32 * _iNumBlocks); } @@ -258,7 +258,7 @@ void DMA_MemoryToLC(const u32 _CacheAddr, const u32 _MemAddr, const u32 _iNumBlo const u8 *src = GetPointer(_MemAddr); u8 *dst = GetCachePtr() + (_CacheAddr & 0x3FFFF); - if ((dst != NULL) && (src != NULL) && (_MemAddr & 3) == 0 && (_CacheAddr & 3) == 0) + if ((dst != nullptr) && (src != nullptr) && (_MemAddr & 3) == 0 && (_CacheAddr & 3) == 0) { memcpy(dst, src, 32 * _iNumBlocks); } @@ -343,7 +343,7 @@ u8 *GetPointer(const u32 _Address) ERROR_LOG(MEMMAP, "Unknown Pointer %#8x PC %#8x LR %#8x", _Address, PC, LR); - return NULL; + return nullptr; } diff --git a/Source/Core/Core/HW/SI.cpp b/Source/Core/Core/HW/SI.cpp index 6c7d98387d..425cefdd0a 100644 --- a/Source/Core/Core/HW/SI.cpp +++ b/Source/Core/Core/HW/SI.cpp @@ -434,7 +434,7 @@ void GenerateSIInterrupt(SIInterruptType _SIInterrupt) void RemoveDevice(int _iDeviceNumber) { delete g_Channel[_iDeviceNumber].m_pDevice; - g_Channel[_iDeviceNumber].m_pDevice = NULL; + g_Channel[_iDeviceNumber].m_pDevice = nullptr; } void AddDevice(ISIDevice* pDevice) diff --git a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp index 0a56b60b2b..17459b7ab3 100644 --- a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp @@ -117,7 +117,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) case WM_SPACE_REGS2: { const u8 region_offset = (u8)address; - void *region_ptr = NULL; + void *region_ptr = nullptr; int region_size = 0; switch(data[3]) @@ -200,7 +200,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) address &= 0xFEFFFF; u16 size = Common::swap16(rd->size); u8 *const block = new u8[size]; - void *region_ptr = NULL; + void *region_ptr = nullptr; dataRep.push(((data[2]>>1)<<16) + ((data[3])<<8) + addressLO); @@ -948,7 +948,7 @@ void Wiimote::WriteData(const wm_write_data* const wd) address &= 0xFF00FF; const u8 region_offset = (u8)address; - void *region_ptr = NULL; + void *region_ptr = nullptr; int region_size = 0; switch (address >> 16) @@ -1093,7 +1093,7 @@ void Wiimote::ReadData(const wm_read_data* const rd) address &= 0xFF00FF; const u8 region_offset = (u8)address; - void *region_ptr = NULL; + void *region_ptr = nullptr; int region_size = 0; switch (address >> 16) diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp index 1056adb412..e033ab8e50 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp @@ -257,7 +257,7 @@ Wiimote::Wiimote( const unsigned int index ) : m_index(index) , ir_sin(0) , ir_cos(1) -// , m_sound_stream( NULL ) +// , m_sound_stream( nullptr ) { // ---- set up all the controls ---- diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h index 9c6cba4d5a..cda9401623 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h @@ -153,7 +153,7 @@ private: void ReportMode(const wm_report_mode* const dr); void SendAck(const u8 _reportID); - void RequestStatus(const wm_request_status* const rs = NULL); + void RequestStatus(const wm_request_status* const rs = nullptr); void ReadData(const wm_read_data* const rd); void WriteData(const wm_write_data* const wd); void SendReadDataReply(ReadRequest& _request); diff --git a/Source/Core/Core/HW/WiimoteReal/IODummy.cpp b/Source/Core/Core/HW/WiimoteReal/IODummy.cpp index f410a04394..43da262083 100644 --- a/Source/Core/Core/HW/WiimoteReal/IODummy.cpp +++ b/Source/Core/Core/HW/WiimoteReal/IODummy.cpp @@ -22,7 +22,7 @@ void WiimoteScanner::Update() void WiimoteScanner::FindWiimotes(std::vector & found_wiimotes, Wiimote* & found_board) { found_wiimotes.clear(); - found_board = NULL; + found_board = nullptr; } bool WiimoteScanner::IsReady() const diff --git a/Source/Core/Core/HW/WiimoteReal/IONix.cpp b/Source/Core/Core/HW/WiimoteReal/IONix.cpp index 4684aee61a..d37774863d 100644 --- a/Source/Core/Core/HW/WiimoteReal/IONix.cpp +++ b/Source/Core/Core/HW/WiimoteReal/IONix.cpp @@ -19,7 +19,7 @@ WiimoteScanner::WiimoteScanner() , device_sock(-1) { // Get the id of the first bluetooth device. - device_id = hci_get_route(NULL); + device_id = hci_get_route(nullptr); if (device_id < 0) { NOTICE_LOG(WIIMOTE, "Bluetooth not found."); @@ -57,10 +57,10 @@ void WiimoteScanner::FindWiimotes(std::vector & found_wiimotes, Wiimot int const max_infos = 255; inquiry_info scan_infos[max_infos] = {}; auto* scan_infos_ptr = scan_infos; - found_board = NULL; + found_board = nullptr; // Scan for bluetooth devices - int const found_devices = hci_inquiry(device_id, wait_len, max_infos, NULL, &scan_infos_ptr, IREQ_CACHE_FLUSH); + int const found_devices = hci_inquiry(device_id, wait_len, max_infos, nullptr, &scan_infos_ptr, IREQ_CACHE_FLUSH); if (found_devices < 0) { ERROR_LOG(WIIMOTE, "Error searching for bluetooth devices."); @@ -211,7 +211,7 @@ int Wiimote::IORead(u8* buf) FD_SET(int_sock, &fds); FD_SET(wakeup_pipe_r, &fds); - if (select(int_sock + 1, &fds, NULL, NULL, NULL) == -1) + if (select(int_sock + 1, &fds, nullptr, nullptr, nullptr) == -1) { ERROR_LOG(WIIMOTE, "Unable to select wiimote %i input socket.", index + 1); return -1; diff --git a/Source/Core/Core/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/HW/WiimoteReal/IOWin.cpp index d386da1575..760f0b4d46 100644 --- a/Source/Core/Core/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/HW/WiimoteReal/IOWin.cpp @@ -51,25 +51,25 @@ typedef DWORD (__stdcall *PBth_BluetoothSetServiceState)(HANDLE, const BLUETOOTH typedef DWORD (__stdcall *PBth_BluetoothAuthenticateDevice)(HWND, HANDLE, BLUETOOTH_DEVICE_INFO*, PWCHAR, ULONG); typedef DWORD (__stdcall *PBth_BluetoothEnumerateInstalledServices)(HANDLE, BLUETOOTH_DEVICE_INFO*, DWORD*, GUID*); -PHidD_GetHidGuid HidD_GetHidGuid = NULL; -PHidD_GetAttributes HidD_GetAttributes = NULL; -PHidD_SetOutputReport HidD_SetOutputReport = NULL; -PHidD_GetProductString HidD_GetProductString = NULL; +PHidD_GetHidGuid HidD_GetHidGuid = nullptr; +PHidD_GetAttributes HidD_GetAttributes = nullptr; +PHidD_SetOutputReport HidD_SetOutputReport = nullptr; +PHidD_GetProductString HidD_GetProductString = nullptr; -PBth_BluetoothFindDeviceClose Bth_BluetoothFindDeviceClose = NULL; -PBth_BluetoothFindFirstDevice Bth_BluetoothFindFirstDevice = NULL; -PBth_BluetoothFindFirstRadio Bth_BluetoothFindFirstRadio = NULL; -PBth_BluetoothFindNextDevice Bth_BluetoothFindNextDevice = NULL; -PBth_BluetoothFindNextRadio Bth_BluetoothFindNextRadio = NULL; -PBth_BluetoothFindRadioClose Bth_BluetoothFindRadioClose = NULL; -PBth_BluetoothGetRadioInfo Bth_BluetoothGetRadioInfo = NULL; -PBth_BluetoothRemoveDevice Bth_BluetoothRemoveDevice = NULL; -PBth_BluetoothSetServiceState Bth_BluetoothSetServiceState = NULL; -PBth_BluetoothAuthenticateDevice Bth_BluetoothAuthenticateDevice = NULL; -PBth_BluetoothEnumerateInstalledServices Bth_BluetoothEnumerateInstalledServices = NULL; +PBth_BluetoothFindDeviceClose Bth_BluetoothFindDeviceClose = nullptr; +PBth_BluetoothFindFirstDevice Bth_BluetoothFindFirstDevice = nullptr; +PBth_BluetoothFindFirstRadio Bth_BluetoothFindFirstRadio = nullptr; +PBth_BluetoothFindNextDevice Bth_BluetoothFindNextDevice = nullptr; +PBth_BluetoothFindNextRadio Bth_BluetoothFindNextRadio = nullptr; +PBth_BluetoothFindRadioClose Bth_BluetoothFindRadioClose = nullptr; +PBth_BluetoothGetRadioInfo Bth_BluetoothGetRadioInfo = nullptr; +PBth_BluetoothRemoveDevice Bth_BluetoothRemoveDevice = nullptr; +PBth_BluetoothSetServiceState Bth_BluetoothSetServiceState = nullptr; +PBth_BluetoothAuthenticateDevice Bth_BluetoothAuthenticateDevice = nullptr; +PBth_BluetoothEnumerateInstalledServices Bth_BluetoothEnumerateInstalledServices = nullptr; -HINSTANCE hid_lib = NULL; -HINSTANCE bthprops_lib = NULL; +HINSTANCE hid_lib = nullptr; +HINSTANCE bthprops_lib = nullptr; static int initialized = 0; @@ -201,22 +201,22 @@ void WiimoteScanner::FindWiimotes(std::vector & found_wiimotes, Wiimot HidD_GetHidGuid(&device_id); // Get all hid devices connected - HDEVINFO const device_info = SetupDiGetClassDevs(&device_id, NULL, NULL, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT)); + HDEVINFO const device_info = SetupDiGetClassDevs(&device_id, nullptr, nullptr, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT)); SP_DEVICE_INTERFACE_DATA device_data; device_data.cbSize = sizeof(device_data); - PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL; + PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = nullptr; - for (int index = 0; SetupDiEnumDeviceInterfaces(device_info, NULL, &device_id, index, &device_data); ++index) + for (int index = 0; SetupDiEnumDeviceInterfaces(device_info, nullptr, &device_id, index, &device_data); ++index) { // Get the size of the data block required DWORD len; - SetupDiGetDeviceInterfaceDetail(device_info, &device_data, NULL, 0, &len, NULL); + SetupDiGetDeviceInterfaceDetail(device_info, &device_data, nullptr, 0, &len, nullptr); detail_data = (PSP_DEVICE_INTERFACE_DETAIL_DATA)malloc(len); detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); // Query the data for this device - if (SetupDiGetDeviceInterfaceDetail(device_info, &device_data, detail_data, len, NULL, NULL)) + if (SetupDiGetDeviceInterfaceDetail(device_info, &device_data, detail_data, len, nullptr, nullptr)) { auto const wm = new Wiimote; wm->devicepath = detail_data->DevicePath; @@ -250,7 +250,7 @@ void WiimoteScanner::FindWiimotes(std::vector & found_wiimotes, Wiimot int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, size_t size, int attempts) { OVERLAPPED hid_overlap_write = OVERLAPPED(); - hid_overlap_write.hEvent = CreateEvent(NULL, true, false, NULL); + hid_overlap_write.hEvent = CreateEvent(nullptr, true, false, nullptr); enum win_bt_stack_t stack = MSBT_STACK_UNKNOWN; DWORD written = 0; @@ -287,7 +287,7 @@ int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, size_t size, int at int CheckDeviceType_Read(HANDLE &dev_handle, u8* buf, int attempts) { OVERLAPPED hid_overlap_read = OVERLAPPED(); - hid_overlap_read.hEvent = CreateEvent(NULL, true, false, NULL); + hid_overlap_read.hEvent = CreateEvent(nullptr, true, false, nullptr); int read = 0; for (; attempts>0; --attempts) { @@ -318,8 +318,8 @@ void WiimoteScanner::CheckDeviceType(std::basic_string &devicepath, bool HANDLE dev_handle = CreateFile(devicepath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, - NULL); + nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, + nullptr); if (dev_handle == INVALID_HANDLE_VALUE) return; // enable to only check for official nintendo wiimotes/bb's @@ -447,7 +447,7 @@ bool WiimoteScanner::IsReady() const HANDLE hRadio; HBLUETOOTH_RADIO_FIND hFindRadio = Bth_BluetoothFindFirstRadio(&radioParam, &hRadio); - if (NULL != hFindRadio) + if (nullptr != hFindRadio) { Bth_BluetoothFindRadioClose(hFindRadio); return true; @@ -480,7 +480,7 @@ bool Wiimote::ConnectInternal() dev_handle = CreateFile(devicepath.c_str(), GENERIC_READ | GENERIC_WRITE, open_flags, - NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); + nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr); if (dev_handle == INVALID_HANDLE_VALUE) { @@ -549,10 +549,10 @@ void Wiimote::InitInternal() stack = MSBT_STACK_UNKNOWN; hid_overlap_read = OVERLAPPED(); - hid_overlap_read.hEvent = CreateEvent(NULL, true, false, NULL); + hid_overlap_read.hEvent = CreateEvent(nullptr, true, false, nullptr); hid_overlap_write = OVERLAPPED(); - hid_overlap_write.hEvent = CreateEvent(NULL, true, false, NULL); + hid_overlap_write.hEvent = CreateEvent(nullptr, true, false, nullptr); } void Wiimote::TeardownInternal() @@ -620,7 +620,7 @@ int _IORead(HANDLE &dev_handle, OVERLAPPED &hid_overlap_read, u8* buf, int index } } - WiimoteEmu::Spy(NULL, buf, bytes + 1); + WiimoteEmu::Spy(nullptr, buf, bytes + 1); return bytes + 1; } @@ -642,7 +642,7 @@ int Wiimote::IORead(u8* buf) int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, size_t len) { - WiimoteEmu::Spy(NULL, buf, len); + WiimoteEmu::Spy(nullptr, buf, len); switch (stack) { @@ -772,7 +772,7 @@ void ProcessWiimotes(bool new_scan, T& callback) if (false == Bth_BluetoothFindNextDevice(hFindDevice, &btdi)) { Bth_BluetoothFindDeviceClose(hFindDevice); - hFindDevice = NULL; + hFindDevice = nullptr; } } } @@ -780,7 +780,7 @@ void ProcessWiimotes(bool new_scan, T& callback) if (false == Bth_BluetoothFindNextRadio(hFindRadio, &hRadio)) { Bth_BluetoothFindRadioClose(hFindRadio); - hFindRadio = NULL; + hFindRadio = nullptr; } } } @@ -810,7 +810,7 @@ bool AttachWiimote(HANDLE hRadio, const BLUETOOTH_RADIO_INFO& radio_info, BLUETO #if defined(AUTHENTICATE_WIIMOTES) // Authenticate auto const& radio_addr = radio_info.address.rgBytes; - const DWORD auth_result = Bth_BluetoothAuthenticateDevice(NULL, hRadio, &btdi, + const DWORD auth_result = Bth_BluetoothAuthenticateDevice(nullptr, hRadio, &btdi, std::vector(radio_addr, radio_addr + 6).data(), 6); if (ERROR_SUCCESS != auth_result) diff --git a/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm index 8ac433a095..92d57535b5 100644 --- a/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm +++ b/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm @@ -40,19 +40,19 @@ length: (NSUInteger) length { IOBluetoothDevice *device = [l2capChannel device]; - WiimoteReal::Wiimote *wm = NULL; + WiimoteReal::Wiimote *wm = nullptr; std::lock_guard lk(WiimoteReal::g_refresh_lock); for (int i = 0; i < MAX_WIIMOTES; i++) { - if (WiimoteReal::g_wiimotes[i] == NULL) + if (WiimoteReal::g_wiimotes[i] == nullptr) continue; if ([device isEqual: WiimoteReal::g_wiimotes[i]->btd] == TRUE) wm = WiimoteReal::g_wiimotes[i]; } - if (wm == NULL) { + if (wm == nullptr) { ERROR_LOG(WIIMOTE, "Received packet for unknown wiimote"); return; } @@ -79,19 +79,19 @@ - (void) l2capChannelClosed: (IOBluetoothL2CAPChannel *) l2capChannel { IOBluetoothDevice *device = [l2capChannel device]; - WiimoteReal::Wiimote *wm = NULL; + WiimoteReal::Wiimote *wm = nullptr; std::lock_guard lk(WiimoteReal::g_refresh_lock); for (int i = 0; i < MAX_WIIMOTES; i++) { - if (WiimoteReal::g_wiimotes[i] == NULL) + if (WiimoteReal::g_wiimotes[i] == nullptr) continue; if ([device isEqual: WiimoteReal::g_wiimotes[i]->btd] == TRUE) wm = WiimoteReal::g_wiimotes[i]; } - if (wm == NULL) { + if (wm == nullptr) { ERROR_LOG(WIIMOTE, "Channel for unknown wiimote was closed"); return; } @@ -123,7 +123,7 @@ void WiimoteScanner::FindWiimotes(std::vector & found_wiimotes, Wiimot IOBluetoothDeviceInquiry *bti; SearchBT *sbt; NSEnumerator *en; - found_board = NULL; + found_board = nullptr; bth = [[IOBluetoothHostController alloc] init]; if ([bth addressAsString] == nil) @@ -191,7 +191,7 @@ void Wiimote::InitInternal() { inputlen = 0; m_connected = false; - m_wiimote_thread_run_loop = NULL; + m_wiimote_thread_run_loop = nullptr; btd = nil; } @@ -200,7 +200,7 @@ void Wiimote::TeardownInternal() if (m_wiimote_thread_run_loop) { CFRelease(m_wiimote_thread_run_loop); - m_wiimote_thread_run_loop = NULL; + m_wiimote_thread_run_loop = nullptr; } [btd release]; btd = nil; diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp index b185f62549..0df6799e53 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp @@ -445,7 +445,7 @@ void WiimoteScanner::ThreadFunc() while (m_run_thread) { std::vector found_wiimotes; - Wiimote* found_board = NULL; + Wiimote* found_board = nullptr; //NOTICE_LOG(WIIMOTE, "In loop"); @@ -592,7 +592,7 @@ void Initialize(bool wait) { int timeout = 100; std::vector found_wiimotes; - Wiimote* found_board = NULL; + Wiimote* found_board = nullptr; g_wiimote_scanner.FindWiimotes(found_wiimotes, found_board); if (SConfig::GetInstance().m_WiimoteContinuousScanning) { @@ -694,7 +694,7 @@ void TryToConnectWiimote(Wiimote* wm) { if (TryToConnectWiimoteN(wm, i)) { - wm = NULL; + wm = nullptr; break; } } @@ -712,7 +712,7 @@ void TryToConnectBalanceBoard(Wiimote* wm) if (TryToConnectWiimoteN(wm, WIIMOTE_BALANCE_BOARD)) { - wm = NULL; + wm = nullptr; } g_wiimote_scanner.WantBB(0 != CalculateWantedBB()); @@ -730,7 +730,7 @@ void DoneWithWiimote(int index) if (wm) { - g_wiimotes[index] = NULL; + g_wiimotes[index] = nullptr; // First see if we can use this real Wiimote in another slot. TryToConnectWiimote(wm); } @@ -741,7 +741,7 @@ void DoneWithWiimote(int index) void HandleWiimoteDisconnect(int index) { - Wiimote* wm = NULL; + Wiimote* wm = nullptr; { std::lock_guard lk(g_refresh_lock); @@ -771,7 +771,7 @@ void Refresh() { std::unique_lock lk(g_refresh_lock); std::vector found_wiimotes; - Wiimote* found_board = NULL; + Wiimote* found_board = nullptr; if (0 != CalculateWantedWiimotes() || 0 != CalculateWantedBB()) { diff --git a/Source/Core/Core/IPC_HLE/ICMPWin.cpp b/Source/Core/Core/IPC_HLE/ICMPWin.cpp index 07610673ea..585cd874d6 100644 --- a/Source/Core/Core/IPC_HLE/ICMPWin.cpp +++ b/Source/Core/Core/IPC_HLE/ICMPWin.cpp @@ -82,7 +82,7 @@ int icmp_echo_rep(const u32 s, sockaddr_in *addr, const u32 timeout, const u32 d timeval t; t.tv_sec = timeout / 1000; - if (select(0, &read_fds, NULL, NULL, &t) > 0) + if (select(0, &read_fds, nullptr, nullptr, &t) > 0) { num_bytes = recvfrom((SOCKET)s, (LPSTR)workspace, IP_HDR_LEN + ICMP_HDR_LEN + data_length, diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp index 9f99bf404a..e0726ae44a 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp @@ -95,7 +95,7 @@ void Init() for (IWII_IPC_HLE_Device*& dev : g_FdMap) { - dev = NULL; + dev = nullptr; } u32 i = 0; @@ -139,14 +139,14 @@ void Reset(bool _bHard) for (IWII_IPC_HLE_Device*& dev : g_FdMap) { - if (dev != NULL && !dev->IsHardware()) + if (dev != nullptr && !dev->IsHardware()) { // close all files and delete their resources dev->Close(0, true); delete dev; } - dev = NULL; + dev = nullptr; } for (bool& in_use : es_inuse) @@ -214,7 +214,7 @@ int getFreeDeviceId() { for (u32 i=0; i(Memory::Read_U32(_Address)); volatile s32 DeviceID = Memory::Read_U32(_Address + 8); - IWII_IPC_HLE_Device* pDevice = (DeviceID >= 0 && DeviceID < IPC_MAX_FDS) ? g_FdMap[DeviceID] : NULL; + IWII_IPC_HLE_Device* pDevice = (DeviceID >= 0 && DeviceID < IPC_MAX_FDS) ? g_FdMap[DeviceID] : nullptr; INFO_LOG(WII_IPC_HLE, "-->> Execute Command Address: 0x%08x (code: %x, device: %x) %p", _Address, Command, DeviceID, pDevice); @@ -420,7 +420,7 @@ void ExecuteCommand(u32 _Address) else { delete pDevice; - pDevice = NULL; + pDevice = nullptr; } } } @@ -445,13 +445,13 @@ void ExecuteCommand(u32 _Address) } } - g_FdMap[DeviceID] = NULL; + g_FdMap[DeviceID] = nullptr; // Don't delete hardware if (!pDevice->IsHardware()) { delete pDevice; - pDevice = NULL; + pDevice = nullptr; } } else diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.cpp index 803caf5362..6e2f2ed94d 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.cpp @@ -29,7 +29,7 @@ using namespace DVDInterface; CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName ) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) - , m_pFileSystem(NULL) + , m_pFileSystem(nullptr) , m_ErrorStatus(0) , m_CoverStatus(DI_COVER_REG_NO_DISC) {} @@ -39,7 +39,7 @@ CWII_IPC_HLE_Device_di::~CWII_IPC_HLE_Device_di() if (m_pFileSystem) { delete m_pFileSystem; - m_pFileSystem = NULL; + m_pFileSystem = nullptr; } } @@ -61,7 +61,7 @@ bool CWII_IPC_HLE_Device_di::Close(u32 _CommandAddress, bool _bForce) if (m_pFileSystem) { delete m_pFileSystem; - m_pFileSystem = NULL; + m_pFileSystem = nullptr; } m_ErrorStatus = 0; if (!_bForce) @@ -159,7 +159,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 if(m_pFileSystem && !VolumeHandler::IsValid()) { delete m_pFileSystem; - m_pFileSystem = NULL; + m_pFileSystem = nullptr; m_CoverStatus |= DI_COVER_REG_NO_DISC; } @@ -201,10 +201,10 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 // Don't do anything if the log is unselected if (LogManager::GetInstance()->IsEnabled(LogTypes::FILEMON)) { - const char *pFilename = NULL; + const char *pFilename = nullptr; if (m_pFileSystem) pFilename = m_pFileSystem->GetFileName(DVDAddress); - if (pFilename != NULL) + if (pFilename != nullptr) { INFO_LOG(WII_IPC_DVD, "DVDLowRead: %s (0x%" PRIx64 ") - (DVDAddr: 0x%" PRIx64 ", Size: 0x%x)", pFilename, m_pFileSystem->GetFileSize(pFilename), DVDAddress, Size); @@ -339,10 +339,10 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 case DVDLowSeek: { u64 DVDAddress = Memory::Read_U32(_BufferIn + 0x4) << 2; - const char *pFilename = NULL; + const char *pFilename = nullptr; if (m_pFileSystem) pFilename = m_pFileSystem->GetFileName(DVDAddress); - if (pFilename != NULL) + if (pFilename != nullptr) { INFO_LOG(WII_IPC_DVD, "DVDLowSeek: %s (0x%" PRIx64 ") - (DVDAddr: 0x%" PRIx64 ")", pFilename, m_pFileSystem->GetFileSize(pFilename), DVDAddress); diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp index a64cfdc72a..c34f6affbe 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -61,7 +61,7 @@ std::string CWII_IPC_HLE_Device_es::m_ContentFile; CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) - , m_pContentLoader(NULL) + , m_pContentLoader(nullptr) , m_TitleID(-1) , m_AccessIdentID(0x6000000) { @@ -190,7 +190,7 @@ bool CWII_IPC_HLE_Device_es::Close(u32 _CommandAddress, bool _bForce) delete pair.second.m_pFile; } m_ContentAccessMap.clear(); - m_pContentLoader = NULL; + m_pContentLoader = nullptr; m_TitleIDs.clear(); m_TitleID = -1; m_AccessIdentID = 0x6000000; @@ -214,7 +214,7 @@ u32 CWII_IPC_HLE_Device_es::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index) const DiscIO::SNANDContent* pContent = Loader.GetContentByIndex(Index); - if (pContent == NULL) + if (pContent == nullptr) { return 0xffffffff; //TODO: what is the correct error value here? } @@ -223,7 +223,7 @@ u32 CWII_IPC_HLE_Device_es::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index) Access.m_Position = 0; Access.m_pContent = pContent; Access.m_TitleID = TitleID; - Access.m_pFile = NULL; + Access.m_pFile = nullptr; if (!pContent->m_pData) { @@ -393,7 +393,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) } SContentAccess& rContent = itr->second; - _dbg_assert_(WII_IPC_ES, rContent.m_pContent->m_pData != NULL); + _dbg_assert_(WII_IPC_ES, rContent.m_pContent->m_pData != nullptr); u8* pDest = Memory::GetPointer(Addr); diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp index fbc213c80f..723bab998c 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp @@ -138,7 +138,7 @@ bool CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress) break; std::string name, ext; - SplitPath(FileSearch.GetFileNames()[i], NULL, &name, &ext); + SplitPath(FileSearch.GetFileNames()[i], nullptr, &name, &ext); std::string FileName = name + ext; // Decode entities of invalid file system characters so that diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp index 19fa865055..35519e9697 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp @@ -41,7 +41,7 @@ void CWII_IPC_HLE_Device_hid::checkUsbUpdates(CWII_IPC_HLE_Device_hid* hid) } } timeToFill+=8; - libusb_handle_events_timeout(NULL, &tv); + libusb_handle_events_timeout(nullptr, &tv); } return; @@ -73,7 +73,7 @@ CWII_IPC_HLE_Device_hid::CWII_IPC_HLE_Device_hid(u32 _DeviceID, const std::strin { deviceCommandAddress = 0; memset(hidDeviceAliases, 0, sizeof(hidDeviceAliases)); - int ret = libusb_init(NULL); + int ret = libusb_init(nullptr); if (ret) { ERROR_LOG(WII_IPC_HID, "libusb_init failed with error: %d", ret); @@ -102,7 +102,7 @@ CWII_IPC_HLE_Device_hid::~CWII_IPC_HLE_Device_hid() open_devices.clear(); if (deinit_libusb) - libusb_exit(NULL); + libusb_exit(nullptr); } bool CWII_IPC_HLE_Device_hid::Open(u32 _CommandAddress, u32 _Mode) @@ -190,7 +190,7 @@ bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress) libusb_device_handle * dev_handle = GetDeviceByDevNum(dev_num); - if (dev_handle == NULL) + if (dev_handle == nullptr) { DEBUG_LOG(WII_IPC_HID, "Could not find handle: %X", dev_num); break; @@ -223,7 +223,7 @@ bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress) libusb_device_handle * dev_handle = GetDeviceByDevNum(dev_num); - if (dev_handle == NULL) + if (dev_handle == nullptr) { DEBUG_LOG(WII_IPC_HID, "Could not find handle: %X", dev_num); break; @@ -359,8 +359,8 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize) int d,c,ic,i,e; /* config, interface container, interface, endpoint */ libusb_device **list; - //libusb_device *found = NULL; - ssize_t cnt = libusb_get_device_list(NULL, &list); + //libusb_device *found = nullptr; + ssize_t cnt = libusb_get_device_list(nullptr, &list); DEBUG_LOG(WII_IPC_HID, "Found %ld viable USB devices.", cnt); for (d = 0; d < cnt; d++) { @@ -387,7 +387,7 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize) for (c = 0; deviceValid && c < desc.bNumConfigurations; c++) { - struct libusb_config_descriptor *config = NULL; + struct libusb_config_descriptor *config = nullptr; int cRet = libusb_get_config_descriptor(device, c, &config); // do not try to use usb devices with more than one interface, games can crash if(cRet == 0 && config->bNumInterfaces <= MAX_HID_INTERFACES) @@ -426,7 +426,7 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize) } // interfaces } // interface containters libusb_free_config_descriptor(config); - config = NULL; + config = nullptr; } else { @@ -502,11 +502,11 @@ int CWII_IPC_HLE_Device_hid::Align(int num, int alignment) libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum) { libusb_device **list; - libusb_device_handle *handle = NULL; + libusb_device_handle *handle = nullptr; ssize_t cnt; if(devNum >= MAX_DEVICE_DEVNUM) - return NULL; + return nullptr; std::lock_guard lk(s_open_devices); @@ -525,10 +525,10 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum) } } - cnt = libusb_get_device_list(NULL, &list); + cnt = libusb_get_device_list(nullptr, &list); if (cnt < 0) - return NULL; + return nullptr; #ifdef _WIN32 static bool has_warned_about_drivers = false; @@ -596,7 +596,7 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum) } else { - handle = NULL; + handle = nullptr; } } diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp index 0eafb732b4..d66207a822 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp @@ -864,9 +864,9 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress) Memory::Write_U32(Common::swap32(*(u32 *)remoteHost->h_addr_list[0]), BufferOut); INFO_LOG(WII_IPC_NET, "IOCTL_SO_INETATON = %d " - "%s, BufferIn: (%08x, %i), BufferOut: (%08x, %i), IP Found: %08X",remoteHost->h_addr_list[0] == 0 ? -1 : 0, + "%s, BufferIn: (%08x, %i), BufferOut: (%08x, %i), IP Found: %08X",remoteHost->h_addr_list[0] == nullptr ? -1 : 0, (char*)Memory::GetPointer(BufferIn), BufferIn, BufferInSize, BufferOut, BufferOutSize, Common::swap32(*(u32 *)remoteHost->h_addr_list[0])); - ReturnValue = remoteHost->h_addr_list[0] == 0 ? 0 : 1; + ReturnValue = remoteHost->h_addr_list[0] == nullptr ? 0 : 1; break; } @@ -913,7 +913,7 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress) ERROR_LOG(WII_IPC_NET, "Hidden POLL"); pollfd_t* ufds = (pollfd_t *)malloc(sizeof(pollfd_t) * nfds); - if (ufds == NULL) + if (ufds == nullptr) { ReturnValue = -1; break; @@ -1008,7 +1008,7 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress) Memory::Write_U32(wii_addr, BufferOut + 4); Memory::Write_U32(wii_addr + sizeof(u32), wii_addr); wii_addr += sizeof(u32); - Memory::Write_U32((u32)NULL, wii_addr); + Memory::Write_U32(0, wii_addr); wii_addr += sizeof(u32); // hardcode to ipv4 @@ -1028,8 +1028,8 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress) Memory::Write_U32(wii_addr + sizeof(u32) * (num_addr + 1), wii_addr); wii_addr += sizeof(u32); } - // NULL terminated list - Memory::Write_U32((u32)NULL, wii_addr); + // null-terminated list + Memory::Write_U32(0, wii_addr); wii_addr += sizeof(u32); // The actual IPs for (int i = 0; remoteHost->h_addr_list[i]; i++) @@ -1144,7 +1144,7 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress) { u32 address = 0; #ifdef _WIN32 - PIP_ADAPTER_ADDRESSES AdapterAddresses = NULL; + PIP_ADAPTER_ADDRESSES AdapterAddresses = nullptr; ULONG OutBufferLength = 0; ULONG RetVal = 0, i; for (i = 0; i < 5; i++) @@ -1152,7 +1152,7 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress) RetVal = GetAdaptersAddresses( AF_INET, 0, - NULL, + nullptr, AdapterAddresses, &OutBufferLength); @@ -1160,12 +1160,12 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress) break; } - if (AdapterAddresses != NULL) { + if (AdapterAddresses != nullptr) { FREE(AdapterAddresses); } AdapterAddresses = (PIP_ADAPTER_ADDRESSES)MALLOC(OutBufferLength); - if (AdapterAddresses == NULL) { + if (AdapterAddresses == nullptr) { RetVal = GetLastError(); break; } @@ -1197,7 +1197,7 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress) } } } - if (AdapterAddresses != NULL) { + if (AdapterAddresses != nullptr) { FREE(AdapterAddresses); } #endif @@ -1253,7 +1253,7 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress) case IOCTLV_SO_GETADDRINFO: { struct addrinfo hints; - struct addrinfo *result = NULL; + struct addrinfo *result = nullptr; if (BufferInSize3) { @@ -1262,25 +1262,25 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress) hints.ai_socktype = Memory::Read_U32(_BufferIn3 + 0x8); hints.ai_protocol = Memory::Read_U32(_BufferIn3 + 0xC); hints.ai_addrlen = Memory::Read_U32(_BufferIn3 + 0x10); - hints.ai_canonname = NULL; - hints.ai_addr = NULL; - hints.ai_next = NULL; + hints.ai_canonname = nullptr; + hints.ai_addr = nullptr; + hints.ai_next = nullptr; } - char* pNodeName = NULL; + char* pNodeName = nullptr; if (BufferInSize > 0) pNodeName = (char*)Memory::GetPointer(_BufferIn); - char* pServiceName = NULL; + char* pServiceName = nullptr; if (BufferInSize2 > 0) pServiceName = (char*)Memory::GetPointer(_BufferIn2); - int ret = getaddrinfo(pNodeName, pServiceName, BufferInSize3 ? &hints : NULL, &result); + int ret = getaddrinfo(pNodeName, pServiceName, BufferInSize3 ? &hints : nullptr, &result); u32 addr = _BufferOut; u32 sockoffset = addr + 0x460; if (ret == 0) { - while (result != NULL) + while (result != nullptr) { Memory::Write_U32(result->ai_flags, addr); Memory::Write_U32(result->ai_family, addr + 0x04); diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp index cf033d69de..827fbd1d47 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp @@ -260,7 +260,7 @@ _SSL_NEW_ERROR: } else { - ssl_set_ca_chain(&ssl->ctx, &ssl->cacert, NULL, ssl->hostname); + ssl_set_ca_chain(&ssl->ctx, &ssl->cacert, nullptr, ssl->hostname); Memory::Write_U32(SSL_OK, _BufferIn); } @@ -288,7 +288,7 @@ _SSL_NEW_ERROR: WII_SSL* ssl = &_SSL[sslID]; std::string cert_base_path(File::GetUserPath(D_WIIUSER_IDX)); int ret = x509_crt_parse_file(&ssl->clicert, (cert_base_path + "clientca.pem").c_str()); - int pk_ret = pk_parse_keyfile(&ssl->pk, (cert_base_path + "clientcakey.pem").c_str(), NULL); + int pk_ret = pk_parse_keyfile(&ssl->pk, (cert_base_path + "clientcakey.pem").c_str(), nullptr); if (ret || pk_ret) { x509_crt_free(&ssl->clicert); @@ -331,7 +331,7 @@ _SSL_NEW_ERROR: memset(&ssl->clicert, 0, sizeof(x509_crt)); memset(&ssl->pk, 0, sizeof(pk_context)); - ssl_set_own_cert(&ssl->ctx, NULL, NULL); + ssl_set_own_cert(&ssl->ctx, nullptr, nullptr); Memory::Write_U32(SSL_OK, _BufferIn); } else @@ -357,7 +357,7 @@ _SSL_NEW_ERROR: } else { - ssl_set_ca_chain(&ssl->ctx, &ssl->cacert, NULL, ssl->hostname); + ssl_set_ca_chain(&ssl->ctx, &ssl->cacert, nullptr, ssl->hostname); Memory::Write_U32(SSL_OK, _BufferIn); } INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SETBUILTINROOTCA = %d", ret); diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp index 25e4f8283b..1114939532 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp @@ -18,7 +18,7 @@ CWII_IPC_HLE_Device_sdio_slot0::CWII_IPC_HLE_Device_sdio_slot0(u32 _DeviceID, co , m_Status(CARD_NOT_EXIST) , m_BlockLength(0) , m_BusWidth(0) - , m_Card(NULL) + , m_Card(nullptr) {} void CWII_IPC_HLE_Device_sdio_slot0::DoState(PointerWrap& p) diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.cpp index bcc83c8078..df6f797e33 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.cpp @@ -90,7 +90,7 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _De CWII_IPC_HLE_Device_usb_oh1_57e_305::~CWII_IPC_HLE_Device_usb_oh1_57e_305() { m_WiiMotes.clear(); - SetUsbPointer(NULL); + SetUsbPointer(nullptr); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p) @@ -299,7 +299,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress) void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendToDevice(u16 _ConnectionHandle, u8* _pData, u32 _Size) { CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_ConnectionHandle); - if (pWiiMote == NULL) + if (pWiiMote == nullptr) return; INFO_LOG(WII_IPC_WIIMOTE, "Send ACL Packet to ConnectionHandle 0x%04x", _ConnectionHandle); @@ -584,7 +584,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryResponse() bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(const bdaddr_t& _bd) { CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_bd); - if (pWiiMote == NULL) + if (pWiiMote == nullptr) return false; SQueuedEvent Event(sizeof(SHCIEventConnectionComplete), 0); @@ -662,7 +662,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection(CWII_IPC_HL bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventDisconnect(u16 _connectionHandle, u8 _Reason) { CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle); - if (pWiiMote == NULL) + if (pWiiMote == nullptr) return false; SQueuedEvent Event(sizeof(SHCIEventDisconnectCompleted), _connectionHandle); @@ -686,7 +686,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventDisconnect(u16 _connectionHan bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventAuthenticationCompleted(u16 _connectionHandle) { CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle); - if (pWiiMote == NULL) + if (pWiiMote == nullptr) return false; SQueuedEvent Event(sizeof(SHCIEventAuthenticationCompleted), _connectionHandle); @@ -708,7 +708,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventAuthenticationCompleted(u16 _ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRemoteNameReq(const bdaddr_t& _bd) { CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_bd); - if (pWiiMote == NULL) + if (pWiiMote == nullptr) return false; SQueuedEvent Event(sizeof(SHCIEventRemoteNameReq), 0); @@ -735,7 +735,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRemoteNameReq(const bdaddr_t& bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteFeatures(u16 _connectionHandle) { CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle); - if (pWiiMote == NULL) + if (pWiiMote == nullptr) return false; SQueuedEvent Event(sizeof(SHCIEventReadRemoteFeatures), _connectionHandle); @@ -770,7 +770,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteFeatures(u16 _conne bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteVerInfo(u16 _connectionHandle) { CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle); - if (pWiiMote == NULL) + if (pWiiMote == nullptr) return false; SQueuedEvent Event(sizeof(SHCIEventReadRemoteVerInfo), _connectionHandle); @@ -808,7 +808,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandComplete(u16 _OpCode, pHCIEvent->Opcode = _OpCode; // add the payload - if ((_pData != NULL) && (_DataSize > 0)) + if ((_pData != nullptr) && (_DataSize > 0)) { u8* pPayload = Event.m_buffer + sizeof(SHCIEventCommand); memcpy(pPayload, _pData, _DataSize); @@ -840,7 +840,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandStatus(u16 _Opcode) bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRoleChange(bdaddr_t _bd, bool _master) { CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_bd); - if (pWiiMote == NULL) + if (pWiiMote == nullptr) return false; SQueuedEvent Event(sizeof(SHCIEventRoleChange), 0); @@ -910,7 +910,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets() bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value) { CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle); - if (pWiiMote == NULL) + if (pWiiMote == nullptr) return false; SQueuedEvent Event(sizeof(SHCIEventModeChange), _connectionHandle); @@ -988,7 +988,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestLinkKey(const bdaddr_t bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadClockOffsetComplete(u16 _connectionHandle) { CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle); - if (pWiiMote == NULL) + if (pWiiMote == nullptr) return false; SQueuedEvent Event(sizeof(SHCIEventReadClockOffsetComplete), _connectionHandle); @@ -1012,7 +1012,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadClockOffsetComplete(u16 _ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConPacketTypeChange(u16 _connectionHandle, u16 _packetType) { CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle); - if (pWiiMote == NULL) + if (pWiiMote == nullptr) return false; SQueuedEvent Event(sizeof(SHCIEventConPacketTypeChange), _connectionHandle); @@ -1195,7 +1195,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom default: // send fake okay msg... - SendEventCommandComplete(pMsg->Opcode, NULL, 0); + SendEventCommandComplete(pMsg->Opcode, nullptr, 0); if (ogf == HCI_OGF_VENDOR) { @@ -1536,7 +1536,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandDeleteStoredLinkKey(u8* _Input) CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(pDeleteStoredLinkKey->bdaddr); - if (pWiiMote == NULL) + if (pWiiMote == nullptr) return; hci_delete_stored_link_key_rp Reply; @@ -1832,7 +1832,7 @@ CWII_IPC_HLE_WiiMote* CWII_IPC_HLE_Device_usb_oh1_57e_305::AccessWiiMote(const b ERROR_LOG(WII_IPC_WIIMOTE,"Can't find WiiMote by bd: %02x:%02x:%02x:%02x:%02x:%02x", _rAddr.b[0], _rAddr.b[1], _rAddr.b[2], _rAddr.b[3], _rAddr.b[4], _rAddr.b[5]); - return NULL; + return nullptr; } CWII_IPC_HLE_WiiMote* CWII_IPC_HLE_Device_usb_oh1_57e_305::AccessWiiMote(u16 _ConnectionHandle) @@ -1845,7 +1845,7 @@ CWII_IPC_HLE_WiiMote* CWII_IPC_HLE_Device_usb_oh1_57e_305::AccessWiiMote(u16 _Co ERROR_LOG(WII_IPC_WIIMOTE, "Can't find WiiMote by connection handle %02x", _ConnectionHandle); PanicAlertT("Can't find WiiMote by connection handle %02x", _ConnectionHandle); - return NULL; + return nullptr; } void CWII_IPC_HLE_Device_usb_oh1_57e_305::LOG_LinkKey(const u8* _pLinkKey) diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp index f1a468259c..fdd7b8eb1b 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp @@ -34,7 +34,7 @@ bool CWII_IPC_HLE_Device_usb_kbd::Open(u32 _CommandAddress, u32 _Mode) m_OldModifiers = 0x00; - //m_MessageQueue.push(SMessageData(MSG_KBD_CONNECT, 0, NULL)); + //m_MessageQueue.push(SMessageData(MSG_KBD_CONNECT, 0, nullptr)); Memory::Write_U32(m_DeviceID, _CommandAddress+4); m_Active = true; return true; diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.cpp index 9eb3b778b1..072531ad10 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.cpp @@ -14,7 +14,7 @@ #include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h" #include "Core/IPC_HLE/WiiMote_HID_Attr.h" -static CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb = NULL; +static CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb = nullptr; CWII_IPC_HLE_Device_usb_oh1_57e_305* GetUsbPointer() { @@ -198,7 +198,7 @@ void CWII_IPC_HLE_WiiMote::EventConnectionAccepted() void CWII_IPC_HLE_WiiMote::EventDisconnect() { // Send disconnect message to plugin - Wiimote::ControlChannel(m_ConnectionHandle & 0xFF, 99, NULL, 0); + Wiimote::ControlChannel(m_ConnectionHandle & 0xFF, 99, nullptr, 0); m_ConnectionState = CONN_INACTIVE; // Clear channel flags diff --git a/Source/Core/Core/IPC_HLE/WII_Socket.cpp b/Source/Core/Core/IPC_HLE/WII_Socket.cpp index d036a88c3d..63e0130b56 100644 --- a/Source/Core/Core/IPC_HLE/WII_Socket.cpp +++ b/Source/Core/Core/IPC_HLE/WII_Socket.cpp @@ -29,8 +29,8 @@ char* WiiSockMan::DecodeError(s32 ErrorCode) // instead of a static buffer here. // (And of course, free the buffer when we were done with it) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | - FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, ErrorCode, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)Message, 1024, NULL); + FORMAT_MESSAGE_MAX_WIDTH_MASK, nullptr, ErrorCode, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)Message, 1024, nullptr); return Message; #else return strerror(ErrorCode); @@ -242,7 +242,7 @@ void WiiSocket::update(bool read, bool write, bool except) } else { - int ret = (s32)accept(fd, NULL, 0); + int ret = (s32)accept(fd, nullptr, 0); ReturnValue = WiiSockMan::getNetErrorCode(ret, "SO_ACCEPT", true); } @@ -440,7 +440,7 @@ void WiiSocket::update(bool read, bool write, bool except) } int ret = sendto(fd, data, BufferInSize, flags, - has_destaddr ? (struct sockaddr*)&local_name : NULL, + has_destaddr ? (struct sockaddr*)&local_name : nullptr, has_destaddr ? sizeof(sockaddr) : 0); ReturnValue = WiiSockMan::getNetErrorCode(ret, "SO_SENDTO", true); @@ -486,8 +486,8 @@ void WiiSocket::update(bool read, bool write, bool except) #endif socklen_t addrlen = sizeof(sockaddr_in); int ret = recvfrom(fd, data, data_len, flags, - BufferOutSize2 ? (struct sockaddr*) &local_name : NULL, - BufferOutSize2 ? &addrlen : 0); + BufferOutSize2 ? (struct sockaddr*) &local_name : nullptr, + BufferOutSize2 ? &addrlen : nullptr); ReturnValue = WiiSockMan::getNetErrorCode(ret, BufferOutSize2 ? "SO_RECVFROM" : "SO_RECV", true); INFO_LOG(WII_IPC_NET, "%s(%d, %p) Socket: %08X, Flags: %08X, " diff --git a/Source/Core/Core/IPC_HLE/WiiMote_HID_Attr.cpp b/Source/Core/Core/IPC_HLE/WiiMote_HID_Attr.cpp index 00cc60b7a2..a626ab05cd 100644 --- a/Source/Core/Core/IPC_HLE/WiiMote_HID_Attr.cpp +++ b/Source/Core/Core/IPC_HLE/WiiMote_HID_Attr.cpp @@ -234,7 +234,7 @@ const u8* GetAttribPacket(u32 serviceHandle, u32 cont, u32& _size) return packet4_0x10001; } - return 0; + return nullptr; } // XXX keep these? diff --git a/Source/Core/Core/IPC_HLE/fakepoll.h b/Source/Core/Core/IPC_HLE/fakepoll.h index 384f0b5567..0a521485ae 100644 --- a/Source/Core/Core/IPC_HLE/fakepoll.h +++ b/Source/Core/Core/IPC_HLE/fakepoll.h @@ -60,10 +60,10 @@ inline int poll(struct pollfd *pollSet, int pollCount, int pollTimeout) int maxFD; if (!pollSet) { - pollEnd = NULL; - readp = NULL; - writep = NULL; - exceptp = NULL; + pollEnd = nullptr; + readp = nullptr; + writep = nullptr; + exceptp = nullptr; maxFD = 0; } else { @@ -97,14 +97,14 @@ inline int poll(struct pollfd *pollSet, int pollCount, int pollTimeout) } // poll timeout is in milliseconds. Convert to struct timeval. - // poll timeout == -1 : wait forever : select timeout of NULL + // poll timeout == -1 : wait forever : select timeout of nullptr // poll timeout == 0 : return immediately : select timeout of zero if (pollTimeout >= 0) { tv.tv_sec = pollTimeout / 1000; tv.tv_usec = (pollTimeout % 1000) * 1000; tvp = &tv; } else { - tvp = NULL; + tvp = nullptr; } diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 67b14fb131..2056d72243 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -45,7 +45,7 @@ u32 g_framesToSkip = 0, g_frameSkipCounter = 0; u8 g_numPads = 0; ControllerState g_padState; DTMHeader tmpHeader; -u8* tmpInput = NULL; +u8* tmpInput = nullptr; size_t tmpInputAllocated = 0; u64 g_currentByte = 0, g_totalBytes = 0; u64 g_currentFrame = 0, g_totalFrames = 0; // VI @@ -72,7 +72,7 @@ std::string tmpStateFilename = File::GetUserPath(D_STATESAVES_IDX) + "dtm.sav"; std::string g_InputDisplay[8]; -ManipFunction mfunc = NULL; +ManipFunction mfunc = nullptr; void EnsureTmpInputSize(size_t bound) { @@ -86,7 +86,7 @@ void EnsureTmpInputSize(size_t bound) u8* newTmpInput = new u8[newAlloc]; tmpInputAllocated = newAlloc; - if (tmpInput != NULL) + if (tmpInput != nullptr) { if (g_totalBytes > 0) memcpy(newTmpInput, tmpInput, (size_t)g_totalBytes); @@ -654,9 +654,9 @@ void RecordInput(SPADStatus *PadStatus, int controllerID) void CheckWiimoteStatus(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf, int irMode) { - u8* const coreData = rptf.core?(data+rptf.core):NULL; - u8* const accelData = rptf.accel?(data+rptf.accel):NULL; - u8* const irData = rptf.ir?(data+rptf.ir):NULL; + u8* const coreData = rptf.core?(data+rptf.core):nullptr; + u8* const accelData = rptf.accel?(data+rptf.accel):nullptr; + u8* const irData = rptf.ir?(data+rptf.ir):nullptr; u8 size = rptf.size; SetWiiInputDisplayString(wiimote, coreData, accelData, irData); @@ -819,7 +819,7 @@ void LoadInput(const char *filename) afterEnd = true; } - if (!g_bReadOnly || tmpInput == NULL) + if (!g_bReadOnly || tmpInput == nullptr) { g_totalFrames = tmpHeader.frameCount; g_totalLagCount = tmpHeader.lagCount; @@ -926,7 +926,7 @@ void PlayController(SPADStatus *PadStatus, int controllerID) { // Correct playback is entirely dependent on the emulator polling the controllers // in the same order done during recording - if (!IsPlayingInput() || !IsUsingPad(controllerID) || tmpInput == NULL) + if (!IsPlayingInput() || !IsUsingPad(controllerID) || tmpInput == nullptr) return; if (g_currentByte + 8 > g_totalBytes) @@ -1022,7 +1022,7 @@ void PlayController(SPADStatus *PadStatus, int controllerID) bool PlayWiimote(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf, int irMode) { - if(!IsPlayingInput() || !IsUsingWiimote(wiimote) || tmpInput == NULL) + if(!IsPlayingInput() || !IsUsingWiimote(wiimote) || tmpInput == nullptr) return false; if (g_currentByte > g_totalBytes) @@ -1032,9 +1032,9 @@ bool PlayWiimote(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf, return false; } - u8* const coreData = rptf.core?(data+rptf.core):NULL; - u8* const accelData = rptf.accel?(data+rptf.accel):NULL; - u8* const irData = rptf.ir?(data+rptf.ir):NULL; + u8* const coreData = rptf.core?(data+rptf.core):nullptr; + u8* const accelData = rptf.accel?(data+rptf.accel):nullptr; + u8* const irData = rptf.ir?(data+rptf.ir):nullptr; u8 size = rptf.size; u8 sizeInMovie = tmpInput[g_currentByte]; @@ -1084,7 +1084,7 @@ void EndPlayInput(bool cont) // we don't clear these things because otherwise we can't resume playback if we load a movie state later //g_totalFrames = g_totalBytes = 0; //delete tmpInput; - //tmpInput = NULL; + //tmpInput = nullptr; } } @@ -1235,7 +1235,7 @@ void Shutdown() { g_currentInputCount = g_totalInputCount = g_totalFrames = g_totalBytes = 0; delete [] tmpInput; - tmpInput = NULL; + tmpInput = nullptr; tmpInputAllocated = 0; } }; diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index e2bd133b2e..2da0dce142 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -18,7 +18,7 @@ std::mutex crit_netplay_client; -static NetPlayClient * netplay_client = NULL; +static NetPlayClient * netplay_client = nullptr; NetSettings g_NetPlaySettings; #define RPT_SIZE_HACK (1 << 16) @@ -912,7 +912,7 @@ u8 CSIDevice_DanceMat::NetPlay_InGamePadToLocalPad(u8 numPAD) bool NetPlay::IsNetPlayRunning() { - return netplay_client != NULL; + return netplay_client != nullptr; } void NetPlay_Enable(NetPlayClient* const np) @@ -924,5 +924,5 @@ void NetPlay_Enable(NetPlayClient* const np) void NetPlay_Disable() { std::lock_guard lk(crit_netplay_client); - netplay_client = NULL; + netplay_client = nullptr; } diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index 9103906bee..53db18d8ea 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -639,7 +639,7 @@ bool NetPlayServer::initUPnP() memset(&m_upnp_data, 0, sizeof(IGDdatas)); // Find all UPnP devices - UPNPDev *devlist = upnpDiscover(2000, NULL, NULL, 0, 0, &upnperror); + UPNPDev *devlist = upnpDiscover(2000, nullptr, nullptr, 0, 0, &upnperror); if (!devlist) { WARN_LOG(NETPLAY, "An error occured trying to discover UPnP devices."); @@ -664,7 +664,7 @@ bool NetPlayServer::initUPnP() { parserootdesc(descXML, descXMLsize, &m_upnp_data); free(descXML); - descXML = 0; + descXML = nullptr; GetUPNPUrls(&m_upnp_urls, &m_upnp_data, dev->descURL, 0); NOTICE_LOG(NETPLAY, "Got info from IGD at %s.", dev->descURL); @@ -695,7 +695,7 @@ bool NetPlayServer::UPnPMapPort(const std::string& addr, const u16 port) result = UPNP_AddPortMapping(m_upnp_urls.controlURL, m_upnp_data.first.servicetype, port_str, port_str, addr.c_str(), (std::string("dolphin-emu TCP on ") + addr).c_str(), - "TCP", NULL, NULL); + "TCP", nullptr, nullptr); if(result != 0) return false; @@ -719,7 +719,7 @@ bool NetPlayServer::UPnPUnmapPort(const u16 port) sprintf(port_str, "%d", port); UPNP_DeletePortMapping(m_upnp_urls.controlURL, m_upnp_data.first.servicetype, - port_str, "TCP", NULL); + port_str, "TCP", nullptr); return true; } diff --git a/Source/Core/Core/PowerPC/GDBStub.cpp b/Source/Core/Core/PowerPC/GDBStub.cpp index d73573c9dd..bc94a2c68d 100644 --- a/Source/Core/Core/PowerPC/GDBStub.cpp +++ b/Source/Core/Core/PowerPC/GDBStub.cpp @@ -134,7 +134,7 @@ static gdb_bp_t *gdb_bp_ptr(u32 type) case GDB_BP_TYPE_A: return bp_x; default: - return NULL; + return nullptr; } } @@ -144,15 +144,15 @@ static gdb_bp_t *gdb_bp_empty_slot(u32 type) u32 i; p = gdb_bp_ptr(type); - if (p == NULL) - return NULL; + if (p == nullptr) + return nullptr; for (i = 0; i < GDB_MAX_BP; i++) { if (p[i].active == 0) return &p[i]; } - return NULL; + return nullptr; } static gdb_bp_t *gdb_bp_find(u32 type, u32 addr, u32 len) @@ -161,8 +161,8 @@ static gdb_bp_t *gdb_bp_find(u32 type, u32 addr, u32 len) u32 i; p = gdb_bp_ptr(type); - if (p == NULL) - return NULL; + if (p == nullptr) + return nullptr; for (i = 0; i < GDB_MAX_BP; i++) { if (p[i].active == 1 && @@ -171,7 +171,7 @@ static gdb_bp_t *gdb_bp_find(u32 type, u32 addr, u32 len) return &p[i]; } - return NULL; + return nullptr; } static void gdb_bp_remove(u32 type, u32 addr, u32 len) @@ -180,12 +180,12 @@ static void gdb_bp_remove(u32 type, u32 addr, u32 len) do { p = gdb_bp_find(type, addr, len); - if (p != NULL) { + if (p != nullptr) { DEBUG_LOG(GDB_STUB, "gdb: removed a breakpoint: %08x bytes at %08x\n", len, addr); p->active = 0; memset(p, 0, sizeof(gdb_bp_t)); } - } while (p != NULL); + } while (p != nullptr); } static int gdb_bp_check(u32 addr, u32 type) @@ -194,7 +194,7 @@ static int gdb_bp_check(u32 addr, u32 type) u32 i; p = gdb_bp_ptr(type); - if (p == NULL) + if (p == nullptr) return 0; for (i = 0; i < GDB_MAX_BP; i++) { @@ -288,7 +288,7 @@ static int gdb_data_available() { t.tv_sec = 0; t.tv_usec = 20; - if (select(sock + 1, fds, NULL, NULL, &t) < 0) + if (select(sock + 1, fds, nullptr, nullptr, &t) < 0) { ERROR_LOG(GDB_STUB, "select failed"); return 0; @@ -631,7 +631,7 @@ bool gdb_add_bp(u32 type, u32 addr, u32 len) { gdb_bp_t *bp; bp = gdb_bp_empty_slot(type); - if (bp == NULL) + if (bp == nullptr) return false; bp->active = 1; diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp index 9b8cf91a1b..7e3eea5458 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp @@ -313,7 +313,7 @@ void Interpreter::mtspr(UGeckoInstruction _inst) //_assert_msg_(POWERPC, WriteGatherPipeEnable, "Write gather pipe not enabled!"); //if ((HID2.PSE == 0)) - // MessageBox(NULL, "PSE in HID2 is set", "Warning", MB_OK); + // MessageBox(nullptr, "PSE in HID2 is set", "Warning", MB_OK); } break; diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp index 81961682da..22c0f9b843 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp @@ -367,7 +367,7 @@ void InitTables() for (int i = 0; i < 32; i++) { Interpreter::m_opTable59[i] = Interpreter::unknown_instruction; - m_infoTable59[i] = 0; + m_infoTable59[i] = nullptr; } for (int i = 0; i < 1024; i++) @@ -376,10 +376,10 @@ void InitTables() Interpreter::m_opTable19[i] = Interpreter::unknown_instruction; Interpreter::m_opTable31[i] = Interpreter::unknown_instruction; Interpreter::m_opTable63[i] = Interpreter::unknown_instruction; - m_infoTable4[i] = 0; - m_infoTable19[i] = 0; - m_infoTable31[i] = 0; - m_infoTable63[i] = 0; + m_infoTable4[i] = nullptr; + m_infoTable19[i] = nullptr; + m_infoTable31[i] = nullptr; + m_infoTable63[i] = nullptr; } for (auto& tpl : primarytable) diff --git a/Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp b/Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp index cbbc60dd6a..69cec425d5 100644 --- a/Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp +++ b/Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp @@ -9,7 +9,7 @@ using namespace Gen; using namespace PowerPC; -RegCache::RegCache() : emit(0) +RegCache::RegCache() : emit(nullptr) { memset(locks, 0, sizeof(locks)); memset(xlocks, 0, sizeof(xlocks)); diff --git a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp index f706dbe51b..689b4c48bd 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp +++ b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp @@ -48,8 +48,8 @@ struct RegInfo { RegInfo(JitIL* j, InstLoc f, unsigned insts) : Jit(j), FirstI(f), IInfo(insts), lastUsed(insts) { for (unsigned i = 0; i < MAX_NUMBER_OF_REGS; i++) { - regs[i] = 0; - fregs[i] = 0; + regs[i] = nullptr; + fregs[i] = nullptr; } numSpills = 0; numFSpills = 0; @@ -65,9 +65,9 @@ static u32 regsInUse(RegInfo& R) { u32 result = 0; for (unsigned i = 0; i < MAX_NUMBER_OF_REGS; i++) { - if (R.regs[i] != 0) + if (R.regs[i] != nullptr) result |= (1 << i); - if (R.fregs[i] != 0) + if (R.fregs[i] != nullptr) result |= (1 << (16 + i)); } return result; @@ -112,7 +112,7 @@ static void regSpill(RegInfo& RI, X64Reg reg) { slot = regCreateSpill(RI, RI.regs[reg]); RI.Jit->MOV(32, regLocForSlot(RI, slot), R(reg)); } - RI.regs[reg] = 0; + RI.regs[reg] = nullptr; } static OpArg fregLocForSlot(RegInfo& RI, unsigned slot) { @@ -136,7 +136,7 @@ static void fregSpill(RegInfo& RI, X64Reg reg) { slot = fregCreateSpill(RI, RI.fregs[reg]); RI.Jit->MOVAPD(fregLocForSlot(RI, slot), reg); } - RI.fregs[reg] = 0; + RI.fregs[reg] = nullptr; } // ECX is scratch, so we don't allocate it @@ -164,11 +164,11 @@ static const int FRegAllocSize = sizeof(FRegAllocOrder) / sizeof(X64Reg); static X64Reg regFindFreeReg(RegInfo& RI) { for (auto& reg : RegAllocOrder) - if (RI.regs[reg] == 0) + if (RI.regs[reg] == nullptr) return reg; int bestIndex = -1; - InstLoc bestEnd = 0; + InstLoc bestEnd = nullptr; for (int i = 0; i < RegAllocSize; ++i) { const InstLoc start = RI.regs[RegAllocOrder[i]]; const InstLoc end = RI.lastUsed[start - RI.FirstI]; @@ -185,11 +185,11 @@ static X64Reg regFindFreeReg(RegInfo& RI) { static X64Reg fregFindFreeReg(RegInfo& RI) { for (auto& reg : FRegAllocOrder) - if (RI.fregs[reg] == 0) + if (RI.fregs[reg] == nullptr) return reg; int bestIndex = -1; - InstLoc bestEnd = 0; + InstLoc bestEnd = nullptr; for (int i = 0; i < FRegAllocSize; ++i) { const InstLoc start = RI.fregs[FRegAllocOrder[i]]; const InstLoc end = RI.lastUsed[start - RI.FirstI]; @@ -229,13 +229,13 @@ static OpArg fregLocForInst(RegInfo& RI, InstLoc I) { static void regClearInst(RegInfo& RI, InstLoc I) { for (auto& reg : RegAllocOrder) if (RI.regs[reg] == I) - RI.regs[reg] = 0; + RI.regs[reg] = nullptr; } static void fregClearInst(RegInfo& RI, InstLoc I) { for (auto& reg : FRegAllocOrder) if (RI.fregs[reg] == I) - RI.fregs[reg] = 0; + RI.fregs[reg] = nullptr; } static X64Reg regEnsureInReg(RegInfo& RI, InstLoc I) { @@ -490,7 +490,7 @@ static OpArg regImmForConst(RegInfo& RI, InstLoc I, unsigned Size) { } static void regEmitMemStore(RegInfo& RI, InstLoc I, unsigned Size) { - auto info = regBuildMemAddress(RI, I, getOp2(I), 2, Size, 0); + auto info = regBuildMemAddress(RI, I, getOp2(I), 2, Size, nullptr); if (info.first.IsImm()) RI.Jit->MOV(32, R(ECX), info.first); else diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp index 207e4494ba..1b81959bf1 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp +++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp @@ -206,9 +206,9 @@ namespace JitILProfiler virtual ~JitILProfilerFinalizer() { char buffer[1024]; - sprintf(buffer, "JitIL_profiling_%d.csv", (int)time(NULL)); + sprintf(buffer, "JitIL_profiling_%d.csv", (int)time(nullptr)); File::IOFile file(buffer, "w"); - setvbuf(file.GetHandle(), NULL, _IOFBF, 1024 * 1024); + setvbuf(file.GetHandle(), nullptr, _IOFBF, 1024 * 1024); fprintf(file.GetHandle(), "code hash,total elapsed,number of calls,elapsed per call\n"); for (auto& block : blocks) { diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL.h b/Source/Core/Core/PowerPC/Jit64IL/JitIL.h index 5d08a3958b..14dc5c69e8 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/JitIL.h +++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL.h @@ -69,7 +69,7 @@ public: JitBlockCache *GetBlockCache() override { return &blocks; } - const u8 *BackPatch(u8 *codePtr, u32 em_address, void *ctx) override { return NULL; }; + const u8 *BackPatch(u8 *codePtr, u32 em_address, void *ctx) override { return nullptr; }; bool IsInCodeSpace(u8 *ptr) override { return IsInSpace(ptr); } diff --git a/Source/Core/Core/PowerPC/JitArmIL/JitIL.h b/Source/Core/Core/PowerPC/JitArmIL/JitIL.h index 2358a856da..66eb636cca 100644 --- a/Source/Core/Core/PowerPC/JitArmIL/JitIL.h +++ b/Source/Core/Core/PowerPC/JitArmIL/JitIL.h @@ -37,7 +37,7 @@ public: JitBaseBlockCache *GetBlockCache() { return &blocks; } - const u8 *BackPatch(u8 *codePtr, u32 em_address, void *ctx) { return NULL; } + const u8 *BackPatch(u8 *codePtr, u32 em_address, void *ctx) { return nullptr; } bool IsInCodeSpace(u8 *ptr) { return IsInSpace(ptr); } diff --git a/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.cpp b/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.cpp index 6cde1d388b..ce374f050d 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.cpp +++ b/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.cpp @@ -171,27 +171,27 @@ const u8 *Jitx86Base::BackPatch(u8 *codePtr, u32 emAddress, void *ctx_void) SContext *ctx = (SContext *)ctx_void; if (!jit->IsInCodeSpace(codePtr)) - return 0; // this will become a regular crash real soon after this + return nullptr; // this will become a regular crash real soon after this InstructionInfo info = {}; if (!DisassembleMov(codePtr, &info)) { BackPatchError("BackPatch - failed to disassemble MOV instruction", codePtr, emAddress); - return 0; + return nullptr; } if (info.otherReg != RBX) { PanicAlert("BackPatch : Base reg not RBX." "\n\nAttempted to access %08x.", emAddress); - return 0; + return nullptr; } auto it = registersInUseAtLoc.find(codePtr); if (it == registersInUseAtLoc.end()) { PanicAlert("BackPatch: no register use entry for address %p", codePtr); - return 0; + return nullptr; } u32 registersInUse = it->second; diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp index d34bdc90b1..49ffa7c69b 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp +++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp @@ -46,7 +46,7 @@ using namespace Gen; #endif blocks = new JitBlock[MAX_NUM_BLOCKS]; blockCodePointers = new const u8*[MAX_NUM_BLOCKS]; - if (iCache == 0 && iCacheEx == 0 && iCacheVMEM == 0) + if (iCache == nullptr && iCacheEx == nullptr && iCacheVMEM == nullptr) { iCache = new u8[JIT_ICACHE_SIZE]; iCacheEx = new u8[JIT_ICACHEEX_SIZE]; @@ -56,7 +56,7 @@ using namespace Gen; { PanicAlert("JitBaseBlockCache::Init() - iCache is already initialized"); } - if (iCache == 0 || iCacheEx == 0 || iCacheVMEM == 0) + if (iCache == nullptr || iCacheEx == nullptr || iCacheVMEM == nullptr) { PanicAlert("JitBaseBlockCache::Init() - unable to allocate iCache"); } @@ -70,24 +70,24 @@ using namespace Gen; { delete[] blocks; delete[] blockCodePointers; - if (iCache != 0) + if (iCache != nullptr) delete[] iCache; - iCache = 0; - if (iCacheEx != 0) + iCache = nullptr; + if (iCacheEx != nullptr) delete[] iCacheEx; - iCacheEx = 0; - if (iCacheVMEM != 0) + iCacheEx = nullptr; + if (iCacheVMEM != nullptr) delete[] iCacheVMEM; - iCacheVMEM = 0; - blocks = 0; - blockCodePointers = 0; + iCacheVMEM = nullptr; + blocks = nullptr; + blockCodePointers = nullptr; num_blocks = 0; #if defined USE_OPROFILE && USE_OPROFILE op_close_agent(agent); #endif #ifdef USE_VTUNE - iJIT_NotifyEvent(iJVM_EVENT_TYPE_SHUTDOWN, NULL); + iJIT_NotifyEvent(iJVM_EVENT_TYPE_SHUTDOWN, nullptr); #endif } diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.h b/Source/Core/Core/PowerPC/JitCommon/JitCache.h index c9621bc689..968cdaf142 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitCache.h +++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.h @@ -89,8 +89,8 @@ class JitBaseBlockCache public: JitBaseBlockCache() : - blockCodePointers(0), blocks(0), num_blocks(0), - iCache(0), iCacheEx(0), iCacheVMEM(0) {} + blockCodePointers(nullptr), blocks(nullptr), num_blocks(0), + iCache(nullptr), iCacheEx(nullptr), iCacheVMEM(nullptr) {} int AllocateBlock(u32 em_address); void FinalizeBlock(int block_num, bool block_link, const u8 *code_ptr); diff --git a/Source/Core/Core/PowerPC/JitILCommon/IR.cpp b/Source/Core/Core/PowerPC/JitILCommon/IR.cpp index 4d098fb0d7..8e00a980f6 100644 --- a/Source/Core/Core/PowerPC/JitILCommon/IR.cpp +++ b/Source/Core/Core/PowerPC/JitILCommon/IR.cpp @@ -261,7 +261,7 @@ InstLoc IRBuilder::FoldZeroOp(unsigned Opcode, unsigned extra) { return FRegCache[extra]; } if (Opcode == LoadFRegDENToZero) { - FRegCacheStore[extra] = 0; // prevent previous store operation from zapping + FRegCacheStore[extra] = nullptr; // prevent previous store operation from zapping FRegCache[extra] = EmitZeroOp(LoadFRegDENToZero, extra); return FRegCache[extra]; } @@ -844,7 +844,7 @@ InstLoc IRBuilder::FoldBranchCond(InstLoc Op1, InstLoc Op2) { if (isImm(*Op1)) { if (GetImmValue(Op1)) return EmitBranchUncond(Op2); - return 0; + return nullptr; } if (getOpcode(*Op1) == And && isImm(*getOp2(Op1)) && @@ -999,19 +999,19 @@ InstLoc IRBuilder::FoldICmpCRUnsigned(InstLoc Op1, InstLoc Op2) { InstLoc IRBuilder::FoldFallBackToInterpreter(InstLoc Op1, InstLoc Op2) { for (unsigned i = 0; i < 32; i++) { - GRegCache[i] = 0; - GRegCacheStore[i] = 0; - FRegCache[i] = 0; - FRegCacheStore[i] = 0; + GRegCache[i] = nullptr; + GRegCacheStore[i] = nullptr; + FRegCache[i] = nullptr; + FRegCacheStore[i] = nullptr; } - CarryCache = 0; - CarryCacheStore = 0; + CarryCache = nullptr; + CarryCacheStore = nullptr; for (unsigned i = 0; i < 8; i++) { - CRCache[i] = 0; - CRCacheStore[i] = 0; + CRCache[i] = nullptr; + CRCacheStore[i] = nullptr; } - CTRCache = 0; - CTRCacheStore = 0; + CTRCache = nullptr; + CTRCacheStore = nullptr; return EmitBiOp(FallBackToInterpreter, Op1, Op2); } @@ -1210,19 +1210,19 @@ InstLoc IRBuilder::isNeg(InstLoc I) const { return getOp2(I); } - return NULL; + return nullptr; } // TODO: Move the following code to a separated file. struct Writer { File::IOFile file; - Writer() : file(NULL) + Writer() : file(nullptr) { char buffer[1024]; - sprintf(buffer, "JitIL_IR_%d.txt", (int)time(NULL)); + sprintf(buffer, "JitIL_IR_%d.txt", (int)time(nullptr)); file.Open(buffer, "w"); - setvbuf(file.GetHandle(), NULL, _IOFBF, 1024 * 1024); + setvbuf(file.GetHandle(), nullptr, _IOFBF, 1024 * 1024); } virtual ~Writer() {} diff --git a/Source/Core/Core/PowerPC/JitILCommon/IR.h b/Source/Core/Core/PowerPC/JitILCommon/IR.h index 76aff111eb..062738edc6 100644 --- a/Source/Core/Core/PowerPC/JitILCommon/IR.h +++ b/Source/Core/Core/PowerPC/JitILCommon/IR.h @@ -547,19 +547,19 @@ public: MarkUsed.clear(); MarkUsed.reserve(100000); for (unsigned i = 0; i < 32; i++) { - GRegCache[i] = 0; - GRegCacheStore[i] = 0; - FRegCache[i] = 0; - FRegCacheStore[i] = 0; + GRegCache[i] = nullptr; + GRegCacheStore[i] = nullptr; + FRegCache[i] = nullptr; + FRegCacheStore[i] = nullptr; } - CarryCache = 0; - CarryCacheStore = 0; + CarryCache = nullptr; + CarryCacheStore = nullptr; for (unsigned i = 0; i < 8; i++) { - CRCache[i] = 0; - CRCacheStore[i] = 0; + CRCache[i] = nullptr; + CRCacheStore[i] = nullptr; } - CTRCache = 0; - CTRCacheStore = 0; + CTRCache = nullptr; + CTRCacheStore = nullptr; } IRBuilder() { Reset(); } diff --git a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Branch.cpp b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Branch.cpp index 8f92a09a3c..285c2182d4 100644 --- a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Branch.cpp +++ b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Branch.cpp @@ -62,7 +62,7 @@ void JitILBase::bx(UGeckoInstruction inst) } static IREmitter::InstLoc TestBranch(IREmitter::IRBuilder& ibuild, UGeckoInstruction inst) { - IREmitter::InstLoc CRTest = 0, CTRTest = 0; + IREmitter::InstLoc CRTest = nullptr, CTRTest = nullptr; if ((inst.BO & 16) == 0) // Test a CR bit { IREmitter::InstLoc CRReg = ibuild.EmitLoadCR(inst.BI >> 2); diff --git a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Integer.cpp b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Integer.cpp index f80b8a0412..441a3bc743 100644 --- a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Integer.cpp +++ b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Integer.cpp @@ -123,7 +123,7 @@ void JitILBase::boolX(UGeckoInstruction inst) INSTRUCTION_START JITDISABLE(bJITIntegerOff) - IREmitter::InstLoc a = NULL; + IREmitter::InstLoc a = nullptr; IREmitter::InstLoc s = ibuild.EmitLoadGReg(inst.RS); IREmitter::InstLoc b = ibuild.EmitLoadGReg(inst.RB); diff --git a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStore.cpp b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStore.cpp index 701de597a3..0ec93283cf 100644 --- a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStore.cpp @@ -48,7 +48,7 @@ void JitILBase::lXz(UGeckoInstruction inst) case 32: val = ibuild.EmitLoad32(addr); break; //lwz case 40: val = ibuild.EmitLoad16(addr); break; //lhz case 34: val = ibuild.EmitLoad8(addr); break; //lbz - default: PanicAlert("lXz: invalid access size"); val = 0; break; + default: PanicAlert("lXz: invalid access size"); val = nullptr; break; } ibuild.EmitStoreGReg(val, inst.RD); } diff --git a/Source/Core/Core/PowerPC/JitInterface.cpp b/Source/Core/Core/PowerPC/JitInterface.cpp index 6cfd96f65e..daac26b737 100644 --- a/Source/Core/Core/PowerPC/JitInterface.cpp +++ b/Source/Core/Core/PowerPC/JitInterface.cpp @@ -45,7 +45,7 @@ namespace JitInterface bFakeVMEM = SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack == true; bMMU = SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU; - CPUCoreBase *ptr = NULL; + CPUCoreBase *ptr = nullptr; switch(core) { #if _M_X86 @@ -75,8 +75,8 @@ namespace JitInterface default: { PanicAlert("Unrecognizable cpu_core: %d", core); - jit = NULL; - return NULL; + jit = nullptr; + return nullptr; } } jit = static_cast(ptr); @@ -239,7 +239,7 @@ namespace JitInterface { jit->Shutdown(); delete jit; - jit = NULL; + jit = nullptr; } } } diff --git a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp index 59a84cd227..e5e5911f64 100644 --- a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp +++ b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp @@ -34,19 +34,19 @@ PPCSymbolDB::~PPCSymbolDB() Symbol *PPCSymbolDB::AddFunction(u32 startAddr) { if (startAddr < 0x80000010) - return 0; + return nullptr; XFuncMap::iterator iter = functions.find(startAddr); if (iter != functions.end()) { // it's already in the list - return 0; + return nullptr; } else { Symbol tempFunc; //the current one we're working on u32 targetEnd = PPCAnalyst::AnalyzeFunction(startAddr, tempFunc); if (targetEnd == 0) - return 0; //found a dud :( + return nullptr; //found a dud :( //LOG(OSHLE, "Symbol found at %08x", startAddr); functions[startAddr] = tempFunc; tempFunc.type = Symbol::SYMBOL_FUNCTION; @@ -86,7 +86,7 @@ void PPCSymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const char *name, int Symbol *PPCSymbolDB::GetSymbolFromAddr(u32 addr) { if (!Memory::IsRAMAddress(addr)) - return 0; + return nullptr; XFuncMap::iterator it = functions.find(addr); if (it != functions.end()) @@ -101,7 +101,7 @@ Symbol *PPCSymbolDB::GetSymbolFromAddr(u32 addr) return &p.second; } } - return 0; + return nullptr; } const std::string PPCSymbolDB::GetDescription(u32 addr) @@ -237,7 +237,7 @@ bool PPCSymbolDB::LoadMap(const char *filename) sscanf(line, "%08x %08x %08x %i %511s", &address, &size, &vaddress, &unknown, name); const char *namepos = strstr(line, name); - if (namepos != 0) //would be odd if not :P + if (namepos != nullptr) //would be odd if not :P strcpy(name, namepos); name[strlen(name) - 1] = 0; diff --git a/Source/Core/Core/PowerPC/PPCTables.cpp b/Source/Core/Core/PowerPC/PPCTables.cpp index 264fe5f4e3..db7f645ec1 100644 --- a/Source/Core/Core/PowerPC/PPCTables.cpp +++ b/Source/Core/Core/PowerPC/PPCTables.cpp @@ -40,7 +40,7 @@ GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst) case 63: return m_infoTable63[_inst.SUBOP10]; default: _assert_msg_(POWERPC,0,"GetOpInfo - invalid subtable op %08x @ %08x", _inst.hex, PC); - return 0; + return nullptr; } } else @@ -48,7 +48,7 @@ GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst) if ((info->type & 0xFFFFFF) == OPTYPE_INVALID) { _assert_msg_(POWERPC,0,"GetOpInfo - invalid op %08x @ %08x", _inst.hex, PC); - return 0; + return nullptr; } return m_infoTable[_inst.OPCD]; } @@ -69,7 +69,7 @@ Interpreter::_interpreterInstruction GetInterpreterOp(UGeckoInstruction _inst) case 63: return Interpreter::m_opTable63[_inst.SUBOP10]; default: _assert_msg_(POWERPC,0,"GetInterpreterOp - invalid subtable op %08x @ %08x", _inst.hex, PC); - return 0; + return nullptr; } } else @@ -77,7 +77,7 @@ Interpreter::_interpreterInstruction GetInterpreterOp(UGeckoInstruction _inst) if ((info->type & 0xFFFFFF) == OPTYPE_INVALID) { _assert_msg_(POWERPC,0,"GetInterpreterOp - invalid op %08x @ %08x", _inst.hex, PC); - return 0; + return nullptr; } return Interpreter::m_opTable[_inst.OPCD]; } @@ -161,13 +161,13 @@ namespace { const char *GetInstructionName(UGeckoInstruction _inst) { const GekkoOPInfo *info = GetOpInfo(_inst); - return info ? info->opname : 0; + return info ? info->opname : nullptr; } bool IsValidInstruction(UGeckoInstruction _inst) { const GekkoOPInfo *info = GetOpInfo(_inst); - return info != 0; + return info != nullptr; } void CountInstruction(UGeckoInstruction _inst) diff --git a/Source/Core/Core/PowerPC/PowerPC.cpp b/Source/Core/Core/PowerPC/PowerPC.cpp index 324d6cc83a..62cba9ed3a 100644 --- a/Source/Core/Core/PowerPC/PowerPC.cpp +++ b/Source/Core/Core/PowerPC/PowerPC.cpp @@ -169,7 +169,7 @@ void Shutdown() { JitInterface::Shutdown(); interpreter->Shutdown(); - cpu_core_base = NULL; + cpu_core_base = nullptr; state = CPU_POWERDOWN; } diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp index f0a82fbd5c..ca35619847 100644 --- a/Source/Core/Core/State.cpp +++ b/Source/Core/Core/State.cpp @@ -47,7 +47,7 @@ static HEAP_ALLOC(wrkmem, LZO1X_1_MEM_COMPRESS); static std::string g_last_filename; -static CallbackFunc g_onAfterLoadCb = NULL; +static CallbackFunc g_onAfterLoadCb = nullptr; // Temporary undo state buffer static std::vector g_undo_load_buffer; @@ -131,7 +131,7 @@ void SaveToBuffer(std::vector& buffer) { bool wasUnpaused = Core::PauseAndLock(true); - u8* ptr = NULL; + u8* ptr = nullptr; PointerWrap p(&ptr, PointerWrap::MODE_MEASURE); DoState(p); @@ -301,7 +301,7 @@ void SaveAs(const std::string& filename, bool wait) bool wasUnpaused = Core::PauseAndLock(true); // Measure the size of the buffer. - u8 *ptr = NULL; + u8 *ptr = nullptr; PointerWrap p(&ptr, PointerWrap::MODE_MEASURE); DoState(p); const size_t buffer_size = reinterpret_cast(ptr); @@ -393,7 +393,7 @@ void LoadFileStateData(const std::string& filename, std::vector& ret_data) break; f.ReadBytes(out, cur_len); - const int res = lzo1x_decompress(out, cur_len, &buffer[i], &new_len, NULL); + const int res = lzo1x_decompress(out, cur_len, &buffer[i], &new_len, nullptr); if (res != LZO_E_OK) { // This doesn't seem to happen anymore. diff --git a/Source/Core/Core/VolumeHandler.cpp b/Source/Core/Core/VolumeHandler.cpp index d1c8d4cb96..5f48545daf 100644 --- a/Source/Core/Core/VolumeHandler.cpp +++ b/Source/Core/Core/VolumeHandler.cpp @@ -8,7 +8,7 @@ namespace VolumeHandler { -DiscIO::IVolume* g_pVolume = NULL; +DiscIO::IVolume* g_pVolume = nullptr; DiscIO::IVolume *GetVolume() { @@ -24,7 +24,7 @@ void EjectVolume() // reading location ..." after you have started and stopped two // or three games delete g_pVolume; - g_pVolume = NULL; + g_pVolume = nullptr; } } @@ -33,12 +33,12 @@ bool SetVolumeName(const std::string& _rFullPath) if (g_pVolume) { delete g_pVolume; - g_pVolume = NULL; + g_pVolume = nullptr; } g_pVolume = DiscIO::CreateVolumeFromFilename(_rFullPath); - return (g_pVolume != NULL); + return (g_pVolume != nullptr); } void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii, const std::string& _rApploader, const std::string& _rDOL) @@ -46,7 +46,7 @@ void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii, const std:: if (g_pVolume) { delete g_pVolume; - g_pVolume = NULL; + g_pVolume = nullptr; } g_pVolume = DiscIO::CreateVolumeFromDirectory(_rFullPath, _bIsWii, _rApploader, _rDOL); @@ -54,7 +54,7 @@ void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii, const std:: u32 Read32(u64 _Offset) { - if (g_pVolume != NULL) + if (g_pVolume != nullptr) { u32 Temp; g_pVolume->Read(_Offset, 4, (u8*)&Temp); @@ -65,7 +65,7 @@ u32 Read32(u64 _Offset) bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength) { - if (g_pVolume != NULL && ptr) + if (g_pVolume != nullptr && ptr) { g_pVolume->Read(_dwOffset, _dwLength, ptr); return true; @@ -75,7 +75,7 @@ bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength) bool RAWReadToPtr( u8* ptr, u64 _dwOffset, u64 _dwLength ) { - if (g_pVolume != NULL && ptr) + if (g_pVolume != nullptr && ptr) { g_pVolume->RAWRead(_dwOffset, _dwLength, ptr); return true; @@ -85,7 +85,7 @@ bool RAWReadToPtr( u8* ptr, u64 _dwOffset, u64 _dwLength ) bool IsValid() { - return (g_pVolume != NULL); + return (g_pVolume != nullptr); } bool IsWii() diff --git a/Source/Core/Core/ec_wii.cpp b/Source/Core/Core/ec_wii.cpp index 0d4d72b0a2..62013b0a2f 100644 --- a/Source/Core/Core/ec_wii.cpp +++ b/Source/Core/Core/ec_wii.cpp @@ -42,12 +42,12 @@ static u8 default_NG_sig[] = { // NG_key_id is the device-unique key_id to use // NG_priv is the device-unique private key to use // NG_sig is the device-unique signature blob (from issuer) to use -// if NG_priv iis NULL or NG_sig is NULL or NG_id is 0 or NG_key_id is 0, default values +// if NG_priv iis nullptr or NG_sig is nullptr or NG_id is 0 or NG_key_id is 0, default values // will be used for all of them void get_ng_cert(u8* ng_cert_out, u32 NG_id, u32 NG_key_id, const u8* NG_priv, const u8* NG_sig) { char name[64]; - if ((NG_id==0)||(NG_key_id==0)||(NG_priv==NULL)||(NG_sig==NULL)) + if ((NG_id==0)||(NG_key_id==0)||(NG_priv==nullptr)||(NG_sig==nullptr)) { NG_id = default_NG_id; NG_key_id = default_NG_key_id; @@ -70,7 +70,7 @@ void get_ng_cert(u8* ng_cert_out, u32 NG_id, u32 NG_key_id, const u8* NG_priv, c // data_size is the length of the buffer // NG_priv is the device-unique private key to use // NG_id is the device-unique id to use -// if NG_priv is NULL or NG_id is 0, it will use builtin defaults +// if NG_priv is nullptr or NG_id is 0, it will use builtin defaults void get_ap_sig_and_cert(u8 *sig_out, u8 *ap_cert_out, u64 title_id, u8 *data, u32 data_size, const u8 *NG_priv, u32 NG_id) { u8 hash[20]; @@ -78,7 +78,7 @@ void get_ap_sig_and_cert(u8 *sig_out, u8 *ap_cert_out, u64 title_id, u8 *data, u char signer[64]; char name[64]; - if ((NG_id==0)||(NG_priv == NULL)) + if ((NG_id==0)||(NG_priv == nullptr)) { NG_priv = default_NG_priv; NG_id = default_NG_id; @@ -122,10 +122,10 @@ void make_blanksig_ec_cert(u8 *cert_out, const char *signer, const char *name, c // shared_secret_out is a pointer to 0x3c long buffer // remote_public_key is a pointer to the remote party's public key (0x3c bytes) // NG_priv is the device-unique private key to use -// if NG_priv is NULL, default builtin will be used +// if NG_priv is nullptr, default builtin will be used void get_shared_secret(u8* shared_secret_out, u8* remote_public_key, u8* NG_priv) { - if (NG_priv==NULL) + if (NG_priv==nullptr) { NG_priv = default_NG_priv; } diff --git a/Source/Core/Core/x64MemTools.cpp b/Source/Core/Core/x64MemTools.cpp index 9554164262..af0530dee7 100644 --- a/Source/Core/Core/x64MemTools.cpp +++ b/Source/Core/Core/x64MemTools.cpp @@ -183,7 +183,7 @@ void ExceptionThread(mach_port_t port) #pragma pack() memset(&msg_in, 0xee, sizeof(msg_in)); memset(&msg_out, 0xee, sizeof(msg_out)); - mach_msg_header_t *send_msg = NULL; + mach_msg_header_t *send_msg = nullptr; mach_msg_size_t send_size = 0; mach_msg_option_t option = MACH_RCV_MSG; while (1) @@ -303,11 +303,11 @@ void InstallExceptionHandler() PanicAlertT("InstallExceptionHandler called, but this platform does not yet support it."); #else struct sigaction sa; - sa.sa_handler = 0; + sa.sa_handler = nullptr; sa.sa_sigaction = &sigsegv_handler; sa.sa_flags = SA_SIGINFO; sigemptyset(&sa.sa_mask); - sigaction(SIGSEGV, &sa, NULL); + sigaction(SIGSEGV, &sa, nullptr); #endif } diff --git a/Source/Core/DiscIO/BannerLoader.cpp b/Source/Core/DiscIO/BannerLoader.cpp index 49dfb4bb44..81d7ab2149 100644 --- a/Source/Core/DiscIO/BannerLoader.cpp +++ b/Source/Core/DiscIO/BannerLoader.cpp @@ -27,7 +27,7 @@ IBannerLoader* CreateBannerLoader(DiscIO::IFileSystem& _rFileSystem, DiscIO::IVo return new CBannerLoaderGC(_rFileSystem, pVolume); } - return NULL; + return nullptr; } } // namespace diff --git a/Source/Core/DiscIO/BannerLoaderGC.cpp b/Source/Core/DiscIO/BannerLoaderGC.cpp index 0133e43ae6..5258eb66ab 100644 --- a/Source/Core/DiscIO/BannerLoaderGC.cpp +++ b/Source/Core/DiscIO/BannerLoaderGC.cpp @@ -16,7 +16,7 @@ namespace DiscIO { CBannerLoaderGC::CBannerLoaderGC(DiscIO::IFileSystem& _rFileSystem, DiscIO::IVolume* volume) - : m_pBannerFile(NULL) + : m_pBannerFile(nullptr) , m_IsValid(false) , m_country(volume->GetCountry()) { @@ -45,7 +45,7 @@ CBannerLoaderGC::~CBannerLoaderGC() if (m_pBannerFile) { delete [] m_pBannerFile; - m_pBannerFile = NULL; + m_pBannerFile = nullptr; } } diff --git a/Source/Core/DiscIO/BannerLoaderWii.cpp b/Source/Core/DiscIO/BannerLoaderWii.cpp index 3fa9113770..5ca4f5f38e 100644 --- a/Source/Core/DiscIO/BannerLoaderWii.cpp +++ b/Source/Core/DiscIO/BannerLoaderWii.cpp @@ -21,7 +21,7 @@ namespace DiscIO { CBannerLoaderWii::CBannerLoaderWii(DiscIO::IVolume *pVolume) - : m_pBannerFile(NULL) + : m_pBannerFile(nullptr) , m_IsValid(false) { char Filename[260]; @@ -94,7 +94,7 @@ CBannerLoaderWii::~CBannerLoaderWii() if (m_pBannerFile) { delete [] m_pBannerFile; - m_pBannerFile = NULL; + m_pBannerFile = nullptr; } } @@ -121,7 +121,7 @@ bool CBannerLoaderWii::GetStringFromComments(const CommentIndex index, std::stri auto const banner = reinterpret_cast(m_pBannerFile); auto const src_ptr = banner->m_Comment[index]; - // Trim at first NULL + // Trim at first nullptr auto const length = std::find(src_ptr, src_ptr + COMMENT_SIZE, 0x0) - src_ptr; std::wstring src; diff --git a/Source/Core/DiscIO/Blob.cpp b/Source/Core/DiscIO/Blob.cpp index c5f5eec28e..c912dad3c5 100644 --- a/Source/Core/DiscIO/Blob.cpp +++ b/Source/Core/DiscIO/Blob.cpp @@ -121,7 +121,7 @@ IBlobReader* CreateBlobReader(const char* filename) return DriveReader::Create(filename); if (!File::Exists(filename)) - return 0; + return nullptr; if (IsWbfsBlob(filename)) return WbfsFileReader::Create(filename); diff --git a/Source/Core/DiscIO/Blob.h b/Source/Core/DiscIO/Blob.h index 62c0f10e39..5ceb4c3bcf 100644 --- a/Source/Core/DiscIO/Blob.h +++ b/Source/Core/DiscIO/Blob.h @@ -68,8 +68,8 @@ IBlobReader* CreateBlobReader(const char *filename); typedef void (*CompressCB)(const char *text, float percent, void* arg); bool CompressFileToBlob(const char *infile, const char *outfile, u32 sub_type = 0, int sector_size = 16384, - CompressCB callback = 0, void *arg = 0); + CompressCB callback = nullptr, void *arg = nullptr); bool DecompressBlobToFile(const char *infile, const char *outfile, - CompressCB callback = 0, void *arg = 0); + CompressCB callback = nullptr, void *arg = nullptr); } // namespace diff --git a/Source/Core/DiscIO/CISOBlob.cpp b/Source/Core/DiscIO/CISOBlob.cpp index 7c56cde277..ea0a01eafd 100644 --- a/Source/Core/DiscIO/CISOBlob.cpp +++ b/Source/Core/DiscIO/CISOBlob.cpp @@ -37,7 +37,7 @@ CISOFileReader* CISOFileReader::Create(const char* filename) return new CISOFileReader(f.ReleaseHandle()); } else - return NULL; + return nullptr; } u64 CISOFileReader::GetDataSize() const diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp index 94d56b3172..0d7ba59310 100644 --- a/Source/Core/DiscIO/CompressedBlob.cpp +++ b/Source/Core/DiscIO/CompressedBlob.cpp @@ -55,7 +55,7 @@ CompressedBlobReader* CompressedBlobReader::Create(const char* filename) if (IsCompressedBlob(filename)) return new CompressedBlobReader(filename); else - return 0; + return nullptr; } CompressedBlobReader::~CompressedBlobReader() diff --git a/Source/Core/DiscIO/DiscScrubber.cpp b/Source/Core/DiscIO/DiscScrubber.cpp index 8c64dcd1b0..68a3e9f36f 100644 --- a/Source/Core/DiscIO/DiscScrubber.cpp +++ b/Source/Core/DiscIO/DiscScrubber.cpp @@ -24,7 +24,7 @@ namespace DiscScrubber #define CLUSTER_SIZE 0x8000 -u8* m_FreeTable = NULL; +u8* m_FreeTable = nullptr; u64 m_FileSize; u64 m_BlockCount; u32 m_BlockSize; @@ -32,7 +32,7 @@ int m_BlocksPerCluster; bool m_isScrubbing = false; std::string m_Filename; -IVolume* m_Disc = NULL; +IVolume* m_Disc = nullptr; struct SPartitionHeader { @@ -112,7 +112,7 @@ bool SetupScrub(const char* filename, int block_size) success = ParseDisc(); // Done with it; need it closed for the next part delete m_Disc; - m_Disc = NULL; + m_Disc = nullptr; m_BlockCount = 0; // Let's not touch the file if we've failed up to here :p @@ -146,7 +146,7 @@ void GetNextBlock(File::IOFile& in, u8* buffer) void Cleanup() { if (m_FreeTable) delete[] m_FreeTable; - m_FreeTable = NULL; + m_FreeTable = nullptr; m_FileSize = 0; m_BlockCount = 0; m_BlockSize = 0; diff --git a/Source/Core/DiscIO/DriveBlob.cpp b/Source/Core/DiscIO/DriveBlob.cpp index 819a37971c..6785ee0cf4 100644 --- a/Source/Core/DiscIO/DriveBlob.cpp +++ b/Source/Core/DiscIO/DriveBlob.cpp @@ -23,14 +23,14 @@ DriveReader::DriveReader(const char *drive) SectorReader::SetSectorSize(2048); auto const path = UTF8ToTStr(std::string("\\\\.\\") + drive); hDisc = CreateFile(path.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, NULL); + nullptr, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, nullptr); if (hDisc != INVALID_HANDLE_VALUE) { // Do a test read to make sure everything is OK, since it seems you can get // handles to empty drives. DWORD not_used; u8 *buffer = new u8[m_blocksize]; - if (!ReadFile(hDisc, buffer, m_blocksize, (LPDWORD)¬_used, NULL)) + if (!ReadFile(hDisc, buffer, m_blocksize, (LPDWORD)¬_used, nullptr)) { delete [] buffer; // OK, something is wrong. @@ -45,8 +45,8 @@ DriveReader::DriveReader(const char *drive) // removal while reading from it. pmrLockCDROM.PreventMediaRemoval = TRUE; DeviceIoControl(hDisc, IOCTL_CDROM_MEDIA_REMOVAL, - &pmrLockCDROM, sizeof(pmrLockCDROM), NULL, - 0, &dwNotUsed, NULL); + &pmrLockCDROM, sizeof(pmrLockCDROM), nullptr, + 0, &dwNotUsed, nullptr); #endif #else SectorReader::SetSectorSize(2048); @@ -66,8 +66,8 @@ DriveReader::~DriveReader() // Unlock the disc in the CD-ROM drive. pmrLockCDROM.PreventMediaRemoval = FALSE; DeviceIoControl (hDisc, IOCTL_CDROM_MEDIA_REMOVAL, - &pmrLockCDROM, sizeof(pmrLockCDROM), NULL, - 0, &dwNotUsed, NULL); + &pmrLockCDROM, sizeof(pmrLockCDROM), nullptr, + 0, &dwNotUsed, nullptr); #endif if (hDisc != INVALID_HANDLE_VALUE) { @@ -85,7 +85,7 @@ DriveReader *DriveReader::Create(const char *drive) if (!reader->IsOK()) { delete reader; - return 0; + return nullptr; } return reader; } @@ -99,7 +99,7 @@ void DriveReader::GetBlock(u64 block_num, u8 *out_ptr) LONG off_low = (LONG)offset & 0xFFFFFFFF; LONG off_high = (LONG)(offset >> 32); SetFilePointer(hDisc, off_low, &off_high, FILE_BEGIN); - if (!ReadFile(hDisc, lpSector, m_blocksize, (LPDWORD)&NotUsed, NULL)) + if (!ReadFile(hDisc, lpSector, m_blocksize, (LPDWORD)&NotUsed, nullptr)) PanicAlertT("Disc Read Error"); #else file_.Seek(m_blocksize * block_num, SEEK_SET); @@ -117,7 +117,7 @@ bool DriveReader::ReadMultipleAlignedBlocks(u64 block_num, u64 num_blocks, u8 *o LONG off_low = (LONG)offset & 0xFFFFFFFF; LONG off_high = (LONG)(offset >> 32); SetFilePointer(hDisc, off_low, &off_high, FILE_BEGIN); - if (!ReadFile(hDisc, out_ptr, (DWORD)(m_blocksize * num_blocks), (LPDWORD)&NotUsed, NULL)) + if (!ReadFile(hDisc, out_ptr, (DWORD)(m_blocksize * num_blocks), (LPDWORD)&NotUsed, nullptr)) { PanicAlertT("Disc Read Error"); return false; diff --git a/Source/Core/DiscIO/DriveBlob.h b/Source/Core/DiscIO/DriveBlob.h index 5b4fe14f5d..ae2b6875f6 100644 --- a/Source/Core/DiscIO/DriveBlob.h +++ b/Source/Core/DiscIO/DriveBlob.h @@ -28,7 +28,7 @@ private: bool IsOK() {return hDisc != INVALID_HANDLE_VALUE;} #else File::IOFile file_; - bool IsOK() {return file_ != 0;} + bool IsOK() {return file_ != nullptr;} #endif s64 size; diff --git a/Source/Core/DiscIO/FileBlob.cpp b/Source/Core/DiscIO/FileBlob.cpp index d97a4b1d7c..bb4d28680d 100644 --- a/Source/Core/DiscIO/FileBlob.cpp +++ b/Source/Core/DiscIO/FileBlob.cpp @@ -19,7 +19,7 @@ PlainFileReader* PlainFileReader::Create(const char* filename) if (f) return new PlainFileReader(f.ReleaseHandle()); else - return NULL; + return nullptr; } bool PlainFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr) diff --git a/Source/Core/DiscIO/FileHandlerARC.cpp b/Source/Core/DiscIO/FileHandlerARC.cpp index 770d3aac8b..ee24158053 100644 --- a/Source/Core/DiscIO/FileHandlerARC.cpp +++ b/Source/Core/DiscIO/FileHandlerARC.cpp @@ -18,11 +18,11 @@ namespace DiscIO { CARCFile::CARCFile(const std::string& _rFilename) - : m_pBuffer(NULL) + : m_pBuffer(nullptr) , m_Initialized(false) { DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rFilename.c_str()); - if (pReader != NULL) + if (pReader != nullptr) { u64 FileSize = pReader->GetDataSize(); m_pBuffer = new u8[(u32)FileSize]; @@ -34,11 +34,11 @@ CARCFile::CARCFile(const std::string& _rFilename) } CARCFile::CARCFile(const std::string& _rFilename, u32 offset) - : m_pBuffer(NULL) + : m_pBuffer(nullptr) , m_Initialized(false) { DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rFilename.c_str()); - if (pReader != NULL) + if (pReader != nullptr) { u64 FileSize = pReader->GetDataSize() - offset; m_pBuffer = new u8[(u32)FileSize]; @@ -50,7 +50,7 @@ CARCFile::CARCFile(const std::string& _rFilename, u32 offset) } CARCFile::CARCFile(const u8* _pBuffer, size_t _BufferSize) - : m_pBuffer(NULL) + : m_pBuffer(nullptr) , m_Initialized(false) { m_pBuffer = new u8[_BufferSize]; @@ -86,7 +86,7 @@ CARCFile::GetFileSize(const std::string& _rFullPath) const SFileInfo* pFileInfo = FindFileInfo(_rFullPath); - if (pFileInfo != NULL) + if (pFileInfo != nullptr) { return((size_t) pFileInfo->m_FileSize); } @@ -105,7 +105,7 @@ CARCFile::ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBuffe const SFileInfo* pFileInfo = FindFileInfo(_rFullPath); - if (pFileInfo == NULL) + if (pFileInfo == nullptr) { return(0); } @@ -130,7 +130,7 @@ CARCFile::ExportFile(const std::string& _rFullPath, const std::string& _rExportF const SFileInfo* pFileInfo = FindFileInfo(_rFullPath); - if (pFileInfo == NULL) + if (pFileInfo == nullptr) { return(false); } @@ -183,7 +183,7 @@ CARCFile::ParseBuffer() szNameTable += 0xC; } - BuildFilenames(1, m_FileInfoVector.size(), NULL, szNameTable); + BuildFilenames(1, m_FileInfoVector.size(), nullptr, szNameTable); } return(true); @@ -204,7 +204,7 @@ CARCFile::BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, cons if (rFileInfo.IsDirectory()) { // this is a directory, build up the new szDirectory - if (_szDirectory != NULL) + if (_szDirectory != nullptr) { sprintf(rFileInfo.m_FullPath, "%s%s/", _szDirectory, &_szNameTable[uOffset]); } @@ -218,7 +218,7 @@ CARCFile::BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, cons else { // this is a filename - if (_szDirectory != NULL) + if (_szDirectory != nullptr) { sprintf(rFileInfo.m_FullPath, "%s%s", _szDirectory, &_szNameTable[uOffset]); } @@ -246,6 +246,6 @@ CARCFile::FindFileInfo(std::string _rFullPath) const } } - return(NULL); + return(nullptr); } } // namespace diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index cc0a345838..e04bc2211e 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -24,8 +24,8 @@ namespace FileMon { -DiscIO::IVolume *OpenISO = NULL; -DiscIO::IFileSystem *pFileSystem = NULL; +DiscIO::IVolume *OpenISO = nullptr; +DiscIO::IFileSystem *pFileSystem = nullptr; std::vector GCFiles; std::string ISOFile = "", CurrentFile = ""; bool FileAccess = true; @@ -34,7 +34,7 @@ bool FileAccess = true; bool IsSoundFile(const std::string& filename) { std::string extension; - SplitPath(filename, NULL, NULL, &extension); + SplitPath(filename, nullptr, nullptr, &extension); std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); std::unordered_set extensions = { @@ -57,15 +57,15 @@ bool IsSoundFile(const std::string& filename) void ReadGC(const std::string& filename) { // Should have an actual Shutdown procedure or something - if (OpenISO != NULL) + if (OpenISO != nullptr) { delete OpenISO; - OpenISO = NULL; + OpenISO = nullptr; } - if (pFileSystem != NULL) + if (pFileSystem != nullptr) { delete pFileSystem; - pFileSystem = NULL; + pFileSystem = nullptr; } // GCFiles' pointers are no longer valid after pFileSystem is cleared @@ -149,16 +149,16 @@ void FindFilename(u64 offset) void Close() { - if (OpenISO != NULL) + if (OpenISO != nullptr) { delete OpenISO; - OpenISO = NULL; + OpenISO = nullptr; } - if (pFileSystem != NULL) + if (pFileSystem != nullptr) { delete pFileSystem; - pFileSystem = NULL; + pFileSystem = nullptr; } // GCFiles' pointers are no longer valid after pFileSystem is cleared diff --git a/Source/Core/DiscIO/FileSystemGCWii.cpp b/Source/Core/DiscIO/FileSystemGCWii.cpp index 6b15454256..5b7f53af2b 100644 --- a/Source/Core/DiscIO/FileSystemGCWii.cpp +++ b/Source/Core/DiscIO/FileSystemGCWii.cpp @@ -40,7 +40,7 @@ u64 CFileSystemGCWii::GetFileSize(const char* _rFullPath) const SFileInfo* pFileInfo = FindFileInfo(_rFullPath); - if (pFileInfo != NULL && !pFileInfo->IsDirectory()) + if (pFileInfo != nullptr && !pFileInfo->IsDirectory()) return pFileInfo->m_FileSize; return 0; @@ -60,7 +60,7 @@ const char* CFileSystemGCWii::GetFileName(u64 _Address) } } - return 0; + return nullptr; } u64 CFileSystemGCWii::ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) @@ -69,7 +69,7 @@ u64 CFileSystemGCWii::ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _Max InitFileSystem(); const SFileInfo* pFileInfo = FindFileInfo(_rFullPath); - if (pFileInfo == NULL) + if (pFileInfo == nullptr) return 0; if (pFileInfo->m_FileSize > _MaxBufferSize) @@ -243,7 +243,7 @@ const SFileInfo* CFileSystemGCWii::FindFileInfo(const char* _rFullPath) return &fileInfo; } - return NULL; + return nullptr; } bool CFileSystemGCWii::DetectFileSystem() @@ -297,7 +297,7 @@ void CFileSystemGCWii::InitFileSystem() NameTableOffset += 0xC; } - BuildFilenames(1, m_FileInfoVector.size(), NULL, NameTableOffset); + BuildFilenames(1, m_FileInfoVector.size(), nullptr, NameTableOffset); } } @@ -317,7 +317,7 @@ size_t CFileSystemGCWii::BuildFilenames(const size_t _FirstIndex, const size_t _ if (rFileInfo->IsDirectory()) { // this is a directory, build up the new szDirectory - if (_szDirectory != NULL) + if (_szDirectory != nullptr) CharArrayFromFormat(rFileInfo->m_FullPath, "%s%s/", _szDirectory, filename.c_str()); else CharArrayFromFormat(rFileInfo->m_FullPath, "%s/", filename.c_str()); @@ -327,7 +327,7 @@ size_t CFileSystemGCWii::BuildFilenames(const size_t _FirstIndex, const size_t _ else { // this is a filename - if (_szDirectory != NULL) + if (_szDirectory != nullptr) CharArrayFromFormat(rFileInfo->m_FullPath, "%s%s", _szDirectory, filename.c_str()); else CharArrayFromFormat(rFileInfo->m_FullPath, "%s", filename.c_str()); diff --git a/Source/Core/DiscIO/Filesystem.cpp b/Source/Core/DiscIO/Filesystem.cpp index 7cbfa9c877..142505f1b7 100644 --- a/Source/Core/DiscIO/Filesystem.cpp +++ b/Source/Core/DiscIO/Filesystem.cpp @@ -22,12 +22,12 @@ IFileSystem* CreateFileSystem(const IVolume* _rVolume) IFileSystem* pFileSystem = new CFileSystemGCWii(_rVolume); if (!pFileSystem) - return 0; + return nullptr; if (!pFileSystem->IsValid()) { delete pFileSystem; - pFileSystem = NULL; + pFileSystem = nullptr; } return pFileSystem; diff --git a/Source/Core/DiscIO/NANDContentLoader.cpp b/Source/Core/DiscIO/NANDContentLoader.cpp index 96db3b2436..5ea4daa637 100644 --- a/Source/Core/DiscIO/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/NANDContentLoader.cpp @@ -157,7 +157,7 @@ CNANDContentLoader::CNANDContentLoader(const std::string& _rName) , m_IosVersion(0x09) , m_BootIndex(-1) , m_TIKSize(0) - , m_TIK(NULL) + , m_TIK(nullptr) { m_Valid = Initialize(_rName); } @@ -172,7 +172,7 @@ CNANDContentLoader::~CNANDContentLoader() if (m_TIK) { delete []m_TIK; - m_TIK = NULL; + m_TIK = nullptr; } } @@ -185,7 +185,7 @@ const SNANDContent* CNANDContentLoader::GetContentByIndex(int _Index) const return &Content; } } - return NULL; + return nullptr; } bool CNANDContentLoader::Initialize(const std::string& _rName) @@ -194,8 +194,8 @@ bool CNANDContentLoader::Initialize(const std::string& _rName) return false; m_Path = _rName; WiiWAD Wad(_rName); - u8* pDataApp = NULL; - u8* pTMD = NULL; + u8* pDataApp = nullptr; + u8* pTMD = nullptr; u8 DecryptTitleKey[16]; u8 IV[16]; if (Wad.IsValid()) @@ -272,7 +272,7 @@ bool CNANDContentLoader::Initialize(const std::string& _rName) continue; } - rContent.m_pData = NULL; + rContent.m_pData = nullptr; if (rContent.m_Type & 0x8000) // shared app { diff --git a/Source/Core/DiscIO/VolumeCreator.cpp b/Source/Core/DiscIO/VolumeCreator.cpp index eb2d24e4f5..a223c263ea 100644 --- a/Source/Core/DiscIO/VolumeCreator.cpp +++ b/Source/Core/DiscIO/VolumeCreator.cpp @@ -75,8 +75,8 @@ EDiscType GetDiscType(IBlobReader& _rReader); IVolume* CreateVolumeFromFilename(const std::string& _rFilename, u32 _PartitionGroup, u32 _VolumeNum) { IBlobReader* pReader = CreateBlobReader(_rFilename.c_str()); - if (pReader == NULL) - return NULL; + if (pReader == nullptr) + return nullptr; switch (GetDiscType(*pReader)) { @@ -94,7 +94,7 @@ IVolume* CreateVolumeFromFilename(const std::string& _rFilename, u32 _PartitionG IVolume* pVolume = CreateVolumeFromCryptedWiiImage(*pReader, _PartitionGroup, 0, _VolumeNum, region == 'K'); - if (pVolume == NULL) + if (pVolume == nullptr) { delete pReader; } @@ -106,16 +106,16 @@ IVolume* CreateVolumeFromFilename(const std::string& _rFilename, u32 _PartitionG case DISC_TYPE_UNK: default: std::string Filename, ext; - SplitPath(_rFilename, NULL, &Filename, &ext); + SplitPath(_rFilename, nullptr, &Filename, &ext); Filename += ext; NOTICE_LOG(DISCIO, "%s does not have the Magic word for a gcm, wiidisc or wad file\n" "Set Log Verbosity to Warning and attempt to load the game again to view the values", Filename.c_str()); delete pReader; - return NULL; + return nullptr; } // unreachable code - return NULL; + return nullptr; } IVolume* CreateVolumeFromDirectory(const std::string& _rDirectory, bool _bIsWii, const std::string& _rApploader, const std::string& _rDOL) @@ -123,7 +123,7 @@ IVolume* CreateVolumeFromDirectory(const std::string& _rDirectory, bool _bIsWii, if (CVolumeDirectory::IsValidDirectory(_rDirectory)) return new CVolumeDirectory(_rDirectory, _bIsWii, _rApploader, _rDOL); - return NULL; + return nullptr; } bool IsVolumeWiiDisc(const IVolume *_rVolume) @@ -152,7 +152,7 @@ static IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _Part // Check if we're looking for a valid partition if ((int)_VolumeNum != -1 && _VolumeNum > numPartitions) - return NULL; + return nullptr; #ifdef _WIN32 struct SPartition @@ -217,7 +217,7 @@ static IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _Part } } - return NULL; + return nullptr; } EDiscType GetDiscType(IBlobReader& _rReader) diff --git a/Source/Core/DiscIO/VolumeDirectory.cpp b/Source/Core/DiscIO/VolumeDirectory.cpp index 50a380a278..a8b350c96b 100644 --- a/Source/Core/DiscIO/VolumeDirectory.cpp +++ b/Source/Core/DiscIO/VolumeDirectory.cpp @@ -26,11 +26,11 @@ CVolumeDirectory::CVolumeDirectory(const std::string& _rDirectory, bool _bIsWii, : m_totalNameSize(0) , m_dataStartAddress(-1) , m_fstSize(0) - , m_FSTData(NULL) + , m_FSTData(nullptr) , m_apploaderSize(0) - , m_apploader(NULL) + , m_apploader(nullptr) , m_DOLSize(0) - , m_DOL(NULL) + , m_DOL(nullptr) , FST_ADDRESS(0) , DOL_ADDRESS(0) { @@ -63,19 +63,19 @@ CVolumeDirectory::CVolumeDirectory(const std::string& _rDirectory, bool _bIsWii, CVolumeDirectory::~CVolumeDirectory() { delete[] m_FSTData; - m_FSTData = NULL; + m_FSTData = nullptr; delete[] m_diskHeader; - m_diskHeader = NULL; + m_diskHeader = nullptr; delete m_diskHeaderInfo; - m_diskHeaderInfo = NULL; + m_diskHeaderInfo = nullptr; delete[] m_DOL; - m_DOL = NULL; + m_DOL = nullptr; delete[] m_apploader; - m_apploader = NULL; + m_apploader = nullptr; } bool CVolumeDirectory::IsValidDirectory(const std::string& _rDirectory) @@ -134,7 +134,7 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const u64 fileOffset = _Offset - fileIter->first; PlainFileReader* reader = PlainFileReader::Create(fileIter->second.c_str()); - if(reader == NULL) + if(reader == nullptr) return false; u64 fileSize = reader->GetDataSize(); diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp index 4e057df78c..63c60a9846 100644 --- a/Source/Core/DiscIO/VolumeGC.cpp +++ b/Source/Core/DiscIO/VolumeGC.cpp @@ -22,12 +22,12 @@ CVolumeGC::CVolumeGC(IBlobReader* _pReader) CVolumeGC::~CVolumeGC() { delete m_pReader; - m_pReader = NULL; // I don't think this makes any difference, but anyway + m_pReader = nullptr; // I don't think this makes any difference, but anyway } bool CVolumeGC::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const { - if (m_pReader == NULL) + if (m_pReader == nullptr) return false; FileMon::FindFilename(_Offset); @@ -43,7 +43,7 @@ bool CVolumeGC::RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const std::string CVolumeGC::GetUniqueID() const { static const std::string NO_UID("NO_UID"); - if (m_pReader == NULL) + if (m_pReader == nullptr) return NO_UID; char ID[7]; @@ -77,7 +77,7 @@ IVolume::ECountry CVolumeGC::GetCountry() const std::string CVolumeGC::GetMakerID() const { - if (m_pReader == NULL) + if (m_pReader == nullptr) return std::string(); char makerID[3]; @@ -107,7 +107,7 @@ std::vector CVolumeGC::GetNames() const auto const string_decoder = GetStringDecoder(GetCountry()); char name[0x60 + 1] = {}; - if (m_pReader != NULL && Read(0x20, 0x60, (u8*)name)) + if (m_pReader != nullptr && Read(0x20, 0x60, (u8*)name)) names.push_back(string_decoder(name)); return names; @@ -115,7 +115,7 @@ std::vector CVolumeGC::GetNames() const u32 CVolumeGC::GetFSTSize() const { - if (m_pReader == NULL) + if (m_pReader == nullptr) return 0; u32 size; @@ -127,7 +127,7 @@ u32 CVolumeGC::GetFSTSize() const std::string CVolumeGC::GetApploaderDate() const { - if (m_pReader == NULL) + if (m_pReader == nullptr) return std::string(); char date[16]; diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp index 0174f951f1..7dd34c9662 100644 --- a/Source/Core/DiscIO/VolumeWad.cpp +++ b/Source/Core/DiscIO/VolumeWad.cpp @@ -46,7 +46,7 @@ CVolumeWAD::~CVolumeWAD() bool CVolumeWAD::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const { - if (m_pReader == NULL) + if (m_pReader == nullptr) return false; return m_pReader->Read(_Offset, _Length, _pBuffer); diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.cpp b/Source/Core/DiscIO/VolumeWiiCrypted.cpp index 76d507d9ec..3770e42383 100644 --- a/Source/Core/DiscIO/VolumeWiiCrypted.cpp +++ b/Source/Core/DiscIO/VolumeWiiCrypted.cpp @@ -21,7 +21,7 @@ namespace DiscIO CVolumeWiiCrypted::CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset, const unsigned char* _pVolumeKey) : m_pReader(_pReader), - m_pBuffer(0), + m_pBuffer(nullptr), m_VolumeOffset(_VolumeOffset), dataOffset(0x20000), m_LastDecryptedBlockOffset(-1) @@ -35,11 +35,11 @@ CVolumeWiiCrypted::CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset, CVolumeWiiCrypted::~CVolumeWiiCrypted() { delete m_pReader; // is this really our responsibility? - m_pReader = NULL; + m_pReader = nullptr; delete[] m_pBuffer; - m_pBuffer = NULL; + m_pBuffer = nullptr; delete m_AES_ctx; - m_AES_ctx = NULL; + m_AES_ctx = nullptr; } bool CVolumeWiiCrypted::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const @@ -56,7 +56,7 @@ bool CVolumeWiiCrypted::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer) const { - if (m_pReader == NULL) + if (m_pReader == nullptr) { return(false); } @@ -119,7 +119,7 @@ void CVolumeWiiCrypted::GetTMD(u8* _pBuffer, u32 * _sz) const std::string CVolumeWiiCrypted::GetUniqueID() const { - if (m_pReader == NULL) + if (m_pReader == nullptr) { return std::string(); } @@ -150,7 +150,7 @@ IVolume::ECountry CVolumeWiiCrypted::GetCountry() const std::string CVolumeWiiCrypted::GetMakerID() const { - if (m_pReader == NULL) + if (m_pReader == nullptr) { return std::string(); } @@ -174,7 +174,7 @@ std::vector CVolumeWiiCrypted::GetNames() const auto const string_decoder = CVolumeGC::GetStringDecoder(GetCountry()); char name[0xFF] = {}; - if (m_pReader != NULL && Read(0x20, 0x60, (u8*)&name)) + if (m_pReader != nullptr && Read(0x20, 0x60, (u8*)&name)) names.push_back(string_decoder(name)); return names; @@ -182,7 +182,7 @@ std::vector CVolumeWiiCrypted::GetNames() const u32 CVolumeWiiCrypted::GetFSTSize() const { - if (m_pReader == NULL) + if (m_pReader == nullptr) { return 0; } @@ -199,7 +199,7 @@ u32 CVolumeWiiCrypted::GetFSTSize() const std::string CVolumeWiiCrypted::GetApploaderDate() const { - if (m_pReader == NULL) + if (m_pReader == nullptr) { return std::string(); } diff --git a/Source/Core/DiscIO/WbfsBlob.cpp b/Source/Core/DiscIO/WbfsBlob.cpp index 4e77d9e959..0a095cf190 100644 --- a/Source/Core/DiscIO/WbfsBlob.cpp +++ b/Source/Core/DiscIO/WbfsBlob.cpp @@ -24,7 +24,7 @@ static inline u64 align(u64 value, u64 bounds) } WbfsFileReader::WbfsFileReader(const char* filename) - : m_total_files(0), m_size(0), m_wlba_table(0), m_good(true) + : m_total_files(0), m_size(0), m_wlba_table(nullptr), m_good(true) { if(!filename || (strlen(filename) < 4) || !OpenFiles(filename) || !ReadHeader()) { @@ -182,7 +182,7 @@ WbfsFileReader* WbfsFileReader::Create(const char* filename) else { delete reader; - return NULL; + return nullptr; } } diff --git a/Source/Core/DiscIO/WiiWad.cpp b/Source/Core/DiscIO/WiiWad.cpp index 4ca2944397..5f1f7be37d 100644 --- a/Source/Core/DiscIO/WiiWad.cpp +++ b/Source/Core/DiscIO/WiiWad.cpp @@ -35,7 +35,7 @@ private: WiiWAD::WiiWAD(const std::string& _rName) { DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName.c_str()); - if (pReader == NULL || File::IsDirectory(_rName)) + if (pReader == nullptr || File::IsDirectory(_rName)) { m_Valid = false; if(pReader) delete pReader; @@ -63,7 +63,7 @@ u8* WiiWAD::CreateWADEntry(DiscIO::IBlobReader& _rReader, u32 _Size, u64 _Offset if (_Size > 0) { u8* pTmpBuffer = new u8[_Size]; - _dbg_assert_msg_(BOOT, pTmpBuffer!=0, "WiiWAD: Cant allocate memory for WAD entry"); + _dbg_assert_msg_(BOOT, pTmpBuffer!=nullptr, "WiiWAD: Cant allocate memory for WAD entry"); if (!_rReader.Read(_Offset, _Size, pTmpBuffer)) { @@ -72,7 +72,7 @@ u8* WiiWAD::CreateWADEntry(DiscIO::IBlobReader& _rReader, u32 _Size, u64 _Offset } return pTmpBuffer; } - return NULL; + return nullptr; } @@ -121,7 +121,7 @@ bool WiiWAD::ParseWAD(DiscIO::IBlobReader& _rReader) bool WiiWAD::IsWiiWAD(const std::string& _rName) { DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName.c_str()); - if (pReader == NULL) + if (pReader == nullptr) return false; CBlobBigEndianReader Reader(*pReader); diff --git a/Source/Core/DolphinWX/ARCodeAddEdit.cpp b/Source/Core/DolphinWX/ARCodeAddEdit.cpp index 7825ec20ef..ec8934d5c9 100644 --- a/Source/Core/DolphinWX/ARCodeAddEdit.cpp +++ b/Source/Core/DolphinWX/ARCodeAddEdit.cpp @@ -112,8 +112,8 @@ void CARCodeAddEdit::SaveCheatData(wxCommandEvent& WXUNUSED (event)) if (pieces.size() == 2 && pieces[0].size() == 8 && pieces[1].size() == 8) { // Decrypted code line. - u32 addr = strtoul(pieces[0].c_str(), NULL, 16); - u32 value = strtoul(pieces[1].c_str(), NULL, 16); + u32 addr = strtoul(pieces[0].c_str(), nullptr, 16); + u32 value = strtoul(pieces[1].c_str(), nullptr, 16); decryptedLines.push_back(ActionReplay::AREntry(addr, value)); continue; diff --git a/Source/Core/DolphinWX/CheatsWindow.cpp b/Source/Core/DolphinWX/CheatsWindow.cpp index e389fa844d..007dcb213a 100644 --- a/Source/Core/DolphinWX/CheatsWindow.cpp +++ b/Source/Core/DolphinWX/CheatsWindow.cpp @@ -72,8 +72,8 @@ wxCheatsWindow::wxCheatsWindow(wxWindow* const parent) wxCheatsWindow::~wxCheatsWindow() { - main_frame->g_CheatsWindow = NULL; - ::g_cheat_window = NULL; + main_frame->g_CheatsWindow = nullptr; + ::g_cheat_window = nullptr; } void wxCheatsWindow::Init_ChildControls() @@ -95,7 +95,7 @@ void wxCheatsWindow::Init_ChildControls() m_GroupBox_Info = new wxStaticBox(m_Tab_Cheats, wxID_ANY, _("Code Info")); m_Label_NumCodes = new wxStaticText(m_Tab_Cheats, wxID_ANY, _("Number Of Codes: ")); - m_ListBox_CodesList = new wxListBox(m_Tab_Cheats, wxID_ANY, wxDefaultPosition, wxSize(120, 150), 0, 0, wxLB_HSCROLL); + m_ListBox_CodesList = new wxListBox(m_Tab_Cheats, wxID_ANY, wxDefaultPosition, wxSize(120, 150), 0, nullptr, wxLB_HSCROLL); wxStaticBoxSizer* sGroupBoxInfo = new wxStaticBoxSizer(m_GroupBox_Info, wxVERTICAL); sGroupBoxInfo->Add(m_Label_Codename, 0, wxALL, 5); @@ -399,7 +399,7 @@ void wxCheatsWindow::OnEvent_CheckBoxEnableLogging_StateChange(wxCommandEvent& W void CheatSearchTab::StartNewSearch(wxCommandEvent& WXUNUSED (event)) { const u8* const memptr = Memory::GetPointer(0); - if (NULL == memptr) + if (nullptr == memptr) { PanicAlertT("A game is not currently running."); return; @@ -433,7 +433,7 @@ void CheatSearchTab::StartNewSearch(wxCommandEvent& WXUNUSED (event)) void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&) { const u8* const memptr = Memory::GetPointer(0); - if (NULL == memptr) + if (nullptr == memptr) { PanicAlertT("A game is not currently running."); return; diff --git a/Source/Core/DolphinWX/ConfigMain.cpp b/Source/Core/DolphinWX/ConfigMain.cpp index c4afb6ba87..dcac884697 100644 --- a/Source/Core/DolphinWX/ConfigMain.cpp +++ b/Source/Core/DolphinWX/ConfigMain.cpp @@ -616,7 +616,7 @@ void CConfigMain::CreateGUIControls() std::for_each(sv.begin(), sv.end(), [theme_selection](const std::string& filename) { std::string name, ext; - SplitPath(filename, NULL, &name, &ext); + SplitPath(filename, nullptr, &name, &ext); name += ext; auto const wxname = StrToWxStr(name); diff --git a/Source/Core/DolphinWX/Debugger/CodeView.cpp b/Source/Core/DolphinWX/Debugger/CodeView.cpp index 04abd447cb..3e1596e8fa 100644 --- a/Source/Core/DolphinWX/Debugger/CodeView.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeView.cpp @@ -335,7 +335,7 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event) void CCodeView::OnMouseUpR(wxMouseEvent& event) { - bool isSymbol = symbol_db->GetSymbolFromAddr(selection) != 0; + bool isSymbol = symbol_db->GetSymbolFromAddr(selection) != nullptr; // popup menu wxMenu* menu = new wxMenu; //menu->Append(IDM_GOTOINMEMVIEW, "&Goto in mem view"); @@ -482,7 +482,7 @@ void CCodeView::OnPaint(wxPaintEvent& event) } if (!found) { - mojs = 0; + mojs = nullptr; break; } } diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp index a5189fa3a3..7f04c03d48 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp @@ -89,13 +89,13 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter wxWindowID id, const wxPoint& position, const wxSize& size, long style, const wxString& name) : wxPanel((wxWindow*)parent, id, position, size, style, name) , Parent(parent) - , m_RegisterWindow(NULL) - , m_BreakpointWindow(NULL) - , m_MemoryWindow(NULL) - , m_JitWindow(NULL) - , m_SoundWindow(NULL) - , m_VideoWindow(NULL) - , codeview(NULL) + , m_RegisterWindow(nullptr) + , m_BreakpointWindow(nullptr) + , m_MemoryWindow(nullptr) + , m_JitWindow(nullptr) + , m_SoundWindow(nullptr) + , m_VideoWindow(nullptr) + , codeview(nullptr) { InitBitmaps(); @@ -111,11 +111,11 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter sizerLeft->Add(callstack = new wxListBox(this, ID_CALLSTACKLIST, wxDefaultPosition, wxSize(90, 100)), 0, wxEXPAND); sizerLeft->Add(symbols = new wxListBox(this, ID_SYMBOLLIST, - wxDefaultPosition, wxSize(90, 100), 0, NULL, wxLB_SORT), 1, wxEXPAND); + wxDefaultPosition, wxSize(90, 100), 0, nullptr, wxLB_SORT), 1, wxEXPAND); sizerLeft->Add(calls = new wxListBox(this, ID_CALLSLIST, wxDefaultPosition, - wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND); + wxSize(90, 100), 0, nullptr, wxLB_SORT), 0, wxEXPAND); sizerLeft->Add(callers = new wxListBox(this, ID_CALLERSLIST, wxDefaultPosition, - wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND); + wxSize(90, 100), 0, nullptr, wxLB_SORT), 0, wxEXPAND); SetSizer(sizerBig); diff --git a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp index d42d227c94..1add1c9600 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp @@ -180,7 +180,7 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event) { case IDM_PROFILEBLOCKS: Core::SetState(Core::CORE_PAUSE); - if (jit != NULL) + if (jit != nullptr) jit->ClearCache(); Profiler::g_ProfileBlocks = GetMenuBar()->IsChecked(IDM_PROFILEBLOCKS); Core::SetState(Core::CORE_RUN); @@ -191,13 +191,13 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event) if (Core::GetState() == Core::CORE_PAUSE && PowerPC::GetMode() == PowerPC::MODE_JIT) { - if (jit != NULL) + if (jit != nullptr) { std::string filename = File::GetUserPath(D_DUMP_IDX) + "Debug/profiler.txt"; File::CreateFullPath(filename); Profiler::WriteProfileResults(filename.c_str()); - wxFileType* filetype = NULL; + wxFileType* filetype = nullptr; if (!(filetype = wxTheMimeTypesManager->GetFileTypeFromExtension(_T("txt")))) { // From extension failed, trying with MIME type now @@ -379,7 +379,7 @@ void CCodeWindow::OnSymbolListChange(wxCommandEvent& event) int index = symbols->GetSelection(); if (index >= 0) { Symbol* pSymbol = static_cast(symbols->GetClientData(index)); - if (pSymbol != NULL) + if (pSymbol != nullptr) { if(pSymbol->type == Symbol::SYMBOL_DATA) { @@ -456,7 +456,7 @@ void CCodeWindow::ToggleRegisterWindow(bool bShow) else // Close { Parent->DoRemovePage(m_RegisterWindow, false); - m_RegisterWindow = NULL; + m_RegisterWindow = nullptr; } } @@ -474,7 +474,7 @@ void CCodeWindow::ToggleBreakPointWindow(bool bShow) else // Close { Parent->DoRemovePage(m_BreakpointWindow, false); - m_BreakpointWindow = NULL; + m_BreakpointWindow = nullptr; } } @@ -492,7 +492,7 @@ void CCodeWindow::ToggleMemoryWindow(bool bShow) else // Close { Parent->DoRemovePage(m_MemoryWindow, false); - m_MemoryWindow = NULL; + m_MemoryWindow = nullptr; } } @@ -510,7 +510,7 @@ void CCodeWindow::ToggleJitWindow(bool bShow) else // Close { Parent->DoRemovePage(m_JitWindow, false); - m_JitWindow = NULL; + m_JitWindow = nullptr; } } @@ -529,7 +529,7 @@ void CCodeWindow::ToggleSoundWindow(bool bShow) else // Close { Parent->DoRemovePage(m_SoundWindow, false); - m_SoundWindow = NULL; + m_SoundWindow = nullptr; } } @@ -547,6 +547,6 @@ void CCodeWindow::ToggleVideoWindow(bool bShow) else // Close { Parent->DoRemovePage(m_VideoWindow, false); - m_VideoWindow = NULL; + m_VideoWindow = nullptr; } } diff --git a/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp b/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp index b755af5993..f9fd51eec0 100644 --- a/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp @@ -34,7 +34,7 @@ class wxWindow; -DSPDebuggerLLE* m_DebuggerFrame = NULL; +DSPDebuggerLLE* m_DebuggerFrame = nullptr; BEGIN_EVENT_TABLE(DSPDebuggerLLE, wxPanel) EVT_CLOSE(DSPDebuggerLLE::OnClose) @@ -69,7 +69,7 @@ DSPDebuggerLLE::DSPDebuggerLLE(wxWindow* parent, wxWindowID id) m_Toolbar->Realize(); m_SymbolList = new wxListBox(this, ID_SYMBOLLIST, wxDefaultPosition, - wxSize(140, 100), 0, NULL, wxLB_SORT); + wxSize(140, 100), 0, nullptr, wxLB_SORT); m_MainNotebook = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, @@ -118,7 +118,7 @@ DSPDebuggerLLE::DSPDebuggerLLE(wxWindow* parent, wxWindowID id) DSPDebuggerLLE::~DSPDebuggerLLE() { m_mgr.UnInit(); - m_DebuggerFrame = NULL; + m_DebuggerFrame = nullptr; } void DSPDebuggerLLE::OnClose(wxCloseEvent& event) @@ -217,7 +217,7 @@ void DSPDebuggerLLE::UpdateDisAsmListView() void DSPDebuggerLLE::UpdateSymbolMap() { - if (g_dsp.dram == NULL) + if (g_dsp.dram == nullptr) return; m_SymbolList->Freeze(); // HyperIris: wx style fast filling @@ -235,7 +235,7 @@ void DSPDebuggerLLE::OnSymbolListChange(wxCommandEvent& event) int index = m_SymbolList->GetSelection(); if (index >= 0) { Symbol* pSymbol = static_cast(m_SymbolList->GetClientData(index)); - if (pSymbol != NULL) + if (pSymbol != nullptr) { if (pSymbol->type == Symbol::SYMBOL_FUNCTION) { diff --git a/Source/Core/DolphinWX/Debugger/DebuggerPanel.cpp b/Source/Core/DolphinWX/Debugger/DebuggerPanel.cpp index 16944ba968..2b16e4baf3 100644 --- a/Source/Core/DolphinWX/Debugger/DebuggerPanel.cpp +++ b/Source/Core/DolphinWX/Debugger/DebuggerPanel.cpp @@ -62,7 +62,7 @@ GFXDebuggerPanel::GFXDebuggerPanel(wxWindow *parent, wxWindowID id, const wxPoin GFXDebuggerPanel::~GFXDebuggerPanel() { - g_pdebugger = NULL; + g_pdebugger = nullptr; GFXDebuggerPauseFlag = false; } @@ -154,7 +154,7 @@ void GFXDebuggerPanel::CreateGUIControls() m_pCount = new wxTextCtrl(this, ID_COUNT, wxT("1"), wxDefaultPosition, wxSize(50,25), wxTE_RIGHT, wxDefaultValidator, _("Count")); - m_pPauseAtList = new wxChoice(this, ID_PAUSE_AT_LIST, wxDefaultPosition, wxSize(100,25), 0, NULL,0,wxDefaultValidator, _("PauseAtList")); + m_pPauseAtList = new wxChoice(this, ID_PAUSE_AT_LIST, wxDefaultPosition, wxSize(100,25), 0, nullptr,0,wxDefaultValidator, _("PauseAtList")); for (int i=0; iAppend(pauseEventMap[i].ListStr); @@ -168,7 +168,7 @@ void GFXDebuggerPanel::CreateGUIControls() m_pButtonClearVertexShaderCache = new wxButton(this, ID_CLEAR_VERTEX_SHADER_CACHE, _("Clear V Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Clear V Shaders")); m_pButtonClearPixelShaderCache = new wxButton(this, ID_CLEAR_PIXEL_SHADER_CACHE, _("Clear P Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Clear P Shaders")); - m_pDumpList = new wxChoice(this, ID_DUMP_LIST, wxDefaultPosition, wxSize(120,25), 0, NULL, 0 ,wxDefaultValidator, _("DumpList")); + m_pDumpList = new wxChoice(this, ID_DUMP_LIST, wxDefaultPosition, wxSize(120,25), 0, nullptr, 0 ,wxDefaultValidator, _("DumpList")); m_pDumpList->Insert(_("Pixel Shader"),0); m_pDumpList->Append(_("Vertex Shader")); m_pDumpList->Append(_("Pixel Shader Constants")); diff --git a/Source/Core/DolphinWX/Debugger/MemoryView.cpp b/Source/Core/DolphinWX/Debugger/MemoryView.cpp index 862d186c52..dc2fa29e9b 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryView.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryView.cpp @@ -213,10 +213,10 @@ void CMemoryView::OnPaint(wxPaintEvent& event) hFont.SetFamily(wxFONTFAMILY_TELETYPE); wxCoord w,h; - dc.GetTextExtent(_T("0WJyq"),&w,&h,NULL,NULL,&hFont); + dc.GetTextExtent(_T("0WJyq"),&w,&h,nullptr,nullptr,&hFont); if (h > rowHeight) rowHeight = h; - dc.GetTextExtent(_T("0WJyq"),&w,&h,NULL,NULL,&DebuggerFont); + dc.GetTextExtent(_T("0WJyq"),&w,&h,nullptr,nullptr,&DebuggerFont); if (h > rowHeight) rowHeight = h; diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index b52305fe1a..5aedae6e68 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -87,7 +87,7 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, DebugInterface* di = &PowerPC::debug_interface; //symbols = new wxListBox(this, IDM_SYMBOLLIST, wxDefaultPosition, - // wxSize(20, 100), 0, NULL, wxLB_SORT); + // wxSize(20, 100), 0, nullptr, wxLB_SORT); //sizerLeft->Add(symbols, 1, wxEXPAND); memview = new CMemoryView(di, this); memview->dataType = 0; @@ -220,7 +220,7 @@ void CMemoryWindow::OnSymbolListChange(wxCommandEvent& event) if (index >= 0) { Symbol* pSymbol = static_cast(symbols->GetClientData(index)); - if (pSymbol != NULL) + if (pSymbol != nullptr) { memview->Center(pSymbol->address); } @@ -297,7 +297,7 @@ void CMemoryWindow::U32(wxCommandEvent& event) void CMemoryWindow::onSearch(wxCommandEvent& event) { - u8* TheRAM = 0; + u8* TheRAM = nullptr; u32 szRAM = 0; switch (memview->GetMemoryType()) { @@ -331,8 +331,8 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) long count = 0; char copy[3] = {0}; long newsize = 0; - unsigned char *tmp2 = 0; - char* tmpstr = 0; + unsigned char *tmp2 = nullptr; + char* tmpstr = nullptr; if (chkHex->GetValue()) { diff --git a/Source/Core/DolphinWX/Debugger/RegisterWindow.cpp b/Source/Core/DolphinWX/Debugger/RegisterWindow.cpp index 5188f87186..b34883ea32 100644 --- a/Source/Core/DolphinWX/Debugger/RegisterWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/RegisterWindow.cpp @@ -26,7 +26,7 @@ CRegisterWindow::CRegisterWindow(wxWindow* parent, wxWindowID id, const wxPoint& position, const wxSize& size, long style, const wxString& name) : wxPanel(parent, id, position, size, style, name) - , m_GPRGridView(NULL) + , m_GPRGridView(nullptr) { CreateGUIControls(); } @@ -43,6 +43,6 @@ void CRegisterWindow::CreateGUIControls() void CRegisterWindow::NotifyUpdate() { - if (m_GPRGridView != NULL) + if (m_GPRGridView != nullptr) m_GPRGridView->Update(); } diff --git a/Source/Core/DolphinWX/FifoPlayerDlg.cpp b/Source/Core/DolphinWX/FifoPlayerDlg.cpp index aac02d4005..baa5aace96 100644 --- a/Source/Core/DolphinWX/FifoPlayerDlg.cpp +++ b/Source/Core/DolphinWX/FifoPlayerDlg.cpp @@ -53,7 +53,7 @@ DEFINE_EVENT_TYPE(FRAME_WRITTEN_EVENT) using namespace std; std::recursive_mutex sMutex; -wxEvtHandler *volatile FifoPlayerDlg::m_EvtHandler = NULL; +wxEvtHandler *volatile FifoPlayerDlg::m_EvtHandler = nullptr; FifoPlayerDlg::FifoPlayerDlg(wxWindow * const parent) : wxDialog(parent, wxID_ANY, _("FIFO Player")), @@ -90,10 +90,10 @@ FifoPlayerDlg::~FifoPlayerDlg() m_objectsList->Unbind(wxEVT_COMMAND_LISTBOX_SELECTED, &FifoPlayerDlg::OnObjectListSelectionChanged, this); m_objectCmdList->Unbind(wxEVT_COMMAND_LISTBOX_SELECTED, &FifoPlayerDlg::OnObjectCmdListSelectionChanged, this); - FifoPlayer::GetInstance().SetFrameWrittenCallback(NULL); + FifoPlayer::GetInstance().SetFrameWrittenCallback(nullptr); sMutex.lock(); - m_EvtHandler = NULL; + m_EvtHandler = nullptr; sMutex.unlock(); } @@ -978,7 +978,7 @@ wxString FifoPlayerDlg::CreateIntegerLabel(size_t size, const wxString& label) c bool FifoPlayerDlg::GetSaveButtonEnabled() const { - return (FifoRecorder::GetInstance().GetRecordedFile() != NULL); + return (FifoRecorder::GetInstance().GetRecordedFile() != nullptr); } void FifoPlayerDlg::RecordingFinished() diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index abb35f390f..8e3a6ea86c 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -139,7 +139,7 @@ CRenderFrame::CRenderFrame(wxFrame* parent, wxWindowID id, const wxString& title SetIcon(IconTemp); DragAcceptFiles(true); - Connect(wxEVT_DROP_FILES, wxDropFilesEventHandler(CRenderFrame::OnDropFiles), NULL, this); + Connect(wxEVT_DROP_FILES, wxDropFilesEventHandler(CRenderFrame::OnDropFiles), nullptr, this); } void CRenderFrame::OnDropFiles(wxDropFilesEvent& event) @@ -298,12 +298,12 @@ CFrame::CFrame(wxFrame* parent, bool ShowLogWindow, long style) : CRenderFrame(parent, id, title, pos, size, style) - , g_pCodeWindow(NULL), g_NetPlaySetupDiag(NULL), g_CheatsWindow(NULL) - , m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL) - , m_GameListCtrl(NULL), m_Panel(NULL) - , m_RenderFrame(NULL), m_RenderParent(NULL) - , m_LogWindow(NULL), m_LogConfigWindow(NULL) - , m_FifoPlayerDlg(NULL), UseDebugger(_UseDebugger) + , g_pCodeWindow(nullptr), g_NetPlaySetupDiag(nullptr), g_CheatsWindow(nullptr) + , m_ToolBar(nullptr), m_ToolBarDebug(nullptr), m_ToolBarAui(nullptr) + , m_GameListCtrl(nullptr), m_Panel(nullptr) + , m_RenderFrame(nullptr), m_RenderParent(nullptr) + , m_LogWindow(nullptr), m_LogConfigWindow(nullptr) + , m_FifoPlayerDlg(nullptr), UseDebugger(_UseDebugger) , m_bBatchMode(_BatchMode), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false) , m_bGameLoading(false) { @@ -442,7 +442,7 @@ bool CFrame::RendererIsFullscreen() } #if defined(__APPLE__) - if (m_RenderFrame != NULL) + if (m_RenderFrame != nullptr) { NSView *view = (NSView *) m_RenderFrame->GetHandle(); NSWindow *window = [view window]; @@ -512,7 +512,7 @@ void CFrame::OnClose(wxCloseEvent& event) { // Close the log window now so that its settings are saved m_LogWindow->Close(); - m_LogWindow = NULL; + m_LogWindow = nullptr; } @@ -608,12 +608,12 @@ void CFrame::OnHostMessage(wxCommandEvent& event) break; case IDM_UPDATESTATUSBAR: - if (GetStatusBar() != NULL) + if (GetStatusBar() != nullptr) GetStatusBar()->SetStatusText(event.GetString(), event.GetInt()); break; case IDM_UPDATETITLE: - if (m_RenderFrame != NULL) + if (m_RenderFrame != nullptr) m_RenderFrame->SetTitle(event.GetString()); break; @@ -700,13 +700,13 @@ void CFrame::OnRenderWindowSizeRequest(int width, int height) bool CFrame::RendererHasFocus() { - if (m_RenderParent == NULL) + if (m_RenderParent == nullptr) return false; #ifdef _WIN32 if (m_RenderParent->GetParent()->GetHWND() == GetForegroundWindow()) return true; #else - if (wxWindow::FindFocus() == NULL) + if (wxWindow::FindFocus() == nullptr) return false; // Why these different cases? if (m_RenderParent == wxWindow::FindFocus() || diff --git a/Source/Core/DolphinWX/Frame.h b/Source/Core/DolphinWX/Frame.h index 9cfbdb6e7b..8f7e0732c7 100644 --- a/Source/Core/DolphinWX/Frame.h +++ b/Source/Core/DolphinWX/Frame.h @@ -138,7 +138,7 @@ public: bool RendererHasFocus(); void DoFullscreen(bool bF); void ToggleDisplayMode (bool bFullscreen); - void UpdateWiiMenuChoice(wxMenuItem *WiiMenuItem=NULL); + void UpdateWiiMenuChoice(wxMenuItem *WiiMenuItem=nullptr); static void ConnectWiimote(int wm_idx, bool connect); const CGameListCtrl *GetGameListCtrl() const; @@ -244,7 +244,7 @@ private: void DoFloatNotebookPage(wxWindowID Id); wxFrame * CreateParentFrame(wxWindowID Id = wxID_ANY, const wxString& title = wxT(""), - wxWindow * = NULL); + wxWindow * = nullptr); wxString AuiFullscreen, AuiCurrent; void AddPane(); void UpdateCurrentPerspective(); diff --git a/Source/Core/DolphinWX/FrameAui.cpp b/Source/Core/DolphinWX/FrameAui.cpp index e3ae6c7ad6..4845083c39 100644 --- a/Source/Core/DolphinWX/FrameAui.cpp +++ b/Source/Core/DolphinWX/FrameAui.cpp @@ -151,7 +151,7 @@ void CFrame::ToggleLogConfigWindow(bool bShow) else { DoRemovePage(m_LogConfigWindow, false); - m_LogConfigWindow = NULL; + m_LogConfigWindow = nullptr; } // Hide or Show the pane @@ -388,7 +388,7 @@ void CFrame::ShowResizePane() void CFrame::TogglePane() { // Get the first notebook - wxAuiNotebook * NB = NULL; + wxAuiNotebook * NB = nullptr; for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) { if (m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) @@ -983,7 +983,7 @@ wxWindow * CFrame::GetNotebookPageFromId(wxWindowID Id) return NB->GetPage(j); } } - return NULL; + return nullptr; } wxFrame* CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title, wxWindow* Child) @@ -1088,5 +1088,5 @@ wxAuiNotebook * CFrame::GetNotebookFromId(u32 NBId) return (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; j++; } - return NULL; + return nullptr; } diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 06ae7b962b..a2a5c41330 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -584,7 +584,7 @@ void CFrame::InitBitmaps() m_Bitmaps[Toolbar_FullScreen].LoadFile(dir + "fullscreen.png", wxBITMAP_TYPE_PNG); // Update in case the bitmap has been updated - if (m_ToolBar != NULL) + if (m_ToolBar != nullptr) RecreateToolbar(); } @@ -608,7 +608,7 @@ void CFrame::BootGame(const std::string& filename) // If all that fails, ask to add a dir and don't boot if (bootfile.empty()) { - if (m_GameListCtrl->GetSelectedISO() != NULL) + if (m_GameListCtrl->GetSelectedISO() != nullptr) { if (m_GameListCtrl->GetSelectedISO()->IsValid()) bootfile = m_GameListCtrl->GetSelectedISO()->GetFileName(); @@ -872,7 +872,7 @@ void CFrame::ToggleDisplayMode(bool bFullscreen) else { // Change to default resolution - ChangeDisplaySettings(NULL, CDS_FULLSCREEN); + ChangeDisplaySettings(nullptr, CDS_FULLSCREEN); } #elif defined(HAVE_XRANDR) && HAVE_XRANDR if (SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution != "Auto") @@ -967,7 +967,7 @@ void CFrame::StartGame(const std::string& filename) // Destroy the renderer frame when not rendering to main if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain) m_RenderFrame->Destroy(); - m_RenderParent = NULL; + m_RenderParent = nullptr; m_bGameLoading = false; UpdateGUI(); } @@ -1060,7 +1060,7 @@ void CFrame::DoStop() m_bGameLoading = false; if (Core::GetState() != Core::CORE_UNINITIALIZED || - m_RenderParent != NULL) + m_RenderParent != nullptr) { #if defined __WXGTK__ wxMutexGuiLeave(); @@ -1140,7 +1140,7 @@ void CFrame::DoStop() // Make sure the window is not longer set to stay on top m_RenderFrame->SetWindowStyle(m_RenderFrame->GetWindowStyle() & ~wxSTAY_ON_TOP); } - m_RenderParent = NULL; + m_RenderParent = nullptr; // Clean framerate indications from the status bar. GetStatusBar()->SetStatusText(wxT(" "), 0); @@ -1339,7 +1339,7 @@ void CFrame::OnNetPlay(wxCommandEvent& WXUNUSED (event)) { if (!g_NetPlaySetupDiag) { - if (NetPlayDiag::GetInstance() != NULL) + if (NetPlayDiag::GetInstance() != nullptr) NetPlayDiag::GetInstance()->Raise(); else g_NetPlaySetupDiag = new NetPlaySetupDiag(this, m_GameListCtrl); @@ -1736,7 +1736,7 @@ void CFrame::UpdateGUI() m_GameListCtrl->Show(); } // Game has been selected but not started, enable play button - if (m_GameListCtrl->GetSelectedISO() != NULL && m_GameListCtrl->IsEnabled()) + if (m_GameListCtrl->GetSelectedISO() != nullptr && m_GameListCtrl->IsEnabled()) { if (m_ToolBar) m_ToolBar->EnableTool(IDM_PLAY, true); diff --git a/Source/Core/DolphinWX/GLInterface/EGL.cpp b/Source/Core/DolphinWX/GLInterface/EGL.cpp index 6a25aa4411..20db616921 100644 --- a/Source/Core/DolphinWX/GLInterface/EGL.cpp +++ b/Source/Core/DolphinWX/GLInterface/EGL.cpp @@ -31,7 +31,7 @@ void cInterfaceEGL::DetectMode() return; EGLint num_configs; - EGLConfig *config = NULL; + EGLConfig *config = nullptr; bool supportsGL = false, supportsGLES2 = false, supportsGLES3 = false; // attributes for a visual in RGBA format with at least @@ -43,7 +43,7 @@ void cInterfaceEGL::DetectMode() EGL_NONE }; // Get how many configs there are - if (!eglChooseConfig( GLWin.egl_dpy, attribs, NULL, 0, &num_configs)) + if (!eglChooseConfig( GLWin.egl_dpy, attribs, nullptr, 0, &num_configs)) { INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n"); goto err_exit; @@ -186,7 +186,7 @@ bool cInterfaceEGL::Create(void *&window_handle) GLWin.native_window = Platform.CreateWindow(); - GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config, GLWin.native_window, NULL); + GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config, GLWin.native_window, nullptr); if (!GLWin.egl_surf) { INFO_LOG(VIDEO, "Error: eglCreateWindowSurface failed\n"); @@ -218,6 +218,6 @@ void cInterfaceEGL::Shutdown() NOTICE_LOG(VIDEO, "Could not destroy window surface."); if(!eglTerminate(GLWin.egl_dpy)) NOTICE_LOG(VIDEO, "Could not destroy display connection."); - GLWin.egl_ctx = NULL; + GLWin.egl_ctx = nullptr; } } diff --git a/Source/Core/DolphinWX/GLInterface/GLX.cpp b/Source/Core/DolphinWX/GLInterface/GLX.cpp index ce61989efa..2735eb2b6e 100644 --- a/Source/Core/DolphinWX/GLInterface/GLX.cpp +++ b/Source/Core/DolphinWX/GLInterface/GLX.cpp @@ -10,7 +10,7 @@ #include "VideoCommon/VideoConfig.h" typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval); -PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL; +PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = nullptr; // Show the current FPS void cInterfaceGLX::UpdateFPSDisplay(const char *text) @@ -71,8 +71,8 @@ bool cInterfaceGLX::Create(void *&window_handle) GLX_DOUBLEBUFFER, None }; - GLWin.dpy = XOpenDisplay(0); - GLWin.evdpy = XOpenDisplay(0); + GLWin.dpy = XOpenDisplay(nullptr); + GLWin.evdpy = XOpenDisplay(nullptr); GLWin.parent = (Window)window_handle; GLWin.screen = DefaultScreen(GLWin.dpy); if (GLWin.parent == 0) @@ -83,17 +83,17 @@ bool cInterfaceGLX::Create(void *&window_handle) // Get an appropriate visual GLWin.vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListDbl); - if (GLWin.vi == NULL) + if (GLWin.vi == nullptr) { GLWin.vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListSgl); - if (GLWin.vi != NULL) + if (GLWin.vi != nullptr) { ERROR_LOG(VIDEO, "Only single buffered visual!"); } else { GLWin.vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListDefault); - if (GLWin.vi == NULL) + if (GLWin.vi == nullptr) { ERROR_LOG(VIDEO, "Could not choose visual (glXChooseVisual)"); return false; @@ -104,7 +104,7 @@ bool cInterfaceGLX::Create(void *&window_handle) NOTICE_LOG(VIDEO, "Got double buffered visual!"); // Create a GLX context. - GLWin.ctx = glXCreateContext(GLWin.dpy, GLWin.vi, 0, GL_TRUE); + GLWin.ctx = glXCreateContext(GLWin.dpy, GLWin.vi, nullptr, GL_TRUE); if (!GLWin.ctx) { PanicAlert("Unable to create GLX context."); @@ -142,7 +142,7 @@ bool cInterfaceGLX::MakeCurrent() bool cInterfaceGLX::ClearCurrent() { - return glXMakeCurrent(GLWin.dpy, None, NULL); + return glXMakeCurrent(GLWin.dpy, None, nullptr); } @@ -155,7 +155,7 @@ void cInterfaceGLX::Shutdown() glXDestroyContext(GLWin.dpy, GLWin.ctx); XCloseDisplay(GLWin.dpy); XCloseDisplay(GLWin.evdpy); - GLWin.ctx = NULL; + GLWin.ctx = nullptr; } } diff --git a/Source/Core/DolphinWX/GLInterface/InterfaceBase.h b/Source/Core/DolphinWX/GLInterface/InterfaceBase.h index e01539ab5d..f6091d5221 100644 --- a/Source/Core/DolphinWX/GLInterface/InterfaceBase.h +++ b/Source/Core/DolphinWX/GLInterface/InterfaceBase.h @@ -26,7 +26,7 @@ public: virtual void UpdateFPSDisplay(const char *Text) {} virtual void SetMode(u32 mode) { s_opengl_mode = GLInterfaceMode::MODE_OPENGL; } virtual u32 GetMode() { return s_opengl_mode; } - virtual void* GetFuncAddress(std::string name) { return NULL; } + virtual void* GetFuncAddress(std::string name) { return nullptr; } virtual bool Create(void *&window_handle) { return true; } virtual bool MakeCurrent() { return true; } virtual bool ClearCurrent() { return true; } diff --git a/Source/Core/DolphinWX/GLInterface/Platform.cpp b/Source/Core/DolphinWX/GLInterface/Platform.cpp index 816731a249..66f7d3ce61 100644 --- a/Source/Core/DolphinWX/GLInterface/Platform.cpp +++ b/Source/Core/DolphinWX/GLInterface/Platform.cpp @@ -62,7 +62,7 @@ bool cPlatform::SelectDisplay(void) #endif platform_env); free(platform_env); - platform_env = NULL; + platform_env = nullptr; } #if HAVE_WAYLAND if (wayland_possible) @@ -154,7 +154,7 @@ EGLDisplay cPlatform::EGLGetDisplay(void) #ifdef ANDROID return eglGetDisplay(EGL_DEFAULT_DISPLAY); #endif - return NULL; + return nullptr; } EGLNativeWindowType cPlatform::CreateWindow(void) diff --git a/Source/Core/DolphinWX/GLInterface/WGL.cpp b/Source/Core/DolphinWX/GLInterface/WGL.cpp index db3bc3d0f1..69a8e44924 100644 --- a/Source/Core/DolphinWX/GLInterface/WGL.cpp +++ b/Source/Core/DolphinWX/GLInterface/WGL.cpp @@ -11,13 +11,13 @@ #include "VideoCommon/VertexShaderManager.h" #include "VideoCommon/VideoConfig.h" -static HDC hDC = NULL; // Private GDI Device Context -static HGLRC hRC = NULL; // Permanent Rendering Context -static HINSTANCE dllHandle = NULL; // Handle to OpenGL32.dll +static HDC hDC = nullptr; // Private GDI Device Context +static HGLRC hRC = nullptr; // Permanent Rendering Context +static HINSTANCE dllHandle = nullptr; // Handle to OpenGL32.dll // typedef from wglext.h typedef BOOL(WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); -static PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL; +static PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = nullptr; void cInterfaceWGL::SwapInterval(int Interval) { @@ -34,9 +34,9 @@ void cInterfaceWGL::Swap() void* cInterfaceWGL::GetFuncAddress(std::string name) { void* func = (void*)wglGetProcAddress((LPCSTR)name.c_str()); - if (func == NULL) + if (func == nullptr) func = (void*)GetProcAddress(dllHandle, (LPCSTR)name.c_str()); - return func; + return func; } // Draw messages on top of the screen @@ -78,7 +78,7 @@ bool cInterfaceWGL::Create(void *&window_handle) #endif window_handle = (void*)EmuWindow::Create((HWND)window_handle, GetModuleHandle(0), _T("Please wait...")); - if (window_handle == NULL) + if (window_handle == nullptr) { Host_SysMessage("failed to create window"); return false; @@ -138,7 +138,7 @@ bool cInterfaceWGL::MakeCurrent() bool cInterfaceWGL::ClearCurrent() { - bool success = wglMakeCurrent(hDC, NULL) ? true : false; + bool success = wglMakeCurrent(hDC, nullptr) ? true : false; if (success) { // Grab the swap interval function pointer @@ -183,19 +183,19 @@ void cInterfaceWGL::Shutdown() { if (hRC) { - if (!wglMakeCurrent(NULL, NULL)) + if (!wglMakeCurrent(nullptr, nullptr)) NOTICE_LOG(VIDEO, "Could not release drawing context."); if (!wglDeleteContext(hRC)) ERROR_LOG(VIDEO, "Attempt to release rendering context failed."); - hRC = NULL; + hRC = nullptr; } if (hDC && !ReleaseDC(EmuWindow::GetWnd(), hDC)) { ERROR_LOG(VIDEO, "Attempt to release device context failed."); - hDC = NULL; + hDC = nullptr; } } diff --git a/Source/Core/DolphinWX/GLInterface/Wayland_Util.cpp b/Source/Core/DolphinWX/GLInterface/Wayland_Util.cpp index 19dbb7ab02..ccd9ed7101 100644 --- a/Source/Core/DolphinWX/GLInterface/Wayland_Util.cpp +++ b/Source/Core/DolphinWX/GLInterface/Wayland_Util.cpp @@ -16,7 +16,7 @@ hide_cursor(void) return; wl_pointer_set_cursor(GLWin.pointer.wl_pointer, - GLWin.pointer.serial, NULL, 0, 0); + GLWin.pointer.serial, nullptr, 0, 0); } static void @@ -104,10 +104,10 @@ toggle_fullscreen(bool fullscreen) if (fullscreen) { wl_shell_surface_set_fullscreen(GLWin.wl_shell_surface, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, - 0, NULL); + 0, nullptr); } else { wl_shell_surface_set_toplevel(GLWin.wl_shell_surface); - handle_configure(NULL, GLWin.wl_shell_surface, 0, + handle_configure(nullptr, GLWin.wl_shell_surface, 0, GLWin.window_size.width, GLWin.window_size.height); } @@ -124,7 +124,7 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, return; } - map_str = (char *) mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); + map_str = (char *) mmap(nullptr, size, PROT_READ, MAP_SHARED, fd, 0); if (map_str == MAP_FAILED) { close(fd); return; @@ -146,7 +146,7 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, if (!GLWin.keyboard.xkb.state) { fprintf(stderr, "failed to create XKB state\n"); xkb_map_unref(GLWin.keyboard.xkb.keymap); - GLWin.keyboard.xkb.keymap = NULL; + GLWin.keyboard.xkb.keymap = nullptr; return; } @@ -244,15 +244,15 @@ static void seat_handle_capabilities(void *data, struct wl_seat *seat, uint32_t caps) { - struct wl_pointer *wl_pointer = NULL; - struct wl_keyboard *wl_keyboard = NULL; + struct wl_pointer *wl_pointer = nullptr; + struct wl_keyboard *wl_keyboard = nullptr; if ((caps & WL_SEAT_CAPABILITY_POINTER) && !wl_pointer) { wl_pointer = wl_seat_get_pointer(seat); wl_pointer_add_listener(wl_pointer, &pointer_listener, 0); } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && wl_pointer) { wl_pointer_destroy(wl_pointer); - wl_pointer = NULL; + wl_pointer = nullptr; } GLWin.pointer.wl_pointer = wl_pointer; @@ -262,7 +262,7 @@ seat_handle_capabilities(void *data, struct wl_seat *seat, wl_keyboard_add_listener(wl_keyboard, &keyboard_listener, 0); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && wl_keyboard) { wl_keyboard_destroy(wl_keyboard); - wl_keyboard = NULL; + wl_keyboard = nullptr; } GLWin.keyboard.wl_keyboard = wl_keyboard; @@ -290,7 +290,7 @@ registry_handle_global(void *data, struct wl_registry *registry, } else if (strcmp(interface, "wl_shm") == 0) { GLWin.wl_shm = (wl_shm *) wl_registry_bind(registry, name, &wl_shm_interface, 1); - GLWin.wl_cursor_theme = (wl_cursor_theme *) wl_cursor_theme_load(NULL, 32, GLWin.wl_shm); + GLWin.wl_cursor_theme = (wl_cursor_theme *) wl_cursor_theme_load(nullptr, 32, GLWin.wl_shm); GLWin.wl_cursor = (wl_cursor *) wl_cursor_theme_get_cursor(GLWin.wl_cursor_theme, "left_ptr"); } @@ -309,7 +309,7 @@ static const struct wl_registry_listener registry_listener = { bool cWaylandInterface::ServerConnect(void) { - GLWin.wl_display = wl_display_connect(NULL); + GLWin.wl_display = wl_display_connect(nullptr); if (!GLWin.wl_display) return false; @@ -324,18 +324,18 @@ bool cWaylandInterface::Initialize(void *config) return false; } - GLWin.pointer.wl_pointer = NULL; - GLWin.keyboard.wl_keyboard = NULL; + GLWin.pointer.wl_pointer = nullptr; + GLWin.keyboard.wl_keyboard = nullptr; GLWin.keyboard.xkb.context = xkb_context_new((xkb_context_flags) 0); - if (GLWin.keyboard.xkb.context == NULL) { + if (GLWin.keyboard.xkb.context == nullptr) { fprintf(stderr, "Failed to create XKB context\n"); - return NULL; + return nullptr; } GLWin.wl_registry = wl_display_get_registry(GLWin.wl_display); wl_registry_add_listener(GLWin.wl_registry, - ®istry_listener, NULL); + ®istry_listener, nullptr); while (!GLWin.wl_compositor) wl_display_dispatch(GLWin.wl_display); diff --git a/Source/Core/DolphinWX/GLInterface/X11_Util.cpp b/Source/Core/DolphinWX/GLInterface/X11_Util.cpp index d3f4c5b9f2..93e510af65 100644 --- a/Source/Core/DolphinWX/GLInterface/X11_Util.cpp +++ b/Source/Core/DolphinWX/GLInterface/X11_Util.cpp @@ -9,7 +9,7 @@ #if USE_EGL bool cXInterface::ServerConnect(void) { - GLWin.dpy = XOpenDisplay(NULL); + GLWin.dpy = XOpenDisplay(nullptr); if (!GLWin.dpy) return false; @@ -49,7 +49,7 @@ bool cXInterface::Initialize(void *config, void *window_handle) GLWin.width = _twidth; GLWin.height = _theight; - GLWin.evdpy = XOpenDisplay(NULL); + GLWin.evdpy = XOpenDisplay(nullptr); GLWin.parent = (Window) window_handle; GLWin.screen = DefaultScreen(GLWin.dpy); @@ -86,7 +86,7 @@ void *cXInterface::CreateWindow(void) CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr); wmProtocols[0] = XInternAtom(GLWin.evdpy, "WM_DELETE_WINDOW", True); XSetWMProtocols(GLWin.evdpy, GLWin.win, wmProtocols, 1); - XSetStandardProperties(GLWin.evdpy, GLWin.win, "GPU", "GPU", None, NULL, 0, NULL); + XSetStandardProperties(GLWin.evdpy, GLWin.win, "GPU", "GPU", None, nullptr, 0, nullptr); XMapRaised(GLWin.evdpy, GLWin.win); XSync(GLWin.evdpy, True); @@ -136,7 +136,7 @@ void cX11Window::CreateXWindow(void) CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr); wmProtocols[0] = XInternAtom(GLWin.evdpy, "WM_DELETE_WINDOW", True); XSetWMProtocols(GLWin.evdpy, GLWin.win, wmProtocols, 1); - XSetStandardProperties(GLWin.evdpy, GLWin.win, "GPU", "GPU", None, NULL, 0, NULL); + XSetStandardProperties(GLWin.evdpy, GLWin.win, "GPU", "GPU", None, nullptr, 0, nullptr); XMapRaised(GLWin.evdpy, GLWin.win); XSync(GLWin.evdpy, True); diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index 305855dbcd..25212818a9 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -211,10 +211,10 @@ END_EVENT_TABLE() CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style) - : wxListCtrl(parent, id, pos, size, style), toolTip(0) + : wxListCtrl(parent, id, pos, size, style), toolTip(nullptr) { DragAcceptFiles(true); - Connect(wxEVT_DROP_FILES, wxDropFilesEventHandler(CGameListCtrl::OnDropFiles), NULL, this); + Connect(wxEVT_DROP_FILES, wxDropFilesEventHandler(CGameListCtrl::OnDropFiles), nullptr, this); } CGameListCtrl::~CGameListCtrl() @@ -292,7 +292,7 @@ void CGameListCtrl::Update() if (m_imageListSmall) { delete m_imageListSmall; - m_imageListSmall = NULL; + m_imageListSmall = nullptr; } Hide(); @@ -381,7 +381,7 @@ void CGameListCtrl::Update() SetItemFont(index, *wxITALIC_FONT); SetColumnWidth(0, wxLIST_AUTOSIZE); } - if (GetSelectedISO() == NULL) + if (GetSelectedISO() == nullptr) main_frame->UpdateGUI(); Show(); @@ -549,7 +549,7 @@ void CGameListCtrl::ScanForISOs() for (u32 i = 0; i < rFilenames.size(); i++) { std::string FileName; - SplitPath(rFilenames[i], NULL, &FileName, NULL); + SplitPath(rFilenames[i], nullptr, &FileName, nullptr); // Update with the progress (i) and the message dialog.Update(i, wxString::Format(_("Scanning %s"), @@ -644,7 +644,7 @@ const GameListItem *CGameListCtrl::GetISO(size_t index) const if (index < m_ISOFiles.size()) return m_ISOFiles[index]; else - return NULL; + return nullptr; } CGameListCtrl *caller; @@ -914,18 +914,18 @@ const GameListItem * CGameListCtrl::GetSelectedISO() { if (m_ISOFiles.size() == 0) { - return NULL; + return nullptr; } else if (GetSelectedItemCount() == 0) { - return NULL; + return nullptr; } else { long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item == wxNOT_FOUND) { - return NULL; + return nullptr; } else { @@ -1111,7 +1111,7 @@ void CGameListCtrl::CompressSelection(bool _compress) if (!iso->IsCompressed() && _compress) { std::string FileName, FileExt; - SplitPath(iso->GetFileName(), NULL, &FileName, &FileExt); + SplitPath(iso->GetFileName(), nullptr, &FileName, &FileExt); m_currentFilename = FileName; FileName.append(".gcz"); @@ -1136,7 +1136,7 @@ void CGameListCtrl::CompressSelection(bool _compress) else if (iso->IsCompressed() && !_compress) { std::string FileName, FileExt; - SplitPath(iso->GetFileName(), NULL, &FileName, &FileExt); + SplitPath(iso->GetFileName(), nullptr, &FileName, &FileExt); m_currentFilename = FileName; if (iso->GetPlatform() == GameListItem::WII_DISC) FileName.append(".iso"); diff --git a/Source/Core/DolphinWX/Globals.h b/Source/Core/DolphinWX/Globals.h index d133d37301..19a880870f 100644 --- a/Source/Core/DolphinWX/Globals.h +++ b/Source/Core/DolphinWX/Globals.h @@ -256,7 +256,7 @@ enum DECLARE_EVENT_TABLE_ENTRY(\ wxEVT_HOST_COMMAND, id, wxID_ANY, \ (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent(wxCommandEventFunction, &fn), \ - (wxObject*) NULL \ + (wxObject*) nullptr \ ), extern const wxEventType wxEVT_HOST_COMMAND; diff --git a/Source/Core/DolphinWX/HotkeyDlg.cpp b/Source/Core/DolphinWX/HotkeyDlg.cpp index dae616fd7a..7ec75a3327 100644 --- a/Source/Core/DolphinWX/HotkeyDlg.cpp +++ b/Source/Core/DolphinWX/HotkeyDlg.cpp @@ -45,7 +45,7 @@ HotkeyConfigDialog::HotkeyConfigDialog(wxWindow *parent, wxWindowID id, const wx m_ButtonMappingTimer = new wxTimer(this, wxID_ANY); g_Pressed = 0; g_Modkey = 0; - ClickedButton = NULL; + ClickedButton = nullptr; GetButtonWaitingID = 0; GetButtonWaitingTimer = 0; #endif @@ -69,13 +69,13 @@ void HotkeyConfigDialog::EndGetButtons(void) m_ButtonMappingTimer->Stop(); GetButtonWaitingTimer = 0; GetButtonWaitingID = 0; - ClickedButton = NULL; + ClickedButton = nullptr; SetEscapeId(wxID_ANY); } void HotkeyConfigDialog::OnKeyDown(wxKeyEvent& event) { - if(ClickedButton != NULL) + if(ClickedButton != nullptr) { // Save the key g_Pressed = event.GetKeyCode(); diff --git a/Source/Core/DolphinWX/ISOFile.cpp b/Source/Core/DolphinWX/ISOFile.cpp index a8b20a4719..81a2f49593 100644 --- a/Source/Core/DolphinWX/ISOFile.cpp +++ b/Source/Core/DolphinWX/ISOFile.cpp @@ -57,7 +57,7 @@ GameListItem::GameListItem(const std::string& _rFileName) { DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_rFileName); - if (pVolume != NULL) + if (pVolume != nullptr) { if (!DiscIO::IsVolumeWadFile(pVolume)) m_Platform = DiscIO::IsVolumeWiiDisc(pVolume) ? WII_DISC : GAMECUBE_DISC; @@ -80,11 +80,11 @@ GameListItem::GameListItem(const std::string& _rFileName) // check if we can get some info from the banner file too DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume); - if (pFileSystem != NULL || m_Platform == WII_WAD) + if (pFileSystem != nullptr || m_Platform == WII_WAD) { DiscIO::IBannerLoader* pBannerLoader = DiscIO::CreateBannerLoader(*pFileSystem, pVolume); - if (pBannerLoader != NULL) + if (pBannerLoader != nullptr) { if (pBannerLoader->IsValid()) { @@ -270,7 +270,7 @@ std::string GameListItem::GetName(int _index) const if (name.empty()) { // No usable name, return filename (better than nothing) - SplitPath(GetFileName(), NULL, &name, NULL); + SplitPath(GetFileName(), nullptr, &name, nullptr); } return name; @@ -281,7 +281,7 @@ const std::string GameListItem::GetWiiFSPath() const DiscIO::IVolume *Iso = DiscIO::CreateVolumeFromFilename(m_FileName); std::string ret; - if (Iso == NULL) + if (Iso == nullptr) return ret; if (DiscIO::IsVolumeWiiDisc(Iso) || DiscIO::IsVolumeWadFile(Iso)) diff --git a/Source/Core/DolphinWX/ISOProperties.cpp b/Source/Core/DolphinWX/ISOProperties.cpp index 9a46cf8de2..75b743fd67 100644 --- a/Source/Core/DolphinWX/ISOProperties.cpp +++ b/Source/Core/DolphinWX/ISOProperties.cpp @@ -88,8 +88,8 @@ struct WiiPartition }; std::vector WiiDisc; -DiscIO::IVolume *OpenISO = NULL; -DiscIO::IFileSystem *pFileSystem = NULL; +DiscIO::IVolume *OpenISO = nullptr; +DiscIO::IFileSystem *pFileSystem = nullptr; std::vector onFrame; std::vector arCodes; @@ -135,9 +135,9 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW for (u32 i = 0; i < 0xFFFFFFFF; i++) // yes, technically there can be OVER NINE THOUSAND partitions... { WiiPartition temp; - if ((temp.Partition = DiscIO::CreateVolumeFromFilename(fileName, 0, i)) != NULL) + if ((temp.Partition = DiscIO::CreateVolumeFromFilename(fileName, 0, i)) != nullptr) { - if ((temp.FileSystem = DiscIO::CreateFileSystem(temp.Partition)) != NULL) + if ((temp.FileSystem = DiscIO::CreateFileSystem(temp.Partition)) != nullptr) { temp.FileSystem->GetFileList(temp.Files); WiiDisc.push_back(temp); @@ -611,7 +611,7 @@ void CISOProperties::CreateGUIControls(bool IsWad) // Filesystem tree m_Treectrl = new wxTreeCtrl(m_Filesystem, ID_TREECTRL); m_Treectrl->AssignImageList(m_iconList); - RootId = m_Treectrl->AddRoot(_("Disc"), 0, 0, 0); + RootId = m_Treectrl->AddRoot(_("Disc"), 0, 0, nullptr); wxBoxSizer* sTreePage = new wxBoxSizer(wxVERTICAL); sTreePage->Add(m_Treectrl, 1, wxEXPAND|wxALL, 5); @@ -748,7 +748,7 @@ void CISOProperties::ExportDir(const char* _rFullPath, const char* _rExportFolde char exportName[512]; u32 index[2] = {0, 0}; std::vector fst; - DiscIO::IFileSystem *FS = 0; + DiscIO::IFileSystem *FS = nullptr; if (DiscIO::IsVolumeWiiDisc(OpenISO)) { @@ -854,9 +854,9 @@ void CISOProperties::OnExtractDir(wxCommandEvent& event) { if (DiscIO::IsVolumeWiiDisc(OpenISO)) for (u32 i = 0; i < WiiDisc.size(); i++) - ExportDir(NULL, WxStrToStr(Path).c_str(), i); + ExportDir(nullptr, WxStrToStr(Path).c_str(), i); else - ExportDir(NULL, WxStrToStr(Path).c_str()); + ExportDir(nullptr, WxStrToStr(Path).c_str()); return; } @@ -884,7 +884,7 @@ void CISOProperties::OnExtractDir(wxCommandEvent& event) void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event) { - DiscIO::IFileSystem *FS = NULL; + DiscIO::IFileSystem *FS = nullptr; wxString Path = wxDirSelector(_("Choose the folder to extract to")); if (Path.empty()) @@ -1153,10 +1153,10 @@ void CISOProperties::LaunchExternalEditor(const std::string& filename) withApplication: @"TextEdit"]; #else wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension(_T("ini")); - if(filetype == NULL) // From extension failed, trying with MIME type now + if(filetype == nullptr) // From extension failed, trying with MIME type now { filetype = wxTheMimeTypesManager->GetFileTypeFromMimeType(_T("text/plain")); - if(filetype == NULL) // MIME type failed, aborting mission + if(filetype == nullptr) // MIME type failed, aborting mission { PanicAlertT("Filetype 'ini' is unknown! Will not open!"); return; @@ -1415,7 +1415,7 @@ void CISOProperties::ChangeBannerDetails(int lang) m_Maker->SetValue(maker);//dev too std::string filename, extension; - SplitPath(OpenGameListItem->GetFileName(), 0, &filename, &extension); + SplitPath(OpenGameListItem->GetFileName(), nullptr, &filename, &extension); // Also sets the window's title SetTitle(StrToWxStr(StringFromFormat("%s%s: %s - ", filename.c_str(), extension.c_str(), OpenGameListItem->GetUniqueID().c_str())) + shortName); diff --git a/Source/Core/DolphinWX/InputConfigDiag.cpp b/Source/Core/DolphinWX/InputConfigDiag.cpp index fff544d2dd..6cac0e4d25 100644 --- a/Source/Core/DolphinWX/InputConfigDiag.cpp +++ b/Source/Core/DolphinWX/InputConfigDiag.cpp @@ -381,8 +381,8 @@ inline bool IsAlphabetic(wxString &str) inline void GetExpressionForControl(wxString &expr, wxString &control_name, - DeviceQualifier *control_device = NULL, - DeviceQualifier *default_device = NULL) + DeviceQualifier *control_device = nullptr, + DeviceQualifier *default_device = nullptr) { expr = ""; @@ -748,7 +748,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin : wxBoxSizer(wxVERTICAL) , control_group(group) { - static_bitmap = NULL; + static_bitmap = nullptr; wxFont m_SmallFont(7, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); for (auto& control : group->controls) @@ -915,7 +915,7 @@ ControlGroupsSizer::ControlGroupsSizer(ControllerEmu* const controller, wxWindow { size_t col_size = 0; - wxBoxSizer* stacked_groups = NULL; + wxBoxSizer* stacked_groups = nullptr; for (auto& group : controller->groups) { ControlGroupBox* control_group_box = new ControlGroupBox(group.get(), parent, eventsink); @@ -925,7 +925,7 @@ ControlGroupsSizer::ControlGroupsSizer(ControllerEmu* const controller, wxWindow const size_t grp_size = group->controls.size() + group->settings.size(); col_size += grp_size; - if (col_size > 8 || NULL == stacked_groups) + if (col_size > 8 || nullptr == stacked_groups) { if (stacked_groups) Add(stacked_groups, 0, /*wxEXPAND|*/wxBOTTOM|wxRIGHT, 5); diff --git a/Source/Core/DolphinWX/InputConfigDiag.h b/Source/Core/DolphinWX/InputConfigDiag.h index 6a5b0db00c..6a1bb60f5c 100644 --- a/Source/Core/DolphinWX/InputConfigDiag.h +++ b/Source/Core/DolphinWX/InputConfigDiag.h @@ -173,7 +173,7 @@ public: class ControlGroupsSizer : public wxBoxSizer { public: - ControlGroupsSizer(ControllerEmu* const controller, wxWindow* const parent, GamepadPage* const eventsink, std::vector* const groups = NULL); + ControlGroupsSizer(ControllerEmu* const controller, wxWindow* const parent, GamepadPage* const eventsink, std::vector* const groups = nullptr); }; class InputConfigDialog; diff --git a/Source/Core/DolphinWX/LogConfigWindow.cpp b/Source/Core/DolphinWX/LogConfigWindow.cpp index 89779b2032..84c8f026b6 100644 --- a/Source/Core/DolphinWX/LogConfigWindow.cpp +++ b/Source/Core/DolphinWX/LogConfigWindow.cpp @@ -66,7 +66,7 @@ void LogConfigWindow::CreateGUIControls() m_writeConsoleCB->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &LogConfigWindow::OnWriteConsoleChecked, this); m_writeWindowCB = new wxCheckBox(this, wxID_ANY, _("Write to Window")); m_writeWindowCB->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &LogConfigWindow::OnWriteWindowChecked, this); - m_writeDebuggerCB = NULL; + m_writeDebuggerCB = nullptr; #ifdef _MSC_VER if (IsDebuggerPresent()) { diff --git a/Source/Core/DolphinWX/LogWindow.cpp b/Source/Core/DolphinWX/LogWindow.cpp index 087ea03314..c9c65d0fc9 100644 --- a/Source/Core/DolphinWX/LogWindow.cpp +++ b/Source/Core/DolphinWX/LogWindow.cpp @@ -54,7 +54,7 @@ CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos, : wxPanel(parent, id, pos, size, style, name) , x(0), y(0), winpos(0) , Parent(parent), m_ignoreLogTimer(false), m_LogAccess(true) - , m_Log(NULL), m_cmdline(NULL), m_FontChoice(NULL) + , m_Log(nullptr), m_cmdline(nullptr), m_FontChoice(nullptr) { m_LogManager = LogManager::GetInstance(); diff --git a/Source/Core/DolphinWX/Main.cpp b/Source/Core/DolphinWX/Main.cpp index 8b29432b72..7679f6f2dc 100644 --- a/Source/Core/DolphinWX/Main.cpp +++ b/Source/Core/DolphinWX/Main.cpp @@ -102,7 +102,7 @@ END_EVENT_TABLE() bool wxMsgAlert(const char*, const char*, bool, int); std::string wxStringTranslator(const char *); -CFrame* main_frame = NULL; +CFrame* main_frame = nullptr; #ifdef WIN32 //Has no error handling. @@ -204,7 +204,7 @@ bool DolphinApp::OnInit() wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { - wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0 + wxCMD_LINE_NONE, nullptr, nullptr, nullptr, wxCMD_LINE_VAL_NONE, 0 } }; @@ -327,11 +327,11 @@ bool DolphinApp::OnInit() if (File::Exists("www.dolphin-emulator.com.txt")) { File::Delete("www.dolphin-emulator.com.txt"); - MessageBox(NULL, + MessageBox(nullptr, L"This version of Dolphin was downloaded from a website stealing money from developers of the emulator. Please " L"download Dolphin from the official website instead: http://dolphin-emu.org/", L"Unofficial version detected", MB_OK | MB_ICONWARNING); - ShellExecute(NULL, L"open", L"http://dolphin-emu.org/?ref=badver", NULL, NULL, SW_SHOWDEFAULT); + ShellExecute(nullptr, L"open", L"http://dolphin-emu.org/?ref=badver", nullptr, nullptr, SW_SHOWDEFAULT); exit(0); } #endif @@ -351,7 +351,7 @@ bool DolphinApp::OnInit() y = wxDefaultCoord; #endif - main_frame = new CFrame((wxFrame*)NULL, wxID_ANY, + main_frame = new CFrame((wxFrame*)nullptr, wxID_ANY, StrToWxStr(scm_rev_str), wxPoint(x, y), wxSize(w, h), UseDebugger, BatchMode, UseLogger); @@ -372,14 +372,14 @@ void DolphinApp::MacOpenFile(const wxString &fileName) FileToLoad = fileName; LoadFile = true; - if (m_afterinit == NULL) + if (m_afterinit == nullptr) main_frame->BootGame(WxStrToStr(FileToLoad)); } void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event)) { delete m_afterinit; - m_afterinit = NULL; + m_afterinit = nullptr; if (!BatchMode) main_frame->UpdateGameList(); @@ -538,7 +538,7 @@ void* Host_GetInstance() #else void* Host_GetInstance() { - return NULL; + return nullptr; } #endif diff --git a/Source/Core/DolphinWX/MainAndroid.cpp b/Source/Core/DolphinWX/MainAndroid.cpp index 23c6014333..d50438f083 100644 --- a/Source/Core/DolphinWX/MainAndroid.cpp +++ b/Source/Core/DolphinWX/MainAndroid.cpp @@ -68,7 +68,7 @@ void* Host_GetRenderHandle() return surf; } -void* Host_GetInstance() { return NULL; } +void* Host_GetInstance() { return nullptr; } void Host_UpdateTitle(const char* title) { @@ -153,7 +153,7 @@ bool LoadBanner(std::string filename, u32 *Banner) { DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(filename); - if (pVolume != NULL) + if (pVolume != nullptr) { bool bIsWad = false; if (DiscIO::IsVolumeWadFile(pVolume)) @@ -164,11 +164,11 @@ bool LoadBanner(std::string filename, u32 *Banner) // check if we can get some info from the banner file too DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume); - if (pFileSystem != NULL || bIsWad) + if (pFileSystem != nullptr || bIsWad) { DiscIO::IBannerLoader* pBannerLoader = DiscIO::CreateBannerLoader(*pFileSystem, pVolume); - if (pBannerLoader != NULL) + if (pBannerLoader != nullptr) if (pBannerLoader->IsValid()) { m_names = pBannerLoader->GetNames(); @@ -213,7 +213,7 @@ std::string GetName(std::string filename) return m_volume_names[0]; // No usable name, return filename (better than nothing) std::string name; - SplitPath(filename, NULL, &name, NULL); + SplitPath(filename, nullptr, &name, nullptr); return name; } @@ -247,14 +247,14 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onTouchAxisE } JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadEvent(JNIEnv *env, jobject obj, jstring jDevice, jint Button, jint Action) { - const char *Device = env->GetStringUTFChars(jDevice, NULL); + const char *Device = env->GetStringUTFChars(jDevice, nullptr); std::string strDevice = std::string(Device); ButtonManager::GamepadEvent(strDevice, Button, Action); env->ReleaseStringUTFChars(jDevice, Device); } JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadMoveEvent(JNIEnv *env, jobject obj, jstring jDevice, jint Axis, jfloat Value) { - const char *Device = env->GetStringUTFChars(jDevice, NULL); + const char *Device = env->GetStringUTFChars(jDevice, nullptr); std::string strDevice = std::string(Device); ButtonManager::GamepadAxisEvent(strDevice, Axis, Value); env->ReleaseStringUTFChars(jDevice, Device); @@ -262,7 +262,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadMov JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetBanner(JNIEnv *env, jobject obj, jstring jFile) { - const char *File = env->GetStringUTFChars(jFile, NULL); + const char *File = env->GetStringUTFChars(jFile, nullptr); jintArray Banner = env->NewIntArray(DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT); u32 uBanner[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; if (LoadBanner(File, uBanner)) @@ -274,7 +274,7 @@ JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetBann } JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetTitle(JNIEnv *env, jobject obj, jstring jFile) { - const char *File = env->GetStringUTFChars(jFile, NULL); + const char *File = env->GetStringUTFChars(jFile, nullptr); std::string Name = GetName(File); m_names.clear(); m_volume_names.clear(); @@ -306,10 +306,10 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_eglBindAPI(J JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetConfig(JNIEnv *env, jobject obj, jstring jFile, jstring jKey, jstring jValue, jstring jDefault) { IniFile ini; - const char *File = env->GetStringUTFChars(jFile, NULL); - const char *Key = env->GetStringUTFChars(jKey, NULL); - const char *Value = env->GetStringUTFChars(jValue, NULL); - const char *Default = env->GetStringUTFChars(jDefault, NULL); + const char *File = env->GetStringUTFChars(jFile, nullptr); + const char *Key = env->GetStringUTFChars(jKey, nullptr); + const char *Value = env->GetStringUTFChars(jValue, nullptr); + const char *Default = env->GetStringUTFChars(jDefault, nullptr); ini.Load(File::GetUserPath(D_CONFIG_IDX) + std::string(File)); std::string value; @@ -326,10 +326,10 @@ JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetConfig JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetConfig(JNIEnv *env, jobject obj, jstring jFile, jstring jKey, jstring jValue, jstring jDefault) { IniFile ini; - const char *File = env->GetStringUTFChars(jFile, NULL); - const char *Key = env->GetStringUTFChars(jKey, NULL); - const char *Value = env->GetStringUTFChars(jValue, NULL); - const char *Default = env->GetStringUTFChars(jDefault, NULL); + const char *File = env->GetStringUTFChars(jFile, nullptr); + const char *Key = env->GetStringUTFChars(jKey, nullptr); + const char *Value = env->GetStringUTFChars(jValue, nullptr); + const char *Default = env->GetStringUTFChars(jDefault, nullptr); ini.Load(File::GetUserPath(D_CONFIG_IDX) + std::string(File)); @@ -344,7 +344,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetConfig(JN JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetFilename(JNIEnv *env, jobject obj, jstring jFile) { - const char *File = env->GetStringUTFChars(jFile, NULL); + const char *File = env->GetStringUTFChars(jFile, nullptr); g_filename = std::string(File); diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp index 122a0281f3..ffb3522eae 100644 --- a/Source/Core/DolphinWX/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/MainNoGUI.cpp @@ -60,10 +60,10 @@ void Host_Message(int Id) void* Host_GetRenderHandle() { - return NULL; + return nullptr; } -void* Host_GetInstance() { return NULL; } +void* Host_GetInstance() { return nullptr; } void Host_UpdateTitle(const char* title){}; @@ -293,10 +293,10 @@ int main(int argc, char* argv[]) #endif int ch, help = 0; struct option longopts[] = { - { "exec", no_argument, NULL, 'e' }, - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'v' }, - { NULL, 0, NULL, 0 } + { "exec", no_argument, nullptr, 'e' }, + { "help", no_argument, nullptr, 'h' }, + { "version", no_argument, nullptr, 'v' }, + { nullptr, 0, nullptr, 0 } }; while ((ch = getopt_long(argc, argv, "eh?v", longopts, 0)) != -1) @@ -337,7 +337,7 @@ int main(int argc, char* argv[]) GLWin.platform = EGL_PLATFORM_NONE; #endif #if HAVE_WAYLAND - GLWin.wl_display = NULL; + GLWin.wl_display = nullptr; #endif // No use running the loop when booting fails diff --git a/Source/Core/DolphinWX/MemcardManager.cpp b/Source/Core/DolphinWX/MemcardManager.cpp index 03f393ae49..80b92dfd6d 100644 --- a/Source/Core/DolphinWX/MemcardManager.cpp +++ b/Source/Core/DolphinWX/MemcardManager.cpp @@ -113,8 +113,8 @@ END_EVENT_TABLE() CMemcardManager::CMemcardManager(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) : wxDialog(parent, id, title, position, size, style) { - memoryCard[SLOT_A]=NULL; - memoryCard[SLOT_B]=NULL; + memoryCard[SLOT_A]=nullptr; + memoryCard[SLOT_B]=nullptr; mcmSettings.twoCardsLoaded = false; if (!LoadSettings()) @@ -135,12 +135,12 @@ CMemcardManager::~CMemcardManager() if (memoryCard[SLOT_A]) { delete memoryCard[SLOT_A]; - memoryCard[SLOT_A] = NULL; + memoryCard[SLOT_A] = nullptr; } if (memoryCard[SLOT_B]) { delete memoryCard[SLOT_B]; - memoryCard[SLOT_B] = NULL; + memoryCard[SLOT_B] = nullptr; } SaveSettings(); } @@ -320,7 +320,7 @@ void CMemcardManager::ChangePath(int slot) if (memoryCard[slot]) { delete memoryCard[slot]; - memoryCard[slot] = NULL; + memoryCard[slot] = nullptr; } mcmSettings.twoCardsLoaded = false; m_MemcardPath[slot]->SetPath(wxEmptyString); @@ -598,14 +598,14 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event) { std::string path1, path2, mpath; mpath = WxStrToStr(m_MemcardPath[slot]->GetPath()); - SplitPath(mpath, &path1, &path2, NULL); + SplitPath(mpath, &path1, &path2, nullptr); path1 += path2; File::CreateDir(path1); if(PanicYesNoT("Warning: This will overwrite any existing saves that are in the folder:\n" "%s\nand have the same name as a file on your memcard\nContinue?", path1.c_str())) for (int i = 0; i < DIRLEN; i++) { - CopyDeleteSwitch(memoryCard[slot]->ExportGci(i, NULL, path1), -1); + CopyDeleteSwitch(memoryCard[slot]->ExportGci(i, nullptr, path1), -1); } break; } diff --git a/Source/Core/DolphinWX/NetWindow.cpp b/Source/Core/DolphinWX/NetWindow.cpp index de7e24ca77..40b13d8d5b 100644 --- a/Source/Core/DolphinWX/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetWindow.cpp @@ -54,10 +54,10 @@ BEGIN_EVENT_TABLE(NetPlayDiag, wxFrame) EVT_COMMAND(wxID_ANY, wxEVT_THREAD, NetPlayDiag::OnThread) END_EVENT_TABLE() -static NetPlayServer* netplay_server = NULL; -static NetPlayClient* netplay_client = NULL; +static NetPlayServer* netplay_server = nullptr; +static NetPlayClient* netplay_client = nullptr; extern CFrame* main_frame; -NetPlayDiag *NetPlayDiag::npd = NULL; +NetPlayDiag *NetPlayDiag::npd = nullptr; std::string BuildGameName(const GameListItem& game) { @@ -227,7 +227,7 @@ NetPlaySetupDiag::~NetPlaySetupDiag() netplay_section.Set("HostPort", WxStrToStr(m_host_port_text->GetValue())); inifile.Save(dolphin_ini); - main_frame->g_NetPlaySetupDiag = NULL; + main_frame->g_NetPlaySetupDiag = nullptr; } void NetPlaySetupDiag::MakeNetPlayDiag(int port, const std::string &game, bool is_hosting) @@ -311,7 +311,7 @@ NetPlayDiag::NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game const std::string& game, const bool is_hosting) : wxFrame(parent, wxID_ANY, wxT(NETPLAY_TITLEBAR)) , m_selected_game(game) - , m_start_btn(NULL) + , m_start_btn(nullptr) , m_game_list(game_list) { wxPanel* const panel = new wxPanel(this); @@ -409,14 +409,14 @@ NetPlayDiag::~NetPlayDiag() if (netplay_client) { delete netplay_client; - netplay_client = NULL; + netplay_client = nullptr; } if (netplay_server) { delete netplay_server; - netplay_server = NULL; + netplay_server = nullptr; } - npd = NULL; + npd = nullptr; } void NetPlayDiag::OnChat(wxCommandEvent&) @@ -724,6 +724,6 @@ void PadMapDiag::OnAdjust(wxCommandEvent& event) void NetPlay::StopGame() { - if (netplay_client != NULL) + if (netplay_client != nullptr) netplay_client->Stop(); } diff --git a/Source/Core/DolphinWX/TASInputDlg.cpp b/Source/Core/DolphinWX/TASInputDlg.cpp index b0ff86d971..d30c9e7d2e 100644 --- a/Source/Core/DolphinWX/TASInputDlg.cpp +++ b/Source/Core/DolphinWX/TASInputDlg.cpp @@ -736,7 +736,7 @@ bool TASInputDlg::TASHasFocus() if (wxWindow::FindFocus() == this) return true; - else if (wxWindow::FindFocus() != NULL && + else if (wxWindow::FindFocus() != nullptr && wxWindow::FindFocus()->GetParent() == this) return true; else diff --git a/Source/Core/DolphinWX/VideoConfigDiag.cpp b/Source/Core/DolphinWX/VideoConfigDiag.cpp index eb1ee09fcd..ff61792243 100644 --- a/Source/Core/DolphinWX/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/VideoConfigDiag.cpp @@ -161,7 +161,7 @@ wxArrayString GetListOfResolutions() dmi.dmSize = sizeof(dmi); std::vector resos; - while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0) + while (EnumDisplaySettings(nullptr, iModeNum++, &dmi) != 0) { char res[100]; sprintf(res, "%dx%d", dmi.dmPelsWidth, dmi.dmPelsHeight); @@ -177,7 +177,7 @@ wxArrayString GetListOfResolutions() #elif defined(HAVE_XRANDR) && HAVE_XRANDR main_frame->m_XRRConfig->AddResolutions(retlist); #elif defined(__APPLE__) - CFArrayRef modes = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), NULL); + CFArrayRef modes = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), nullptr); for (CFIndex i = 0; i < CFArrayGetCount(modes); i++) { std::stringstream res; diff --git a/Source/Core/DolphinWX/VideoConfigDiag.h b/Source/Core/DolphinWX/VideoConfigDiag.h index c9f37cc978..dd6abeb010 100644 --- a/Source/Core/DolphinWX/VideoConfigDiag.h +++ b/Source/Core/DolphinWX/VideoConfigDiag.h @@ -68,7 +68,7 @@ typedef IntegerSetting U32Setting; class SettingChoice : public wxChoice { public: - SettingChoice(wxWindow* parent, int &setting, const wxString& tooltip, int num = 0, const wxString choices[] = NULL, long style = 0); + SettingChoice(wxWindow* parent, int &setting, const wxString& tooltip, int num = 0, const wxString choices[] = nullptr, long style = 0); void UpdateValue(wxCommandEvent& ev); private: int &m_setting; @@ -178,7 +178,7 @@ protected: // Creates controls and connects their enter/leave window events to Evt_Enter/LeaveControl SettingCheckBox* CreateCheckBox(wxWindow* parent, const wxString& label, const wxString& description, bool &setting, bool reverse = false, long style = 0); - SettingChoice* CreateChoice(wxWindow* parent, int& setting, const wxString& description, int num = 0, const wxString choices[] = NULL, long style = 0); + SettingChoice* CreateChoice(wxWindow* parent, int& setting, const wxString& description, int num = 0, const wxString choices[] = nullptr, long style = 0); SettingRadioButton* CreateRadioButton(wxWindow* parent, const wxString& label, const wxString& description, bool &setting, bool reverse = false, long style = 0); // Same as above but only connects enter/leave window events diff --git a/Source/Core/DolphinWX/X11Utils.cpp b/Source/Core/DolphinWX/X11Utils.cpp index 2a5f40b061..56232a36da 100644 --- a/Source/Core/DolphinWX/X11Utils.cpp +++ b/Source/Core/DolphinWX/X11Utils.cpp @@ -100,9 +100,9 @@ void InhibitScreensaver(Display *dpy, Window win, bool suspend) (char *)"xdg-screensaver", (char *)(suspend ? "suspend" : "resume"), id, - NULL}; + nullptr}; pid_t pid; - if (!posix_spawnp(&pid, "xdg-screensaver", NULL, NULL, argv, environ)) + if (!posix_spawnp(&pid, "xdg-screensaver", nullptr, nullptr, argv, environ)) { int status; while (waitpid (pid, &status, 0) == -1); @@ -115,7 +115,7 @@ void InhibitScreensaver(Display *dpy, Window win, bool suspend) XRRConfiguration::XRRConfiguration(Display *_dpy, Window _win) : dpy(_dpy) , win(_win) - , screenResources(NULL), outputInfo(NULL), crtcInfo(NULL) + , screenResources(nullptr), outputInfo(nullptr), crtcInfo(nullptr) , fullMode(0) , fs_fb_width(0), fs_fb_height(0), fs_fb_width_mm(0), fs_fb_height_mm(0) , bValid(true), bIsFullscreen(false) @@ -165,18 +165,18 @@ void XRRConfiguration::Update() if (outputInfo) { XRRFreeOutputInfo(outputInfo); - outputInfo = NULL; + outputInfo = nullptr; } if (crtcInfo) { XRRFreeCrtcInfo(crtcInfo); - crtcInfo = NULL; + crtcInfo = nullptr; } fullMode = 0; // Get the resolution setings for fullscreen mode unsigned int fullWidth, fullHeight; - char *output_name = NULL; + char *output_name = nullptr; if (SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.find(':') == std::string::npos) { diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index 7153a8d7f7..a2534b56a1 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -230,7 +230,7 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference* , const DeviceQualifier& default_device) const { delete ref->parsed_expression; - ref->parsed_expression = NULL; + ref->parsed_expression = nullptr; ControlFinder finder(*this, default_device, ref->is_input); ref->parse_error = ParseExpression(ref->expression, finder, &ref->parsed_expression); @@ -244,7 +244,7 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference* // which is useful for those crazy flightsticks that have certain buttons that are always held down // or some crazy axes or something // upon input, return pointer to detected Control -// else return NULL +// else return nullptr // Device::Control* ControllerInterface::InputReference::Detect(const unsigned int ms, Device* const device) { @@ -252,7 +252,7 @@ Device::Control* ControllerInterface::InputReference::Detect(const unsigned int std::vector states(device->Inputs().size()); if (device->Inputs().size() == 0) - return NULL; + return nullptr; // get starting state of all inputs, // so we can ignore those that were activated at time of Detect start @@ -285,7 +285,7 @@ Device::Control* ControllerInterface::InputReference::Detect(const unsigned int } // no input was detected - return NULL; + return nullptr; } // @@ -317,5 +317,5 @@ Device::Control* ControllerInterface::OutputReference::Detect(const unsigned int State(0); device->UpdateOutput(); } - return NULL; + return nullptr; } diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h index 898fd954fb..763933aa22 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h @@ -83,7 +83,7 @@ public: } protected: - ControlReference(const bool _is_input) : range(1), is_input(_is_input), parsed_expression(NULL) {} + ControlReference(const bool _is_input) : range(1), is_input(_is_input), parsed_expression(nullptr) {} ciface::ExpressionParser::Expression *parsed_expression; }; @@ -113,7 +113,7 @@ public: Device::Control* Detect(const unsigned int ms, Device* const device) override; }; - ControllerInterface() : m_is_init(false), m_hwnd(NULL) {} + ControllerInterface() : m_is_init(false), m_hwnd(nullptr) {} void SetHwnd(void* const hwnd); void Initialize(); diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp index f2d2460ee6..48b5884312 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp @@ -48,7 +48,7 @@ std::string GetDeviceName(const LPDIRECTINPUTDEVICE8 device) void Init(std::vector& devices, HWND hwnd) { IDirectInput8* idi8; - if (FAILED(DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (LPVOID*)&idi8, NULL))) + if (FAILED(DirectInput8Create(GetModuleHandle(nullptr), DIRECTINPUT_VERSION, IID_IDirectInput8, (LPVOID*)&idi8, nullptr))) return; InitKeyboardMouse(idi8, devices, hwnd); diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp index e98c13df88..75b21c0e8c 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp @@ -24,47 +24,47 @@ namespace DInput void GetXInputGUIDS( std::vector& guids ) { -#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } } +#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=nullptr; } } - IWbemLocator* pIWbemLocator = NULL; - IEnumWbemClassObject* pEnumDevices = NULL; + IWbemLocator* pIWbemLocator = nullptr; + IEnumWbemClassObject* pEnumDevices = nullptr; IWbemClassObject* pDevices[20] = {0}; - IWbemServices* pIWbemServices = NULL; - BSTR bstrNamespace = NULL; - BSTR bstrDeviceID = NULL; - BSTR bstrClassName = NULL; + IWbemServices* pIWbemServices = nullptr; + BSTR bstrNamespace = nullptr; + BSTR bstrDeviceID = nullptr; + BSTR bstrClassName = nullptr; DWORD uReturned = 0; VARIANT var; HRESULT hr; // CoInit if needed - hr = CoInitialize(NULL); + hr = CoInitialize(nullptr); bool bCleanupCOM = SUCCEEDED(hr); // Create WMI hr = CoCreateInstance(__uuidof(WbemLocator), - NULL, + nullptr, CLSCTX_INPROC_SERVER, __uuidof(IWbemLocator), (LPVOID*) &pIWbemLocator); - if (FAILED(hr) || pIWbemLocator == NULL) + if (FAILED(hr) || pIWbemLocator == nullptr) goto LCleanup; - bstrNamespace = SysAllocString(L"\\\\.\\root\\cimv2");if(bstrNamespace == NULL) goto LCleanup; - bstrClassName = SysAllocString(L"Win32_PNPEntity"); if(bstrClassName == NULL) goto LCleanup; - bstrDeviceID = SysAllocString(L"DeviceID"); if(bstrDeviceID == NULL) goto LCleanup; + bstrNamespace = SysAllocString(L"\\\\.\\root\\cimv2");if(bstrNamespace == nullptr) goto LCleanup; + bstrClassName = SysAllocString(L"Win32_PNPEntity"); if(bstrClassName == nullptr) goto LCleanup; + bstrDeviceID = SysAllocString(L"DeviceID"); if(bstrDeviceID == nullptr) goto LCleanup; // Connect to WMI - hr = pIWbemLocator->ConnectServer(bstrNamespace, NULL, NULL, 0L, 0L, NULL, NULL, &pIWbemServices); - if (FAILED(hr) || pIWbemServices == NULL) + hr = pIWbemLocator->ConnectServer(bstrNamespace, nullptr, nullptr, 0L, 0L, nullptr, nullptr, &pIWbemServices); + if (FAILED(hr) || pIWbemServices == nullptr) goto LCleanup; // Switch security level to IMPERSONATE. - CoSetProxyBlanket(pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, - RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE); + CoSetProxyBlanket(pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, nullptr, + RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, nullptr, EOAC_NONE); - hr = pIWbemServices->CreateInstanceEnum(bstrClassName, 0, NULL, &pEnumDevices); - if (FAILED(hr) || pEnumDevices == NULL) + hr = pIWbemServices->CreateInstanceEnum(bstrClassName, 0, nullptr, &pEnumDevices); + if (FAILED(hr) || pEnumDevices == nullptr) goto LCleanup; // Loop over all devices @@ -78,8 +78,8 @@ void GetXInputGUIDS( std::vector& guids ) for (UINT iDevice = 0; iDevice < uReturned; ++iDevice) { // For each device, get its device ID - hr = pDevices[iDevice]->Get(bstrDeviceID, 0L, &var, NULL, NULL); - if (SUCCEEDED(hr) && var.vt == VT_BSTR && var.bstrVal != NULL) + hr = pDevices[iDevice]->Get(bstrDeviceID, 0L, &var, nullptr, nullptr); + if (SUCCEEDED(hr) && var.vt == VT_BSTR && var.bstrVal != nullptr) { // Check if the device ID contains "IG_". If it does, then it's an XInput device // This information can not be found from DirectInput @@ -140,7 +140,7 @@ void InitJoystick(IDirectInput8* const idi8, std::vector& devices continue; LPDIRECTINPUTDEVICE8 js_device; - if (SUCCEEDED(idi8->CreateDevice(joystick.guidInstance, &js_device, NULL))) + if (SUCCEEDED(idi8->CreateDevice(joystick.guidInstance, &js_device, nullptr))) { if (SUCCEEDED(js_device->SetDataFormat(&c_dfDIJoystick))) { @@ -148,7 +148,7 @@ void InitJoystick(IDirectInput8* const idi8, std::vector& devices { //PanicAlert("SetCooperativeLevel(DISCL_EXCLUSIVE) failed!"); // fall back to non-exclusive mode, with no rumble - if (FAILED(js_device->SetCooperativeLevel(NULL, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE))) + if (FAILED(js_device->SetCooperativeLevel(nullptr, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE))) { //PanicAlert("SetCooperativeLevel failed!"); js_device->Release(); diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp index 0cd55b448c..52960bbc3c 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp @@ -52,20 +52,20 @@ void InitKeyboardMouse(IDirectInput8* const idi8, std::vector& de // if that's dumb, I will make a VirtualDevice class that just uses ranges of inputs/outputs from other devices // so there can be a separated Keyboard and mouse, as well as combined KeyboardMouse - LPDIRECTINPUTDEVICE8 kb_device = NULL; - LPDIRECTINPUTDEVICE8 mo_device = NULL; + LPDIRECTINPUTDEVICE8 kb_device = nullptr; + LPDIRECTINPUTDEVICE8 mo_device = nullptr; - if (SUCCEEDED(idi8->CreateDevice( GUID_SysKeyboard, &kb_device, NULL))) + if (SUCCEEDED(idi8->CreateDevice( GUID_SysKeyboard, &kb_device, nullptr))) { if (SUCCEEDED(kb_device->SetDataFormat(&c_dfDIKeyboard))) { - if (SUCCEEDED(kb_device->SetCooperativeLevel(NULL, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE))) + if (SUCCEEDED(kb_device->SetCooperativeLevel(nullptr, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE))) { - if (SUCCEEDED(idi8->CreateDevice( GUID_SysMouse, &mo_device, NULL ))) + if (SUCCEEDED(idi8->CreateDevice( GUID_SysMouse, &mo_device, nullptr ))) { if (SUCCEEDED(mo_device->SetDataFormat(&c_dfDIMouse2))) { - if (SUCCEEDED(mo_device->SetCooperativeLevel(NULL, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE))) + if (SUCCEEDED(mo_device->SetCooperativeLevel(nullptr, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE))) { devices.push_back(new KeyboardMouse(kb_device, mo_device)); return; diff --git a/Source/Core/InputCommon/ControllerInterface/Device.cpp b/Source/Core/InputCommon/ControllerInterface/Device.cpp index 295fc10b5a..e1383efc9d 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Device.cpp @@ -46,7 +46,7 @@ Device::Input* Device::FindInput(const std::string &name) const return input; } - return NULL; + return nullptr; } Device::Output* Device::FindOutput(const std::string &name) const @@ -57,7 +57,7 @@ Device::Output* Device::FindOutput(const std::string &name) const return output; } - return NULL; + return nullptr; } // @@ -151,7 +151,7 @@ Device* DeviceContainer::FindDevice(const DeviceQualifier& devq) const return d; } - return NULL; + return nullptr; } Device::Input* DeviceContainer::FindInput(const std::string& name, const Device* def_dev) const @@ -171,7 +171,7 @@ Device::Input* DeviceContainer::FindInput(const std::string& name, const Device* return i; } - return NULL; + return nullptr; } Device::Output* DeviceContainer::FindOutput(const std::string& name, const Device* def_dev) const diff --git a/Source/Core/InputCommon/ControllerInterface/Device.h b/Source/Core/InputCommon/ControllerInterface/Device.h index 43f1b738c7..a096bcb8b9 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.h +++ b/Source/Core/InputCommon/ControllerInterface/Device.h @@ -42,8 +42,8 @@ public: virtual std::string GetName() const = 0; virtual ~Control() {} - virtual Input* ToInput() { return NULL; } - virtual Output* ToOutput() { return NULL; } + virtual Input* ToInput() { return nullptr; } + virtual Output* ToOutput() { return nullptr; } }; // diff --git a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp index 4e2f49f4d0..c41e82b699 100644 --- a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp @@ -357,7 +357,7 @@ Device::Control *ControlFinder::FindControl(ControlQualifier qualifier) { Device *device = FindDevice(qualifier); if (!device) - return NULL; + return nullptr; if (is_input) return device->FindInput(qualifier.control_name); @@ -414,7 +414,7 @@ private: case TOK_CONTROL: { Device::Control *control = finder.FindControl(tok.qualifier); - if (control == NULL) + if (control == nullptr) return EXPRESSION_PARSE_NO_DEVICE; *expr_out = new ControlExpression(tok.qualifier, control); @@ -539,7 +539,7 @@ ExpressionParseStatus ParseExpressionInner(std::string str, ControlFinder &finde { ExpressionParseStatus status; Expression *expr; - *expr_out = NULL; + *expr_out = nullptr; if (str == "") return EXPRESSION_PARSE_SUCCESS; diff --git a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.h b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.h index 18f972ce9e..f2628e6f0b 100644 --- a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.h +++ b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.h @@ -47,7 +47,7 @@ class ExpressionNode; class Expression { public: - Expression() : node(NULL) {} + Expression() : node(nullptr) {} Expression(ExpressionNode *node); ~Expression(); ControlState GetValue(); diff --git a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp index 7a4dfdaccc..036b3fda05 100644 --- a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp @@ -102,7 +102,7 @@ bool ForceFeedbackDevice::InitForceFeedback(const LPDIRECTINPUTDEVICE8 device, i } LPDIRECTINPUTEFFECT pEffect; - if (SUCCEEDED(device->CreateEffect(f.guid, &eff, &pEffect, NULL))) + if (SUCCEEDED(device->CreateEffect(f.guid, &eff, &pEffect, nullptr))) { m_state_out.push_back(EffectState(pEffect)); @@ -155,7 +155,7 @@ bool ForceFeedbackDevice::UpdateOutput() ok_count += SUCCEEDED(state.iface->Stop()); } - state.params = NULL; + state.params = nullptr; } else { diff --git a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h index 9ef5873702..643ca2434b 100644 --- a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h +++ b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h @@ -29,7 +29,7 @@ class ForceFeedbackDevice : public Core::Device private: struct EffectState { - EffectState(LPDIRECTINPUTEFFECT eff) : iface(eff), params(NULL), size(0) {} + EffectState(LPDIRECTINPUTEFFECT eff) : iface(eff), params(nullptr), size(0) {} LPDIRECTINPUTEFFECT iface; void* params; // null when force hasn't changed diff --git a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/OSX/DirectInputAdapter.h b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/OSX/DirectInputAdapter.h index 3ac954c9ad..c3b5cef2ef 100644 --- a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/OSX/DirectInputAdapter.h +++ b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/OSX/DirectInputAdapter.h @@ -72,11 +72,11 @@ public: HRESULT QueryInterface(REFIID iid, LPVOID *ppv) { - *ppv = NULL; + *ppv = nullptr; if (CFEqual(&iid, IUnknownUUID)) *ppv = this; - if (NULL == *ppv) + if (nullptr == *ppv) return E_NOINTERFACE; ((IUnknown*)*ppv)->AddRef(); diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm index 50b568cb9a..ac98c4c13d 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm @@ -18,7 +18,7 @@ namespace OSX { -static IOHIDManagerRef HIDManager = NULL; +static IOHIDManagerRef HIDManager = nullptr; static CFStringRef OurRunLoop = CFSTR("DolphinOSXInput"); static std::map kbd_name_counts, joy_name_counts; @@ -90,7 +90,7 @@ void DeviceElementDebugPrint(const void *value, void *context) type == "collection" ? c_type.c_str() : " ", IOHIDElementGetUsagePage(e), IOHIDElementGetUsage(e), - IOHIDElementGetName(e), // usually just NULL + IOHIDElementGetName(e), // usually just nullptr IOHIDElementGetLogicalMin(e), IOHIDElementGetLogicalMax(e), IOHIDElementGetPhysicalMin(e), @@ -102,7 +102,7 @@ void DeviceElementDebugPrint(const void *value, void *context) CFRange range = {0, CFArrayGetCount(elements)}; // this leaks...but it's just debug code, right? :D CFArrayApplyFunction(elements, range, - DeviceElementDebugPrint, NULL); + DeviceElementDebugPrint, nullptr); } } @@ -146,7 +146,7 @@ static void DeviceMatching_callback(void* inContext, { NSString *pName = (NSString *) IOHIDDeviceGetProperty(inIOHIDDeviceRef, CFSTR(kIOHIDProductKey)); - std::string name = (pName != NULL) ? [pName UTF8String] : "Unknown device"; + std::string name = (pName != nullptr) ? [pName UTF8String] : "Unknown device"; DeviceDebugPrint(inIOHIDDeviceRef); @@ -178,7 +178,7 @@ void Init(std::vector& devices, void *window) g_window = window; - IOHIDManagerSetDeviceMatching(HIDManager, NULL); + IOHIDManagerSetDeviceMatching(HIDManager, nullptr); // Callbacks for acquisition or loss of a matching device IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, @@ -200,7 +200,7 @@ void Init(std::vector& devices, void *window) // Things should be configured now // Disable hotplugging and other scheduling - IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, NULL, NULL); + IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, nullptr, nullptr); IOHIDManagerUnscheduleFromRunLoop(HIDManager, CFRunLoopGetCurrent(), OurRunLoop); } diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm index 6e0623e716..f7f59e1c41 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm @@ -39,7 +39,7 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index) { IOHIDElementRef e = (IOHIDElementRef)CFArrayGetValueAtIndex(buttons, i); - //DeviceElementDebugPrint(e, NULL); + //DeviceElementDebugPrint(e, nullptr); AddInput(new Button(e, m_device)); } @@ -62,7 +62,7 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index) { IOHIDElementRef e = (IOHIDElementRef)CFArrayGetValueAtIndex(axes, i); - //DeviceElementDebugPrint(e, NULL); + //DeviceElementDebugPrint(e, nullptr); if (IOHIDElementGetUsage(e) == kHIDUsage_GD_Hatswitch) { AddInput(new Hat(e, m_device, Hat::up)); diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm index fc784b81c6..ecb841ae7b 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm @@ -40,7 +40,7 @@ Keyboard::Keyboard(IOHIDDeviceRef device, std::string name, int index, void *win { IOHIDElementRef e = (IOHIDElementRef)CFArrayGetValueAtIndex(elements, i); - //DeviceElementDebugPrint(e, NULL); + //DeviceElementDebugPrint(e, nullptr); AddInput(new Key(e, m_device)); } @@ -61,7 +61,7 @@ bool Keyboard::UpdateInput() { CGRect bounds = CGRectZero; uint32_t windowid[1] = { m_windowid }; - CFArrayRef windowArray = CFArrayCreate(NULL, (const void **) windowid, 1, NULL); + CFArrayRef windowArray = CFArrayCreate(nullptr, (const void **) windowid, 1, nullptr); CFArrayRef windowDescriptions = CGWindowListCreateDescriptionFromArray(windowArray); CFDictionaryRef windowDescription = (CFDictionaryRef) CFArrayGetValueAtIndex((CFArrayRef) windowDescriptions, 0); @@ -69,7 +69,7 @@ bool Keyboard::UpdateInput() { CFDictionaryRef boundsDictionary = (CFDictionaryRef) CFDictionaryGetValue(windowDescription, kCGWindowBounds); - if (boundsDictionary != NULL) + if (boundsDictionary != nullptr) CGRectMakeWithDictionaryRepresentation(boundsDictionary, &bounds); } diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp index 802346b81d..9fb9e96f6e 100644 --- a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp @@ -48,7 +48,7 @@ namespace XInput2 // This function will add zero or more KeyboardMouse objects to devices. void Init(std::vector& devices, void* const hwnd) { - Display* dpy = XOpenDisplay(NULL); + Display* dpy = XOpenDisplay(nullptr); // xi_opcode is important; it will be used to identify XInput events by // the polling loop in UpdateInput. @@ -129,7 +129,7 @@ KeyboardMouse::KeyboardMouse(Window window, int opcode, int pointer, int keyboar // which it can individually filter to get just the events it's interested // in. So be aware that each KeyboardMouse object actually has its own X11 // "context." - m_display = XOpenDisplay(NULL); + m_display = XOpenDisplay(nullptr); int min_keycode, max_keycode; XDisplayKeycodes(m_display, &min_keycode, &max_keycode); @@ -326,7 +326,7 @@ KeyboardMouse::Key::Key(Display* const display, KeyCode keycode, const char* key // 0x0110ffff is the top of the unicode character range according // to keysymdef.h although it is probably more than we need. if (keysym == NoSymbol || keysym > 0x0110ffff || - XKeysymToString(keysym) == NULL) + XKeysymToString(keysym) == nullptr) m_keyname = std::string(); else m_keyname = std::string(XKeysymToString(keysym)); diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp b/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp index 0d2bdab8f8..18f1141c6d 100644 --- a/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp @@ -16,7 +16,7 @@ KeyboardMouse::KeyboardMouse(Window window) : m_window(window) { memset(&m_state, 0, sizeof(m_state)); - m_display = XOpenDisplay(NULL); + m_display = XOpenDisplay(nullptr); int min_keycode, max_keycode; XDisplayKeycodes(m_display, &min_keycode, &max_keycode); @@ -107,7 +107,7 @@ KeyboardMouse::Key::Key(Display* const display, KeyCode keycode, const char* key // 0x0110ffff is the top of the unicode character range according // to keysymdef.h although it is probably more than we need. if (keysym == NoSymbol || keysym > 0x0110ffff || - XKeysymToString(keysym) == NULL) + XKeysymToString(keysym) == nullptr) m_keyname = std::string(); else m_keyname = std::string(XKeysymToString(keysym)); diff --git a/Source/Core/InputCommon/UDPWiimote.cpp b/Source/Core/InputCommon/UDPWiimote.cpp index a50dbc17ca..1dad7d52d2 100644 --- a/Source/Core/InputCommon/UDPWiimote.cpp +++ b/Source/Core/InputCommon/UDPWiimote.cpp @@ -72,7 +72,7 @@ UDPWiimote::UDPWiimote(const char *_port, const char * name, int _index) : static bool sranded=false; if (!sranded) { - srand((unsigned int)time(0)); + srand((unsigned int)time(nullptr)); sranded=true; } bcastMagic=rand() & 0xFFFF; @@ -107,7 +107,7 @@ UDPWiimote::UDPWiimote(const char *_port, const char * name, int _index) : return; } - if ((rv = getaddrinfo(NULL, _port, &hints, &servinfo)) != 0) + if ((rv = getaddrinfo(nullptr, _port, &hints, &servinfo)) != 0) { cleanup; err=-1; @@ -115,7 +115,7 @@ UDPWiimote::UDPWiimote(const char *_port, const char * name, int _index) : } // loop through all the results and bind to everything we can - for(p = servinfo; p != NULL; p = p->ai_next) + for(p = servinfo; p != nullptr; p = p->ai_next) { sock_t sock; if ((sock = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == BAD_SOCK) @@ -191,7 +191,7 @@ void UDPWiimote::mainThread() lk.unlock(); //VERY hacky. don't like it if (d->exit) return; - int rt=select(maxfd,&fds,NULL,NULL,&timeout); + int rt=select(maxfd,&fds,nullptr,nullptr,&timeout); if (d->exit) return; lk.lock(); if (d->exit) return; diff --git a/Source/Core/InputCommon/UDPWrapper.cpp b/Source/Core/InputCommon/UDPWrapper.cpp index 19eb619679..a205fb0280 100644 --- a/Source/Core/InputCommon/UDPWrapper.cpp +++ b/Source/Core/InputCommon/UDPWrapper.cpp @@ -18,7 +18,7 @@ const std::string DefaultPort(const int index) UDPWrapper::UDPWrapper(int indx, const char* const _name) : ControllerEmu::ControlGroup(_name,GROUP_TYPE_UDPWII), - inst(NULL), index(indx), + inst(nullptr), index(indx), updIR(false),updAccel(false), updButt(false),udpEn(false) , port(DefaultPort(indx)) @@ -68,7 +68,7 @@ void UDPWrapper::SaveConfig(IniFile::Section *sec, const std::string& defdev, co void UDPWrapper::Refresh() { - bool udpAEn=(inst!=NULL); + bool udpAEn=(inst!=nullptr); if (udpEn&&udpAEn) { if (strcmp(inst->getPort(),port.c_str())) @@ -82,7 +82,7 @@ void UDPWrapper::Refresh() { if (inst) delete inst; - inst = NULL; + inst = nullptr; return; } //else diff --git a/Source/Core/VideoBackends/D3D/D3DBase.cpp b/Source/Core/VideoBackends/D3D/D3DBase.cpp index 4575d47f37..4efacfa689 100644 --- a/Source/Core/VideoBackends/D3D/D3DBase.cpp +++ b/Source/Core/VideoBackends/D3D/D3DBase.cpp @@ -11,29 +11,29 @@ namespace DX11 { -HINSTANCE hD3DCompilerDll = NULL; -D3DREFLECT PD3DReflect = NULL; -pD3DCompile PD3DCompile = NULL; +HINSTANCE hD3DCompilerDll = nullptr; +D3DREFLECT PD3DReflect = nullptr; +pD3DCompile PD3DCompile = nullptr; int d3dcompiler_dll_ref = 0; -CREATEDXGIFACTORY PCreateDXGIFactory = NULL; -HINSTANCE hDXGIDll = NULL; +CREATEDXGIFACTORY PCreateDXGIFactory = nullptr; +HINSTANCE hDXGIDll = nullptr; int dxgi_dll_ref = 0; typedef HRESULT (WINAPI* D3D11CREATEDEVICEANDSWAPCHAIN)(IDXGIAdapter*, D3D_DRIVER_TYPE, HMODULE, UINT, CONST D3D_FEATURE_LEVEL*, UINT, UINT, CONST DXGI_SWAP_CHAIN_DESC*, IDXGISwapChain**, ID3D11Device**, D3D_FEATURE_LEVEL*, ID3D11DeviceContext**); -D3D11CREATEDEVICE PD3D11CreateDevice = NULL; -D3D11CREATEDEVICEANDSWAPCHAIN PD3D11CreateDeviceAndSwapChain = NULL; -HINSTANCE hD3DDll = NULL; +D3D11CREATEDEVICE PD3D11CreateDevice = nullptr; +D3D11CREATEDEVICEANDSWAPCHAIN PD3D11CreateDeviceAndSwapChain = nullptr; +HINSTANCE hD3DDll = nullptr; int d3d_dll_ref = 0; namespace D3D { -ID3D11Device* device = NULL; -ID3D11DeviceContext* context = NULL; -IDXGISwapChain* swapchain = NULL; +ID3D11Device* device = nullptr; +ID3D11DeviceContext* context = nullptr; +IDXGISwapChain* swapchain = nullptr; D3D_FEATURE_LEVEL featlevel; -D3DTexture2D* backbuf = NULL; +D3DTexture2D* backbuf = nullptr; HWND hWnd; std::vector aa_modes; // supported AA modes of the current adapter @@ -59,12 +59,12 @@ HRESULT LoadDXGI() hDXGIDll = LoadLibraryA("dxgi.dll"); if (!hDXGIDll) { - MessageBoxA(NULL, "Failed to load dxgi.dll", "Critical error", MB_OK | MB_ICONERROR); + MessageBoxA(nullptr, "Failed to load dxgi.dll", "Critical error", MB_OK | MB_ICONERROR); --dxgi_dll_ref; return E_FAIL; } PCreateDXGIFactory = (CREATEDXGIFACTORY)GetProcAddress(hDXGIDll, "CreateDXGIFactory"); - if (PCreateDXGIFactory == NULL) MessageBoxA(NULL, "GetProcAddress failed for CreateDXGIFactory!", "Critical error", MB_OK | MB_ICONERROR); + if (PCreateDXGIFactory == nullptr) MessageBoxA(nullptr, "GetProcAddress failed for CreateDXGIFactory!", "Critical error", MB_OK | MB_ICONERROR); return S_OK; } @@ -77,15 +77,15 @@ HRESULT LoadD3D() hD3DDll = LoadLibraryA("d3d11.dll"); if (!hD3DDll) { - MessageBoxA(NULL, "Failed to load d3d11.dll", "Critical error", MB_OK | MB_ICONERROR); + MessageBoxA(nullptr, "Failed to load d3d11.dll", "Critical error", MB_OK | MB_ICONERROR); --d3d_dll_ref; return E_FAIL; } PD3D11CreateDevice = (D3D11CREATEDEVICE)GetProcAddress(hD3DDll, "D3D11CreateDevice"); - if (PD3D11CreateDevice == NULL) MessageBoxA(NULL, "GetProcAddress failed for D3D11CreateDevice!", "Critical error", MB_OK | MB_ICONERROR); + if (PD3D11CreateDevice == nullptr) MessageBoxA(nullptr, "GetProcAddress failed for D3D11CreateDevice!", "Critical error", MB_OK | MB_ICONERROR); PD3D11CreateDeviceAndSwapChain = (D3D11CREATEDEVICEANDSWAPCHAIN)GetProcAddress(hD3DDll, "D3D11CreateDeviceAndSwapChain"); - if (PD3D11CreateDeviceAndSwapChain == NULL) MessageBoxA(NULL, "GetProcAddress failed for D3D11CreateDeviceAndSwapChain!", "Critical error", MB_OK | MB_ICONERROR); + if (PD3D11CreateDeviceAndSwapChain == nullptr) MessageBoxA(nullptr, "GetProcAddress failed for D3D11CreateDeviceAndSwapChain!", "Critical error", MB_OK | MB_ICONERROR); return S_OK; } @@ -104,7 +104,7 @@ HRESULT LoadD3DCompiler() hD3DCompilerDll = LoadLibraryA("D3DCompiler_42.dll"); if (!hD3DCompilerDll) { - MessageBoxA(NULL, "Failed to load D3DCompiler_42.dll, update your DX11 runtime, please", "Critical error", MB_OK | MB_ICONERROR); + MessageBoxA(nullptr, "Failed to load D3DCompiler_42.dll, update your DX11 runtime, please", "Critical error", MB_OK | MB_ICONERROR); return E_FAIL; } else @@ -114,9 +114,9 @@ HRESULT LoadD3DCompiler() } PD3DReflect = (D3DREFLECT)GetProcAddress(hD3DCompilerDll, "D3DReflect"); - if (PD3DReflect == NULL) MessageBoxA(NULL, "GetProcAddress failed for D3DReflect!", "Critical error", MB_OK | MB_ICONERROR); + if (PD3DReflect == nullptr) MessageBoxA(nullptr, "GetProcAddress failed for D3DReflect!", "Critical error", MB_OK | MB_ICONERROR); PD3DCompile = (pD3DCompile)GetProcAddress(hD3DCompilerDll, "D3DCompile"); - if (PD3DCompile == NULL) MessageBoxA(NULL, "GetProcAddress failed for D3DCompile!", "Critical error", MB_OK | MB_ICONERROR); + if (PD3DCompile == nullptr) MessageBoxA(nullptr, "GetProcAddress failed for D3DCompile!", "Critical error", MB_OK | MB_ICONERROR); return S_OK; } @@ -127,8 +127,8 @@ void UnloadDXGI() if (--dxgi_dll_ref != 0) return; if(hDXGIDll) FreeLibrary(hDXGIDll); - hDXGIDll = NULL; - PCreateDXGIFactory = NULL; + hDXGIDll = nullptr; + PCreateDXGIFactory = nullptr; } void UnloadD3D() @@ -137,9 +137,9 @@ void UnloadD3D() if (--d3d_dll_ref != 0) return; if(hD3DDll) FreeLibrary(hD3DDll); - hD3DDll = NULL; - PD3D11CreateDevice = NULL; - PD3D11CreateDeviceAndSwapChain = NULL; + hD3DDll = nullptr; + PD3D11CreateDevice = nullptr; + PD3D11CreateDeviceAndSwapChain = nullptr; } void UnloadD3DCompiler() @@ -148,8 +148,8 @@ void UnloadD3DCompiler() if (--d3dcompiler_dll_ref != 0) return; if (hD3DCompilerDll) FreeLibrary(hD3DCompilerDll); - hD3DCompilerDll = NULL; - PD3DReflect = NULL; + hD3DCompilerDll = nullptr; + PD3DReflect = nullptr; } std::vector EnumAAModes(IDXGIAdapter* adapter) @@ -161,7 +161,7 @@ std::vector EnumAAModes(IDXGIAdapter* adapter) ID3D11Device* device; ID3D11DeviceContext* context; D3D_FEATURE_LEVEL feat_level; - HRESULT hr = PD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, D3D11_CREATE_DEVICE_SINGLETHREADED, supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, &device, &feat_level, &context); + HRESULT hr = PD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, D3D11_CREATE_DEVICE_SINGLETHREADED, supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, &device, &feat_level, &context); if (FAILED(hr) || feat_level == D3D_FEATURE_LEVEL_10_0) { DXGI_SAMPLE_DESC desc; @@ -193,7 +193,7 @@ std::vector EnumAAModes(IDXGIAdapter* adapter) D3D_FEATURE_LEVEL GetFeatureLevel(IDXGIAdapter* adapter) { D3D_FEATURE_LEVEL feat_level = D3D_FEATURE_LEVEL_9_1; - PD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, D3D11_CREATE_DEVICE_SINGLETHREADED, supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, NULL, &feat_level, NULL); + PD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, D3D11_CREATE_DEVICE_SINGLETHREADED, supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, nullptr, &feat_level, nullptr); return feat_level; } @@ -269,7 +269,7 @@ HRESULT Create(HWND wnd) mode_desc.Height = yres; mode_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; mode_desc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED; - hr = output->FindClosestMatchingMode(&mode_desc, &swap_chain_desc.BufferDesc, NULL); + hr = output->FindClosestMatchingMode(&mode_desc, &swap_chain_desc.BufferDesc, nullptr); if (FAILED(hr)) MessageBox(wnd, _T("Failed to find a supported video mode"), _T("Dolphin Direct3D 11 backend"), MB_OK | MB_ICONERROR); // forcing buffer resolution to xres and yres.. TODO: The new video mode might not actually be supported! @@ -280,7 +280,7 @@ HRESULT Create(HWND wnd) // Creating debug devices can sometimes fail if the user doesn't have the correct // version of the DirectX SDK. If it does, simply fallback to a non-debug device. { - hr = PD3D11CreateDeviceAndSwapChain(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, + hr = PD3D11CreateDeviceAndSwapChain(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, D3D11_CREATE_DEVICE_SINGLETHREADED | D3D11_CREATE_DEVICE_DEBUG, supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, &swap_chain_desc, &swapchain, &device, @@ -290,7 +290,7 @@ HRESULT Create(HWND wnd) if (FAILED(hr)) #endif { - hr = PD3D11CreateDeviceAndSwapChain(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, + hr = PD3D11CreateDeviceAndSwapChain(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, D3D11_CREATE_DEVICE_SINGLETHREADED, supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, &swap_chain_desc, &swapchain, &device, @@ -322,11 +322,11 @@ HRESULT Create(HWND wnd) } backbuf = new D3DTexture2D(buf, D3D11_BIND_RENDER_TARGET); SAFE_RELEASE(buf); - CHECK(backbuf!=NULL, "Create back buffer texture"); + CHECK(backbuf!=nullptr, "Create back buffer texture"); SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetTex(), "backbuffer texture"); SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetRTV(), "backbuffer render target view"); - context->OMSetRenderTargets(1, &backbuf->GetRTV(), NULL); + context->OMSetRenderTargets(1, &backbuf->GetRTV(), nullptr); // BGRA textures are easier to deal with in TextureCache, but might not be supported by the hardware UINT format_support; @@ -356,7 +356,7 @@ void Close() { NOTICE_LOG(VIDEO, "Successfully released all device references!"); } - device = NULL; + device = nullptr; // unload DLLs UnloadD3D(); @@ -439,7 +439,7 @@ void Reset() } backbuf = new D3DTexture2D(buf, D3D11_BIND_RENDER_TARGET); SAFE_RELEASE(buf); - CHECK(backbuf!=NULL, "Create back buffer texture"); + CHECK(backbuf!=nullptr, "Create back buffer texture"); SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetTex(), "backbuffer texture"); SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetRTV(), "backbuffer render target view"); } @@ -452,7 +452,7 @@ bool BeginFrame() return false; } bFrameInProgress = true; - return (device != NULL); + return (device != nullptr); } void EndFrame() diff --git a/Source/Core/VideoBackends/D3D/D3DBase.h b/Source/Core/VideoBackends/D3D/D3DBase.h index 457b62d8d9..f4f364bb89 100644 --- a/Source/Core/VideoBackends/D3D/D3DBase.h +++ b/Source/Core/VideoBackends/D3D/D3DBase.h @@ -14,9 +14,9 @@ namespace DX11 { -#define SAFE_RELEASE(x) { if (x) (x)->Release(); (x) = NULL; } -#define SAFE_DELETE(x) { delete (x); (x) = NULL; } -#define SAFE_DELETE_ARRAY(x) { delete[] (x); (x) = NULL; } +#define SAFE_RELEASE(x) { if (x) (x)->Release(); (x) = nullptr; } +#define SAFE_DELETE(x) { delete (x); (x) = nullptr; } +#define SAFE_DELETE_ARRAY(x) { delete[] (x); (x) = nullptr; } #define CHECK(cond, Message, ...) if (!(cond)) { PanicAlert(__FUNCTION__ "Failed in %s at line %d: " Message, __FILE__, __LINE__, __VA_ARGS__); } class D3DTexture2D; diff --git a/Source/Core/VideoBackends/D3D/D3DBlob.cpp b/Source/Core/VideoBackends/D3D/D3DBlob.cpp index 79fccd3dcf..8ace345fcb 100644 --- a/Source/Core/VideoBackends/D3D/D3DBlob.cpp +++ b/Source/Core/VideoBackends/D3D/D3DBlob.cpp @@ -9,7 +9,7 @@ namespace DX11 { -D3DBlob::D3DBlob(unsigned int blob_size, const u8* init_data) : ref(1), size(blob_size), blob(NULL) +D3DBlob::D3DBlob(unsigned int blob_size, const u8* init_data) : ref(1), size(blob_size), blob(nullptr) { data = new u8[blob_size]; if (init_data) memcpy(data, init_data, size); diff --git a/Source/Core/VideoBackends/D3D/D3DBlob.h b/Source/Core/VideoBackends/D3D/D3DBlob.h index 7e00ba689a..09d34525ae 100644 --- a/Source/Core/VideoBackends/D3D/D3DBlob.h +++ b/Source/Core/VideoBackends/D3D/D3DBlob.h @@ -16,7 +16,7 @@ class D3DBlob { public: // memory will be copied into an own buffer - D3DBlob(unsigned int blob_size, const u8* init_data = NULL); + D3DBlob(unsigned int blob_size, const u8* init_data = nullptr); // d3dblob will be AddRef'd D3DBlob(ID3D10Blob* d3dblob); diff --git a/Source/Core/VideoBackends/D3D/D3DShader.cpp b/Source/Core/VideoBackends/D3D/D3DShader.cpp index 21590143e7..2bbc1b31c4 100644 --- a/Source/Core/VideoBackends/D3D/D3DShader.cpp +++ b/Source/Core/VideoBackends/D3D/D3DShader.cpp @@ -18,9 +18,9 @@ namespace D3D ID3D11VertexShader* CreateVertexShaderFromByteCode(const void* bytecode, unsigned int len) { ID3D11VertexShader* v_shader; - HRESULT hr = D3D::device->CreateVertexShader(bytecode, len, NULL, &v_shader); + HRESULT hr = D3D::device->CreateVertexShader(bytecode, len, nullptr, &v_shader); if (FAILED(hr)) - return NULL; + return nullptr; return v_shader; } @@ -28,15 +28,15 @@ ID3D11VertexShader* CreateVertexShaderFromByteCode(const void* bytecode, unsigne // code->bytecode bool CompileVertexShader(const char* code, unsigned int len, D3DBlob** blob) { - ID3D10Blob* shaderBuffer = NULL; - ID3D10Blob* errorBuffer = NULL; + ID3D10Blob* shaderBuffer = nullptr; + ID3D10Blob* errorBuffer = nullptr; #if defined(_DEBUG) || defined(DEBUGFAST) UINT flags = D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY|D3D10_SHADER_DEBUG|D3D10_SHADER_WARNINGS_ARE_ERRORS; #else UINT flags = D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY|D3D10_SHADER_OPTIMIZATION_LEVEL3|D3D10_SHADER_SKIP_VALIDATION; #endif - HRESULT hr = PD3DCompile(code, len, NULL, NULL, NULL, "main", D3D::VertexShaderVersionString(), + HRESULT hr = PD3DCompile(code, len, nullptr, nullptr, nullptr, "main", D3D::VertexShaderVersionString(), flags, 0, &shaderBuffer, &errorBuffer); if (errorBuffer) { @@ -59,7 +59,7 @@ bool CompileVertexShader(const char* code, unsigned int len, D3DBlob** blob) D3D::VertexShaderVersionString(), (char*)errorBuffer->GetBufferPointer()); - *blob = NULL; + *blob = nullptr; errorBuffer->Release(); } else @@ -74,9 +74,9 @@ bool CompileVertexShader(const char* code, unsigned int len, D3DBlob** blob) ID3D11GeometryShader* CreateGeometryShaderFromByteCode(const void* bytecode, unsigned int len) { ID3D11GeometryShader* g_shader; - HRESULT hr = D3D::device->CreateGeometryShader(bytecode, len, NULL, &g_shader); + HRESULT hr = D3D::device->CreateGeometryShader(bytecode, len, nullptr, &g_shader); if (FAILED(hr)) - return NULL; + return nullptr; return g_shader; } @@ -85,15 +85,15 @@ ID3D11GeometryShader* CreateGeometryShaderFromByteCode(const void* bytecode, uns bool CompileGeometryShader(const char* code, unsigned int len, D3DBlob** blob, const D3D_SHADER_MACRO* pDefines) { - ID3D10Blob* shaderBuffer = NULL; - ID3D10Blob* errorBuffer = NULL; + ID3D10Blob* shaderBuffer = nullptr; + ID3D10Blob* errorBuffer = nullptr; #if defined(_DEBUG) || defined(DEBUGFAST) UINT flags = D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY|D3D10_SHADER_DEBUG|D3D10_SHADER_WARNINGS_ARE_ERRORS; #else UINT flags = D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY|D3D10_SHADER_OPTIMIZATION_LEVEL3|D3D10_SHADER_SKIP_VALIDATION; #endif - HRESULT hr = PD3DCompile(code, len, NULL, pDefines, NULL, "main", D3D::GeometryShaderVersionString(), + HRESULT hr = PD3DCompile(code, len, nullptr, pDefines, nullptr, "main", D3D::GeometryShaderVersionString(), flags, 0, &shaderBuffer, &errorBuffer); if (errorBuffer) @@ -117,7 +117,7 @@ bool CompileGeometryShader(const char* code, unsigned int len, D3DBlob** blob, D3D::GeometryShaderVersionString(), (char*)errorBuffer->GetBufferPointer()); - *blob = NULL; + *blob = nullptr; errorBuffer->Release(); } else @@ -132,11 +132,11 @@ bool CompileGeometryShader(const char* code, unsigned int len, D3DBlob** blob, ID3D11PixelShader* CreatePixelShaderFromByteCode(const void* bytecode, unsigned int len) { ID3D11PixelShader* p_shader; - HRESULT hr = D3D::device->CreatePixelShader(bytecode, len, NULL, &p_shader); + HRESULT hr = D3D::device->CreatePixelShader(bytecode, len, nullptr, &p_shader); if (FAILED(hr)) { PanicAlert("CreatePixelShaderFromByteCode failed at %s %d\n", __FILE__, __LINE__); - p_shader = NULL; + p_shader = nullptr; } return p_shader; } @@ -145,15 +145,15 @@ ID3D11PixelShader* CreatePixelShaderFromByteCode(const void* bytecode, unsigned bool CompilePixelShader(const char* code, unsigned int len, D3DBlob** blob, const D3D_SHADER_MACRO* pDefines) { - ID3D10Blob* shaderBuffer = NULL; - ID3D10Blob* errorBuffer = NULL; + ID3D10Blob* shaderBuffer = nullptr; + ID3D10Blob* errorBuffer = nullptr; #if defined(_DEBUG) || defined(DEBUGFAST) UINT flags = D3D10_SHADER_DEBUG|D3D10_SHADER_WARNINGS_ARE_ERRORS; #else UINT flags = D3D10_SHADER_OPTIMIZATION_LEVEL3; #endif - HRESULT hr = PD3DCompile(code, len, NULL, pDefines, NULL, "main", D3D::PixelShaderVersionString(), + HRESULT hr = PD3DCompile(code, len, nullptr, pDefines, nullptr, "main", D3D::PixelShaderVersionString(), flags, 0, &shaderBuffer, &errorBuffer); if (errorBuffer) @@ -177,7 +177,7 @@ bool CompilePixelShader(const char* code, unsigned int len, D3DBlob** blob, D3D::PixelShaderVersionString(), (char*)errorBuffer->GetBufferPointer()); - *blob = NULL; + *blob = nullptr; errorBuffer->Release(); } else @@ -192,33 +192,33 @@ bool CompilePixelShader(const char* code, unsigned int len, D3DBlob** blob, ID3D11VertexShader* CompileAndCreateVertexShader(const char* code, unsigned int len) { - D3DBlob* blob = NULL; + D3DBlob* blob = nullptr; if (CompileVertexShader(code, len, &blob)) { ID3D11VertexShader* v_shader = CreateVertexShaderFromByteCode(blob); blob->Release(); return v_shader; } - return NULL; + return nullptr; } ID3D11GeometryShader* CompileAndCreateGeometryShader(const char* code, unsigned int len, const D3D_SHADER_MACRO* pDefines) { - D3DBlob* blob = NULL; + D3DBlob* blob = nullptr; if (CompileGeometryShader(code, len, &blob, pDefines)) { ID3D11GeometryShader* g_shader = CreateGeometryShaderFromByteCode(blob); blob->Release(); return g_shader; } - return NULL; + return nullptr; } ID3D11PixelShader* CompileAndCreatePixelShader(const char* code, unsigned int len) { - D3DBlob* blob = NULL; + D3DBlob* blob = nullptr; CompilePixelShader(code, len, &blob); if (blob) { @@ -226,7 +226,7 @@ ID3D11PixelShader* CompileAndCreatePixelShader(const char* code, blob->Release(); return p_shader; } - return NULL; + return nullptr; } } // namespace diff --git a/Source/Core/VideoBackends/D3D/D3DShader.h b/Source/Core/VideoBackends/D3D/D3DShader.h index fc0951ab4b..6d572c847e 100644 --- a/Source/Core/VideoBackends/D3D/D3DShader.h +++ b/Source/Core/VideoBackends/D3D/D3DShader.h @@ -23,15 +23,15 @@ namespace D3D bool CompileVertexShader(const char* code, unsigned int len, D3DBlob** blob); bool CompileGeometryShader(const char* code, unsigned int len, - D3DBlob** blob, const D3D_SHADER_MACRO* pDefines = NULL); + D3DBlob** blob, const D3D_SHADER_MACRO* pDefines = nullptr); bool CompilePixelShader(const char* code, unsigned int len, - D3DBlob** blob, const D3D_SHADER_MACRO* pDefines = NULL); + D3DBlob** blob, const D3D_SHADER_MACRO* pDefines = nullptr); // Utility functions ID3D11VertexShader* CompileAndCreateVertexShader(const char* code, unsigned int len); ID3D11GeometryShader* CompileAndCreateGeometryShader(const char* code, - unsigned int len, const D3D_SHADER_MACRO* pDefines = NULL); + unsigned int len, const D3D_SHADER_MACRO* pDefines = nullptr); ID3D11PixelShader* CompileAndCreatePixelShader(const char* code, unsigned int len); @@ -44,7 +44,7 @@ namespace D3D inline ID3D11VertexShader* CompileAndCreateVertexShader(D3DBlob* code) { return CompileAndCreateVertexShader((const char*)code->Data(), code->Size()); } - inline ID3D11GeometryShader* CompileAndCreateGeometryShader(D3DBlob* code, const D3D_SHADER_MACRO* pDefines = NULL) + inline ID3D11GeometryShader* CompileAndCreateGeometryShader(D3DBlob* code, const D3D_SHADER_MACRO* pDefines = nullptr) { return CompileAndCreateGeometryShader((const char*)code->Data(), code->Size(), pDefines); } inline ID3D11PixelShader* CompileAndCreatePixelShader(D3DBlob* code) { return CompileAndCreatePixelShader((const char*)code->Data(), code->Size()); } diff --git a/Source/Core/VideoBackends/D3D/D3DTexture.cpp b/Source/Core/VideoBackends/D3D/D3DTexture.cpp index f0114cad95..d08c850187 100644 --- a/Source/Core/VideoBackends/D3D/D3DTexture.cpp +++ b/Source/Core/VideoBackends/D3D/D3DTexture.cpp @@ -39,7 +39,7 @@ void ReplaceRGBATexture2D(ID3D11Texture2D* pTexture, const u8* buffer, unsigned D3DTexture2D* D3DTexture2D::Create(unsigned int width, unsigned int height, D3D11_BIND_FLAG bind, D3D11_USAGE usage, DXGI_FORMAT fmt, unsigned int levels) { - ID3D11Texture2D* pTexture = NULL; + ID3D11Texture2D* pTexture = nullptr; HRESULT hr; D3D11_CPU_ACCESS_FLAG cpuflags; @@ -47,11 +47,11 @@ D3DTexture2D* D3DTexture2D::Create(unsigned int width, unsigned int height, D3D1 else if (usage == D3D11_USAGE_DYNAMIC) cpuflags = D3D11_CPU_ACCESS_WRITE; else cpuflags = (D3D11_CPU_ACCESS_FLAG)0; D3D11_TEXTURE2D_DESC texdesc = CD3D11_TEXTURE2D_DESC(fmt, width, height, 1, levels, bind, usage, cpuflags); - hr = D3D::device->CreateTexture2D(&texdesc, NULL, &pTexture); + hr = D3D::device->CreateTexture2D(&texdesc, nullptr, &pTexture); if (FAILED(hr)) { PanicAlert("Failed to create texture at %s, line %d: hr=%#x\n", __FILE__, __LINE__, hr); - return NULL; + return nullptr; } D3DTexture2D* ret = new D3DTexture2D(pTexture, bind); @@ -82,7 +82,7 @@ ID3D11DepthStencilView* &D3DTexture2D::GetDSV() { return dsv; } D3DTexture2D::D3DTexture2D(ID3D11Texture2D* texptr, D3D11_BIND_FLAG bind, DXGI_FORMAT srv_format, DXGI_FORMAT dsv_format, DXGI_FORMAT rtv_format, bool multisampled) - : ref(1), tex(texptr), srv(NULL), rtv(NULL), dsv(NULL) + : ref(1), tex(texptr), srv(nullptr), rtv(nullptr), dsv(nullptr) { D3D11_SRV_DIMENSION srv_dim = multisampled ? D3D11_SRV_DIMENSION_TEXTURE2DMS : D3D11_SRV_DIMENSION_TEXTURE2D; D3D11_DSV_DIMENSION dsv_dim = multisampled ? D3D11_DSV_DIMENSION_TEXTURE2DMS : D3D11_DSV_DIMENSION_TEXTURE2D; diff --git a/Source/Core/VideoBackends/D3D/D3DUtil.cpp b/Source/Core/VideoBackends/D3D/D3DUtil.cpp index 9dd7f23e39..7e5270fc50 100644 --- a/Source/Core/VideoBackends/D3D/D3DUtil.cpp +++ b/Source/Core/VideoBackends/D3D/D3DUtil.cpp @@ -21,10 +21,10 @@ namespace D3D class UtilVertexBuffer { public: - UtilVertexBuffer(int size) : buf(NULL), offset(0), max_size(size) + UtilVertexBuffer(int size) : buf(nullptr), offset(0), max_size(size) { D3D11_BUFFER_DESC desc = CD3D11_BUFFER_DESC(max_size, D3D11_BIND_VERTEX_BUFFER, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE); - device->CreateBuffer(&desc, NULL, &buf); + device->CreateBuffer(&desc, nullptr, &buf); } ~UtilVertexBuffer() { @@ -72,7 +72,7 @@ private: }; CD3DFont font; -UtilVertexBuffer* util_vbuf = NULL; +UtilVertexBuffer* util_vbuf = nullptr; #define MAX_NUM_VERTICES 50*6 struct FONT2DVERTEX { @@ -93,11 +93,11 @@ inline FONT2DVERTEX InitFont2DVertex(float x, float y, u32 color, float tu, floa CD3DFont::CD3DFont() : m_dwTexWidth(512), m_dwTexHeight(512) { - m_pTexture = NULL; - m_pVB = NULL; - m_InputLayout = NULL; - m_pshader = NULL; - m_vshader = NULL; + m_pTexture = nullptr; + m_pVB = nullptr; + m_InputLayout = nullptr; + m_pshader = nullptr; + m_vshader = nullptr; } const char fontpixshader[] = { @@ -161,8 +161,8 @@ int CD3DFont::Init() bmi.bmiHeader.biBitCount = 32; // Create a DC and a bitmap for the font - HDC hDC = CreateCompatibleDC(NULL); - HBITMAP hbmBitmap = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, (void**)&pBitmapBits, NULL, 0); + HDC hDC = CreateCompatibleDC(nullptr); + HBITMAP hbmBitmap = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, (void**)&pBitmapBits, nullptr, 0); SetMapMode(hDC, MM_TEXT); // create a GDI font @@ -170,7 +170,7 @@ int CD3DFont::Init() FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, VARIABLE_PITCH, _T("Tahoma")); - if (NULL == hFont) return E_FAIL; + if (nullptr == hFont) return E_FAIL; HGDIOBJ hOldbmBitmap = SelectObject(hDC, hbmBitmap); HGDIOBJ hOldFont = SelectObject(hDC, hFont); @@ -199,7 +199,7 @@ int CD3DFont::Init() y += m_LineHeight; } - ExtTextOutA(hDC, x+1, y+0, ETO_OPAQUE | ETO_CLIPPED, NULL, str, 1, NULL); + ExtTextOutA(hDC, x+1, y+0, ETO_OPAQUE | ETO_CLIPPED, nullptr, str, 1, nullptr); m_fTexCoords[c][0] = ((float)(x+0))/m_dwTexWidth; m_fTexCoords[c][1] = ((float)(y+0))/m_dwTexHeight; m_fTexCoords[c][2] = ((float)(x+0+size.cx))/m_dwTexWidth; @@ -215,7 +215,7 @@ int CD3DFont::Init() D3D11_TEXTURE2D_DESC texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R8G8B8A8_UNORM, m_dwTexWidth, m_dwTexHeight, 1, 1, D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE); - hr = device->CreateTexture2D(&texdesc, NULL, &buftex); + hr = device->CreateTexture2D(&texdesc, nullptr, &buftex); if (FAILED(hr)) { PanicAlert("Failed to create font texture"); @@ -240,7 +240,7 @@ int CD3DFont::Init() // Done updating texture, so clean up used objects context->Unmap(buftex, 0); - hr = D3D::device->CreateShaderResourceView(buftex, NULL, &m_pTexture); + hr = D3D::device->CreateShaderResourceView(buftex, nullptr, &m_pTexture); if (FAILED(hr)) PanicAlert("Failed to create shader resource view at %s %d\n", __FILE__, __LINE__); SAFE_RELEASE(buftex); @@ -252,14 +252,14 @@ int CD3DFont::Init() // setup device objects for drawing m_pshader = D3D::CompileAndCreatePixelShader(fontpixshader, sizeof(fontpixshader)); - if (m_pshader == NULL) PanicAlert("Failed to create pixel shader, %s %d\n", __FILE__, __LINE__); + if (m_pshader == nullptr) PanicAlert("Failed to create pixel shader, %s %d\n", __FILE__, __LINE__); D3D::SetDebugObjectName((ID3D11DeviceChild*)m_pshader, "pixel shader of a CD3DFont object"); D3DBlob* vsbytecode; D3D::CompileVertexShader(fontvertshader, sizeof(fontvertshader), &vsbytecode); - if (vsbytecode == NULL) PanicAlert("Failed to compile vertex shader, %s %d\n", __FILE__, __LINE__); + if (vsbytecode == nullptr) PanicAlert("Failed to compile vertex shader, %s %d\n", __FILE__, __LINE__); m_vshader = D3D::CreateVertexShaderFromByteCode(vsbytecode); - if (m_vshader == NULL) PanicAlert("Failed to create vertex shader, %s %d\n", __FILE__, __LINE__); + if (m_vshader == nullptr) PanicAlert("Failed to create vertex shader, %s %d\n", __FILE__, __LINE__); D3D::SetDebugObjectName((ID3D11DeviceChild*)m_vshader, "vertex shader of a CD3DFont object"); const D3D11_INPUT_ELEMENT_DESC desc[] = @@ -293,7 +293,7 @@ int CD3DFont::Init() D3D::SetDebugObjectName((ID3D11DeviceChild*)m_raststate, "rasterizer state of a CD3DFont object"); D3D11_BUFFER_DESC vbdesc = CD3D11_BUFFER_DESC(MAX_NUM_VERTICES*sizeof(FONT2DVERTEX), D3D11_BIND_VERTEX_BUFFER, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE); - if (FAILED(hr = device->CreateBuffer(&vbdesc, NULL, &m_pVB))) + if (FAILED(hr = device->CreateBuffer(&vbdesc, nullptr, &m_pVB))) { PanicAlert("Failed to create font vertex buffer at %s, line %d\n", __FILE__, __LINE__); return hr; @@ -347,8 +347,8 @@ int CD3DFont::DrawTextScaled(float x, float y, float size, float spacing, u32 dw D3D::stateman->PushRasterizerState(m_raststate); D3D::stateman->Apply(); - D3D::context->PSSetShader(m_pshader, NULL, 0); - D3D::context->VSSetShader(m_vshader, NULL, 0); + D3D::context->PSSetShader(m_pshader, nullptr, 0); + D3D::context->VSSetShader(m_vshader, nullptr, 0); D3D::context->IASetInputLayout(m_InputLayout); D3D::context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); @@ -415,8 +415,8 @@ int CD3DFont::DrawTextScaled(float x, float y, float size, float spacing, u32 dw return S_OK; } -ID3D11SamplerState* linear_copy_sampler = NULL; -ID3D11SamplerState* point_copy_sampler = NULL; +ID3D11SamplerState* linear_copy_sampler = nullptr; +ID3D11SamplerState* point_copy_sampler = nullptr; typedef struct { float x,y,z,u,v,w; } STQVertex; typedef struct { float x,y,z,u,v,w; } STSQVertex; @@ -545,13 +545,13 @@ void drawShadedTexQuad(ID3D11ShaderResourceView* texture, D3D::context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); D3D::context->IASetInputLayout(layout); D3D::context->IASetVertexBuffers(0, 1, &util_vbuf->GetBuffer(), &stride, &offset); - D3D::context->PSSetShader(PShader, NULL, 0); + D3D::context->PSSetShader(PShader, nullptr, 0); D3D::context->PSSetShaderResources(0, 1, &texture); - D3D::context->VSSetShader(Vshader, NULL, 0); + D3D::context->VSSetShader(Vshader, nullptr, 0); D3D::stateman->Apply(); D3D::context->Draw(4, stq_offset); - ID3D11ShaderResourceView* texres = NULL; + ID3D11ShaderResourceView* texres = nullptr; context->PSSetShaderResources(0, 1, &texres); // immediately unbind the texture } @@ -603,12 +603,12 @@ void drawShadedTexSubQuad(ID3D11ShaderResourceView* texture, context->IASetVertexBuffers(0, 1, &util_vbuf->GetBuffer(), &stride, &offset); context->IASetInputLayout(layout); context->PSSetShaderResources(0, 1, &texture); - context->PSSetShader(PShader, NULL, 0); - context->VSSetShader(Vshader, NULL, 0); + context->PSSetShader(PShader, nullptr, 0); + context->VSSetShader(Vshader, nullptr, 0); stateman->Apply(); context->Draw(4, stsq_offset); - ID3D11ShaderResourceView* texres = NULL; + ID3D11ShaderResourceView* texres = nullptr; context->PSSetShaderResources(0, 1, &texres); // immediately unbind the texture } @@ -638,8 +638,8 @@ void drawColorQuad(u32 Color, float x1, float y1, float x2, float y2) draw_quad_data.col = Color; } - context->VSSetShader(VertexShaderCache::GetClearVertexShader(), NULL, 0); - context->PSSetShader(PixelShaderCache::GetClearProgram(), NULL, 0); + context->VSSetShader(VertexShaderCache::GetClearVertexShader(), nullptr, 0); + context->PSSetShader(PixelShaderCache::GetClearProgram(), nullptr, 0); context->IASetInputLayout(VertexShaderCache::GetClearInputLayout()); UINT stride = sizeof(ColVertex); @@ -668,8 +668,8 @@ void drawClearQuad(u32 Color, float z, ID3D11PixelShader* PShader, ID3D11VertexS clear_quad_data.col = Color; clear_quad_data.z = z; } - context->VSSetShader(Vshader, NULL, 0); - context->PSSetShader(PShader, NULL, 0); + context->VSSetShader(Vshader, nullptr, 0); + context->PSSetShader(PShader, nullptr, 0); context->IASetInputLayout(layout); UINT stride = sizeof(ClearVertex); diff --git a/Source/Core/VideoBackends/D3D/FramebufferManager.cpp b/Source/Core/VideoBackends/D3D/FramebufferManager.cpp index 6b217fd0a1..aeaaf6b8e8 100644 --- a/Source/Core/VideoBackends/D3D/FramebufferManager.cpp +++ b/Source/Core/VideoBackends/D3D/FramebufferManager.cpp @@ -59,10 +59,10 @@ FramebufferManager::FramebufferManager() // EFB color texture - primary render target texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R8G8B8A8_UNORM, target_width, target_height, 1, 1, D3D11_BIND_SHADER_RESOURCE|D3D11_BIND_RENDER_TARGET, D3D11_USAGE_DEFAULT, 0, sample_desc.Count, sample_desc.Quality); - hr = D3D::device->CreateTexture2D(&texdesc, NULL, &buf); + hr = D3D::device->CreateTexture2D(&texdesc, nullptr, &buf); CHECK(hr==S_OK, "create EFB color texture (size: %dx%d; hr=%#x)", target_width, target_height, hr); m_efb.color_tex = new D3DTexture2D(buf, (D3D11_BIND_FLAG)(D3D11_BIND_SHADER_RESOURCE|D3D11_BIND_RENDER_TARGET), DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM, (sample_desc.Count > 1)); - CHECK(m_efb.color_tex!=NULL, "create EFB color texture (size: %dx%d)", target_width, target_height); + CHECK(m_efb.color_tex!=nullptr, "create EFB color texture (size: %dx%d)", target_width, target_height); SAFE_RELEASE(buf); D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.color_tex->GetTex(), "EFB color texture"); D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.color_tex->GetSRV(), "EFB color texture shader resource view"); @@ -70,10 +70,10 @@ FramebufferManager::FramebufferManager() // Temporary EFB color texture - used in ReinterpretPixelData texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R8G8B8A8_UNORM, target_width, target_height, 1, 1, D3D11_BIND_SHADER_RESOURCE|D3D11_BIND_RENDER_TARGET, D3D11_USAGE_DEFAULT, 0, sample_desc.Count, sample_desc.Quality); - hr = D3D::device->CreateTexture2D(&texdesc, NULL, &buf); + hr = D3D::device->CreateTexture2D(&texdesc, nullptr, &buf); CHECK(hr==S_OK, "create EFB color temp texture (size: %dx%d; hr=%#x)", target_width, target_height, hr); m_efb.color_temp_tex = new D3DTexture2D(buf, (D3D11_BIND_FLAG)(D3D11_BIND_SHADER_RESOURCE|D3D11_BIND_RENDER_TARGET), DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM, (sample_desc.Count > 1)); - CHECK(m_efb.color_temp_tex!=NULL, "create EFB color temp texture (size: %dx%d)", target_width, target_height); + CHECK(m_efb.color_temp_tex!=nullptr, "create EFB color temp texture (size: %dx%d)", target_width, target_height); SAFE_RELEASE(buf); D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.color_temp_tex->GetTex(), "EFB color temp texture"); D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.color_temp_tex->GetSRV(), "EFB color temp texture shader resource view"); @@ -81,13 +81,13 @@ FramebufferManager::FramebufferManager() // AccessEFB - Sysmem buffer used to retrieve the pixel data from color_tex texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R8G8B8A8_UNORM, 1, 1, 1, 1, 0, D3D11_USAGE_STAGING, D3D11_CPU_ACCESS_READ); - hr = D3D::device->CreateTexture2D(&texdesc, NULL, &m_efb.color_staging_buf); + hr = D3D::device->CreateTexture2D(&texdesc, nullptr, &m_efb.color_staging_buf); CHECK(hr==S_OK, "create EFB color staging buffer (hr=%#x)", hr); D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.color_staging_buf, "EFB color staging texture (used for Renderer::AccessEFB)"); // EFB depth buffer - primary depth buffer texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R24G8_TYPELESS, target_width, target_height, 1, 1, D3D11_BIND_DEPTH_STENCIL|D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_DEFAULT, 0, sample_desc.Count, sample_desc.Quality); - hr = D3D::device->CreateTexture2D(&texdesc, NULL, &buf); + hr = D3D::device->CreateTexture2D(&texdesc, nullptr, &buf); CHECK(hr==S_OK, "create EFB depth texture (size: %dx%d; hr=%#x)", target_width, target_height, hr); m_efb.depth_tex = new D3DTexture2D(buf, (D3D11_BIND_FLAG)(D3D11_BIND_DEPTH_STENCIL|D3D11_BIND_SHADER_RESOURCE), DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN, (sample_desc.Count > 1)); SAFE_RELEASE(buf); @@ -97,7 +97,7 @@ FramebufferManager::FramebufferManager() // Render buffer for AccessEFB (depth data) texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R32_FLOAT, 1, 1, 1, 1, D3D11_BIND_RENDER_TARGET); - hr = D3D::device->CreateTexture2D(&texdesc, NULL, &buf); + hr = D3D::device->CreateTexture2D(&texdesc, nullptr, &buf); CHECK(hr==S_OK, "create EFB depth read texture (hr=%#x)", hr); m_efb.depth_read_texture = new D3DTexture2D(buf, D3D11_BIND_RENDER_TARGET); SAFE_RELEASE(buf); @@ -106,7 +106,7 @@ FramebufferManager::FramebufferManager() // AccessEFB - Sysmem buffer used to retrieve the pixel data from depth_read_texture texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R32_FLOAT, 1, 1, 1, 1, 0, D3D11_USAGE_STAGING, D3D11_CPU_ACCESS_READ); - hr = D3D::device->CreateTexture2D(&texdesc, NULL, &m_efb.depth_staging_buf); + hr = D3D::device->CreateTexture2D(&texdesc, nullptr, &m_efb.depth_staging_buf); CHECK(hr==S_OK, "create EFB depth staging buffer (hr=%#x)", hr); D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.depth_staging_buf, "EFB depth staging texture (used for Renderer::AccessEFB)"); @@ -114,15 +114,15 @@ FramebufferManager::FramebufferManager() { // Framebuffer resolve textures (color+depth) texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R8G8B8A8_UNORM, target_width, target_height, 1, 1, D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_DEFAULT, 0, 1); - hr = D3D::device->CreateTexture2D(&texdesc, NULL, &buf); + hr = D3D::device->CreateTexture2D(&texdesc, nullptr, &buf); m_efb.resolved_color_tex = new D3DTexture2D(buf, D3D11_BIND_SHADER_RESOURCE, DXGI_FORMAT_R8G8B8A8_UNORM); - CHECK(m_efb.resolved_color_tex!=NULL, "create EFB color resolve texture (size: %dx%d)", target_width, target_height); + CHECK(m_efb.resolved_color_tex!=nullptr, "create EFB color resolve texture (size: %dx%d)", target_width, target_height); SAFE_RELEASE(buf); D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.resolved_color_tex->GetTex(), "EFB color resolve texture"); D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.resolved_color_tex->GetSRV(), "EFB color resolve texture shader resource view"); texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R24G8_TYPELESS, target_width, target_height, 1, 1, D3D11_BIND_SHADER_RESOURCE); - hr = D3D::device->CreateTexture2D(&texdesc, NULL, &buf); + hr = D3D::device->CreateTexture2D(&texdesc, nullptr, &buf); CHECK(hr==S_OK, "create EFB depth resolve texture (size: %dx%d; hr=%#x)", target_width, target_height, hr); m_efb.resolved_depth_tex = new D3DTexture2D(buf, D3D11_BIND_SHADER_RESOURCE, DXGI_FORMAT_R24_UNORM_X8_TYPELESS); SAFE_RELEASE(buf); @@ -131,8 +131,8 @@ FramebufferManager::FramebufferManager() } else { - m_efb.resolved_color_tex = NULL; - m_efb.resolved_depth_tex = NULL; + m_efb.resolved_color_tex = nullptr; + m_efb.resolved_depth_tex = nullptr; } s_xfbEncoder.Init(); @@ -200,7 +200,7 @@ void XFBSource::CopyEFB(float Gamma) const D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, (float)texWidth, (float)texHeight); D3D::context->RSSetViewports(1, &vp); - D3D::context->OMSetRenderTargets(1, &tex->GetRTV(), NULL); + D3D::context->OMSetRenderTargets(1, &tex->GetRTV(), nullptr); D3D::SetLinearCopySampler(); D3D::drawShadedTexQuad(FramebufferManager::GetEFBColorTexture()->GetSRV(), sourceRc.AsRECT(), diff --git a/Source/Core/VideoBackends/D3D/GfxState.cpp b/Source/Core/VideoBackends/D3D/GfxState.cpp index c31c45e2ea..af85993e4d 100644 --- a/Source/Core/VideoBackends/D3D/GfxState.cpp +++ b/Source/Core/VideoBackends/D3D/GfxState.cpp @@ -30,10 +30,10 @@ template AutoState::AutoState(const AutoState &source) template AutoState::~AutoState() { if(state) ((T*)state)->Release(); - state = NULL; + state = nullptr; } -StateManager::StateManager() : cur_blendstate(NULL), cur_depthstate(NULL), cur_raststate(NULL) {} +StateManager::StateManager() : cur_blendstate(nullptr), cur_depthstate(nullptr), cur_raststate(nullptr) {} void StateManager::PushBlendState(const ID3D11BlendState* state) { blendstates.push(AutoBlendState(state)); } void StateManager::PushDepthState(const ID3D11DepthStencilState* state) { depthstates.push(AutoDepthStencilState(state)); } @@ -49,7 +49,7 @@ void StateManager::Apply() if (cur_blendstate != blendstates.top().GetPtr()) { cur_blendstate = (ID3D11BlendState*)blendstates.top().GetPtr(); - D3D::context->OMSetBlendState(cur_blendstate, NULL, 0xFFFFFFFF); + D3D::context->OMSetBlendState(cur_blendstate, nullptr, 0xFFFFFFFF); } } else ERROR_LOG(VIDEO, "Tried to apply without blend state!"); diff --git a/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp b/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp index b0b71313fa..66910eb6f2 100644 --- a/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp +++ b/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp @@ -125,7 +125,7 @@ static const char LINE_GS_COMMON[] = ; LineGeometryShader::LineGeometryShader() - : m_ready(false), m_paramsBuffer(NULL) + : m_ready(false), m_paramsBuffer(nullptr) { } void LineGeometryShader::Init() @@ -138,7 +138,7 @@ void LineGeometryShader::Init() D3D11_BUFFER_DESC bd = CD3D11_BUFFER_DESC(sizeof(LineGSParams_Padded), D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE); - hr = D3D::device->CreateBuffer(&bd, NULL, &m_paramsBuffer); + hr = D3D::device->CreateBuffer(&bd, nullptr, &m_paramsBuffer); CHECK(SUCCEEDED(hr), "create line geometry shader params buffer"); D3D::SetDebugObjectName(m_paramsBuffer, "line geometry shader params buffer"); @@ -184,14 +184,14 @@ bool LineGeometryShader::SetShader(u32 components, float lineWidth, const std::string& numTexCoordsStr = numTexCoordsStream.str(); D3D_SHADER_MACRO macros[] = { { "NUM_TEXCOORDS", numTexCoordsStr.c_str() }, - { NULL, NULL } + { nullptr, nullptr } }; ID3D11GeometryShader* newShader = D3D::CompileAndCreateGeometryShader(code.GetBuffer(), unsigned int(strlen(code.GetBuffer())), macros); if (!newShader) { WARN_LOG(VIDEO, "Line geometry shader for components 0x%.08X failed to compile", components); // Add dummy shader to prevent trying to compile again - m_shaders[components] = NULL; + m_shaders[components] = nullptr; return false; } @@ -223,7 +223,7 @@ bool LineGeometryShader::SetShader(u32 components, float lineWidth, DEBUG_LOG(VIDEO, "Line params: width %f, texOffset %f, vpWidth %f, vpHeight %f", lineWidth, texOffset, vpWidth, vpHeight); - D3D::context->GSSetShader(shaderIt->second, NULL, 0); + D3D::context->GSSetShader(shaderIt->second, nullptr, 0); D3D::context->GSSetConstantBuffers(0, 1, &m_paramsBuffer); return true; diff --git a/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp b/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp index 661e1e4609..60ded71f7f 100644 --- a/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp +++ b/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp @@ -20,7 +20,7 @@ class D3DVertexFormat : public NativeVertexFormat ID3D11InputLayout* m_layout; public: - D3DVertexFormat() : m_num_elems(0), m_vs_bytecode(NULL), m_layout(NULL) {} + D3DVertexFormat() : m_num_elems(0), m_vs_bytecode(nullptr), m_layout(nullptr) {} ~D3DVertexFormat() { SAFE_RELEASE(m_vs_bytecode); SAFE_RELEASE(m_layout); } void Initialize(const PortableVertexDeclaration &_vtx_decl); diff --git a/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp b/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp index 3820fb3cb3..db7eb9ee3e 100644 --- a/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp +++ b/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp @@ -849,21 +849,21 @@ static const char EFB_ENCODE_PS[] = ; PSTextureEncoder::PSTextureEncoder() - : m_ready(false), m_out(NULL), m_outRTV(NULL), m_outStage(NULL), - m_encodeParams(NULL), - m_quad(NULL), m_vShader(NULL), m_quadLayout(NULL), - m_efbEncodeBlendState(NULL), m_efbEncodeDepthState(NULL), - m_efbEncodeRastState(NULL), m_efbSampler(NULL), - m_dynamicShader(NULL), m_classLinkage(NULL) + : m_ready(false), m_out(nullptr), m_outRTV(nullptr), m_outStage(nullptr), + m_encodeParams(nullptr), + m_quad(nullptr), m_vShader(nullptr), m_quadLayout(nullptr), + m_efbEncodeBlendState(nullptr), m_efbEncodeDepthState(nullptr), + m_efbEncodeRastState(nullptr), m_efbSampler(nullptr), + m_dynamicShader(nullptr), m_classLinkage(nullptr) { for (size_t i = 0; i < 4; ++i) - m_fetchClass[i] = NULL; + m_fetchClass[i] = nullptr; for (size_t i = 0; i < 2; ++i) - m_scaledFetchClass[i] = NULL; + m_scaledFetchClass[i] = nullptr; for (size_t i = 0; i < 2; ++i) - m_intensityClass[i] = NULL; + m_intensityClass[i] = nullptr; for (size_t i = 0; i < 16; ++i) - m_generatorClass[i] = NULL; + m_generatorClass[i] = nullptr; } static const D3D11_INPUT_ELEMENT_DESC QUAD_LAYOUT_DESC[] = { @@ -888,7 +888,7 @@ void PSTextureEncoder::Init() D3D11_TEXTURE2D_DESC t2dd = CD3D11_TEXTURE2D_DESC( DXGI_FORMAT_R32G32B32A32_UINT, EFB_WIDTH, EFB_HEIGHT/4, 1, 1, D3D11_BIND_RENDER_TARGET); - hr = D3D::device->CreateTexture2D(&t2dd, NULL, &m_out); + hr = D3D::device->CreateTexture2D(&t2dd, nullptr, &m_out); CHECK(SUCCEEDED(hr), "create efb encode output texture"); D3D::SetDebugObjectName(m_out, "efb encoder output texture"); @@ -905,7 +905,7 @@ void PSTextureEncoder::Init() t2dd.Usage = D3D11_USAGE_STAGING; t2dd.BindFlags = 0; t2dd.CPUAccessFlags = D3D11_CPU_ACCESS_READ; - hr = D3D::device->CreateTexture2D(&t2dd, NULL, &m_outStage); + hr = D3D::device->CreateTexture2D(&t2dd, nullptr, &m_outStage); CHECK(SUCCEEDED(hr), "create efb encode output staging buffer"); D3D::SetDebugObjectName(m_outStage, "efb encoder output staging buffer"); @@ -913,7 +913,7 @@ void PSTextureEncoder::Init() D3D11_BUFFER_DESC bd = CD3D11_BUFFER_DESC(sizeof(EFBEncodeParams), D3D11_BIND_CONSTANT_BUFFER); - hr = D3D::device->CreateBuffer(&bd, NULL, &m_encodeParams); + hr = D3D::device->CreateBuffer(&bd, nullptr, &m_encodeParams); CHECK(SUCCEEDED(hr), "create efb encode params buffer"); D3D::SetDebugObjectName(m_encodeParams, "efb encoder params buffer"); @@ -929,14 +929,14 @@ void PSTextureEncoder::Init() // Create vertex shader - D3DBlob* bytecode = NULL; + D3DBlob* bytecode = nullptr; if (!D3D::CompileVertexShader(EFB_ENCODE_VS, sizeof(EFB_ENCODE_VS), &bytecode)) { ERROR_LOG(VIDEO, "EFB encode vertex shader failed to compile"); return; } - hr = D3D::device->CreateVertexShader(bytecode->Data(), bytecode->Size(), NULL, &m_vShader); + hr = D3D::device->CreateVertexShader(bytecode->Data(), bytecode->Size(), nullptr, &m_vShader); CHECK(SUCCEEDED(hr), "create efb encode vertex shader"); D3D::SetDebugObjectName(m_vShader, "efb encoder vertex shader"); @@ -1084,7 +1084,7 @@ size_t PSTextureEncoder::Encode(u8* dst, unsigned int dstFormat, if (SetStaticShader(dstFormat, srcFormat, isIntensity, scaleByHalf)) #endif { - D3D::context->VSSetShader(m_vShader, NULL, 0); + D3D::context->VSSetShader(m_vShader, nullptr, 0); D3D::stateman->PushBlendState(m_efbEncodeBlendState); D3D::stateman->PushDepthState(m_efbEncodeDepthState); @@ -1116,11 +1116,11 @@ size_t PSTextureEncoder::Encode(u8* dst, unsigned int dstFormat, params.TexTop = float(targetRect.top) / g_renderer->GetTargetHeight(); params.TexRight = float(targetRect.right) / g_renderer->GetTargetWidth(); params.TexBottom = float(targetRect.bottom) / g_renderer->GetTargetHeight(); - D3D::context->UpdateSubresource(m_encodeParams, 0, NULL, ¶ms, 0, 0); + D3D::context->UpdateSubresource(m_encodeParams, 0, nullptr, ¶ms, 0, 0); D3D::context->VSSetConstantBuffers(0, 1, &m_encodeParams); - D3D::context->OMSetRenderTargets(1, &m_outRTV, NULL); + D3D::context->OMSetRenderTargets(1, &m_outRTV, nullptr); ID3D11ShaderResourceView* pEFB = (srcFormat == PIXELFMT_Z24) ? FramebufferManager::GetEFBDepthTexture()->GetSRV() : @@ -1144,13 +1144,13 @@ size_t PSTextureEncoder::Encode(u8* dst, unsigned int dstFormat, // Clean up state - IUnknown* nullDummy = NULL; + IUnknown* nullDummy = nullptr; D3D::context->PSSetSamplers(0, 1, (ID3D11SamplerState**)&nullDummy); D3D::context->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&nullDummy); D3D::context->PSSetConstantBuffers(0, 1, (ID3D11Buffer**)&nullDummy); - D3D::context->OMSetRenderTargets(0, NULL, NULL); + D3D::context->OMSetRenderTargets(0, nullptr, nullptr); D3D::context->VSSetConstantBuffers(0, 1, (ID3D11Buffer**)&nullDummy); @@ -1158,8 +1158,8 @@ size_t PSTextureEncoder::Encode(u8* dst, unsigned int dstFormat, D3D::stateman->PopDepthState(); D3D::stateman->PopBlendState(); - D3D::context->PSSetShader(NULL, NULL, 0); - D3D::context->VSSetShader(NULL, NULL, 0); + D3D::context->PSSetShader(nullptr, nullptr, 0); + D3D::context->VSSetShader(nullptr, nullptr, 0); // Transfer staging buffer to GameCube/Wii RAM @@ -1221,7 +1221,7 @@ bool PSTextureEncoder::SetStaticShader(unsigned int dstFormat, unsigned int srcF ComboMap::iterator it = m_staticShaders.find(key); if (it == m_staticShaders.end()) { - const char* generatorFuncName = NULL; + const char* generatorFuncName = nullptr; switch (generatorNum) { case 0x0: generatorFuncName = "Generate_0"; break; @@ -1239,7 +1239,7 @@ bool PSTextureEncoder::SetStaticShader(unsigned int dstFormat, unsigned int srcF case 0xC: generatorFuncName = "Generate_C"; break; default: WARN_LOG(VIDEO, "No generator available for dst format 0x%X; aborting", generatorNum); - m_staticShaders[key] = NULL; + m_staticShaders[key] = nullptr; return false; } @@ -1247,13 +1247,13 @@ bool PSTextureEncoder::SetStaticShader(unsigned int dstFormat, unsigned int srcF dstFormat, srcFormat, isIntensity ? 1 : 0, scaleByHalf ? 1 : 0); // Shader permutation not found, so compile it - D3DBlob* bytecode = NULL; + D3DBlob* bytecode = nullptr; D3D_SHADER_MACRO macros[] = { { "IMP_FETCH", FETCH_FUNC_NAMES[fetchNum] }, { "IMP_SCALEDFETCH", SCALEDFETCH_FUNC_NAMES[scaledFetchNum] }, { "IMP_INTENSITY", INTENSITY_FUNC_NAMES[intensityNum] }, { "IMP_GENERATOR", generatorFuncName }, - { NULL, NULL } + { nullptr, nullptr } }; if (!D3D::CompilePixelShader(EFB_ENCODE_PS, sizeof(EFB_ENCODE_PS), &bytecode, macros)) { @@ -1261,12 +1261,12 @@ bool PSTextureEncoder::SetStaticShader(unsigned int dstFormat, unsigned int srcF dstFormat, srcFormat, isIntensity ? 1 : 0, scaleByHalf ? 1 : 0); // Add dummy shader to map to prevent trying to compile over and // over again - m_staticShaders[key] = NULL; + m_staticShaders[key] = nullptr; return false; } ID3D11PixelShader* newShader; - HRESULT hr = D3D::device->CreatePixelShader(bytecode->Data(), bytecode->Size(), NULL, &newShader); + HRESULT hr = D3D::device->CreatePixelShader(bytecode->Data(), bytecode->Size(), nullptr, &newShader); CHECK(SUCCEEDED(hr), "create efb encoder pixel shader"); it = m_staticShaders.insert(std::make_pair(key, newShader)).first; @@ -1277,7 +1277,7 @@ bool PSTextureEncoder::SetStaticShader(unsigned int dstFormat, unsigned int srcF { if (it->second) { - D3D::context->PSSetShader(it->second, NULL, 0); + D3D::context->PSSetShader(it->second, nullptr, 0); return true; } else @@ -1292,11 +1292,11 @@ bool PSTextureEncoder::InitDynamicMode() HRESULT hr; D3D_SHADER_MACRO macros[] = { - { "DYNAMIC_MODE", NULL }, - { NULL, NULL } + { "DYNAMIC_MODE", nullptr }, + { nullptr, nullptr } }; - D3DBlob* bytecode = NULL; + D3DBlob* bytecode = nullptr; if (!D3D::CompilePixelShader(EFB_ENCODE_PS, sizeof(EFB_ENCODE_PS), &bytecode, macros)) { ERROR_LOG(VIDEO, "EFB encode pixel shader failed to compile"); @@ -1313,14 +1313,14 @@ bool PSTextureEncoder::InitDynamicMode() // Use D3DReflect - ID3D11ShaderReflection* reflect = NULL; + ID3D11ShaderReflection* reflect = nullptr; hr = PD3DReflect(bytecode->Data(), bytecode->Size(), IID_ID3D11ShaderReflection, (void**)&reflect); CHECK(SUCCEEDED(hr), "reflect on efb encoder shader"); // Get number of slots and create dynamic linkage array UINT numSlots = reflect->GetNumInterfaceSlots(); - m_linkageArray.resize(numSlots, NULL); + m_linkageArray.resize(numSlots, nullptr); // Get interface slots @@ -1342,13 +1342,13 @@ bool PSTextureEncoder::InitDynamicMode() // Class instances will be created at the time they are used for (size_t i = 0; i < 4; ++i) - m_fetchClass[i] = NULL; + m_fetchClass[i] = nullptr; for (size_t i = 0; i < 2; ++i) - m_scaledFetchClass[i] = NULL; + m_scaledFetchClass[i] = nullptr; for (size_t i = 0; i < 2; ++i) - m_intensityClass[i] = NULL; + m_intensityClass[i] = nullptr; for (size_t i = 0; i < 16; ++i) - m_generatorClass[i] = NULL; + m_generatorClass[i] = nullptr; reflect->Release(); bytecode->Release(); @@ -1378,7 +1378,7 @@ bool PSTextureEncoder::SetDynamicShader(unsigned int dstFormat, // FIXME: Not all the possible generators are available as classes yet. // When dynamic mode is usable, implement them. - const char* generatorName = NULL; + const char* generatorName = nullptr; switch (generatorNum) { case 0x4: generatorName = "cGenerator_4"; break; @@ -1438,7 +1438,7 @@ bool PSTextureEncoder::SetDynamicShader(unsigned int dstFormat, m_linkageArray[m_generatorSlot] = m_generatorClass[generatorNum]; D3D::context->PSSetShader(m_dynamicShader, - m_linkageArray.empty() ? NULL : &m_linkageArray[0], + m_linkageArray.empty() ? nullptr : &m_linkageArray[0], (UINT)m_linkageArray.size()); return true; diff --git a/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp b/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp index 4c234517a3..da1f1b0746 100644 --- a/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp +++ b/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp @@ -31,13 +31,13 @@ UidChecker PixelShaderCache::pixel_uid_checker; LinearDiskCache g_ps_disk_cache; -ID3D11PixelShader* s_ColorMatrixProgram[2] = {NULL}; -ID3D11PixelShader* s_ColorCopyProgram[2] = {NULL}; -ID3D11PixelShader* s_DepthMatrixProgram[2] = {NULL}; -ID3D11PixelShader* s_ClearProgram = NULL; -ID3D11PixelShader* s_rgba6_to_rgb8[2] = {NULL}; -ID3D11PixelShader* s_rgb8_to_rgba6[2] = {NULL}; -ID3D11Buffer* pscbuf = NULL; +ID3D11PixelShader* s_ColorMatrixProgram[2] = {nullptr}; +ID3D11PixelShader* s_ColorCopyProgram[2] = {nullptr}; +ID3D11PixelShader* s_DepthMatrixProgram[2] = {nullptr}; +ID3D11PixelShader* s_ClearProgram = nullptr; +ID3D11PixelShader* s_rgba6_to_rgb8[2] = {nullptr}; +ID3D11PixelShader* s_rgb8_to_rgba6[2] = {nullptr}; +ID3D11Buffer* pscbuf = nullptr; const char clear_program_code[] = { "void main(\n" @@ -291,7 +291,7 @@ ID3D11PixelShader* PixelShaderCache::GetColorCopyProgram(bool multisampled) char buf[1024]; int l = sprintf_s(buf, 1024, color_copy_program_code_msaa, D3D::GetAAMode(g_ActiveConfig.iMultisampleMode).Count); s_ColorCopyProgram[1] = D3D::CompileAndCreatePixelShader(buf, l); - CHECK(s_ColorCopyProgram[1]!=NULL, "Create color copy MSAA pixel shader"); + CHECK(s_ColorCopyProgram[1]!=nullptr, "Create color copy MSAA pixel shader"); D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ColorCopyProgram[1], "color copy MSAA pixel shader"); return s_ColorCopyProgram[1]; } @@ -307,7 +307,7 @@ ID3D11PixelShader* PixelShaderCache::GetColorMatrixProgram(bool multisampled) char buf[1024]; int l = sprintf_s(buf, 1024, color_matrix_program_code_msaa, D3D::GetAAMode(g_ActiveConfig.iMultisampleMode).Count); s_ColorMatrixProgram[1] = D3D::CompileAndCreatePixelShader(buf, l); - CHECK(s_ColorMatrixProgram[1]!=NULL, "Create color matrix MSAA pixel shader"); + CHECK(s_ColorMatrixProgram[1]!=nullptr, "Create color matrix MSAA pixel shader"); D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ColorMatrixProgram[1], "color matrix MSAA pixel shader"); return s_ColorMatrixProgram[1]; } @@ -323,7 +323,7 @@ ID3D11PixelShader* PixelShaderCache::GetDepthMatrixProgram(bool multisampled) char buf[1024]; int l = sprintf_s(buf, 1024, depth_matrix_program_msaa, D3D::GetAAMode(g_ActiveConfig.iMultisampleMode).Count); s_DepthMatrixProgram[1] = D3D::CompileAndCreatePixelShader(buf, l); - CHECK(s_DepthMatrixProgram[1]!=NULL, "Create depth matrix MSAA pixel shader"); + CHECK(s_DepthMatrixProgram[1]!=nullptr, "Create depth matrix MSAA pixel shader"); D3D::SetDebugObjectName((ID3D11DeviceChild*)s_DepthMatrixProgram[1], "depth matrix MSAA pixel shader"); return s_DepthMatrixProgram[1]; } @@ -364,28 +364,28 @@ void PixelShaderCache::Init() { unsigned int cbsize = ((sizeof(PixelShaderConstants))&(~0xf))+0x10; // must be a multiple of 16 D3D11_BUFFER_DESC cbdesc = CD3D11_BUFFER_DESC(cbsize, D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE); - D3D::device->CreateBuffer(&cbdesc, NULL, &pscbuf); - CHECK(pscbuf!=NULL, "Create pixel shader constant buffer"); + D3D::device->CreateBuffer(&cbdesc, nullptr, &pscbuf); + CHECK(pscbuf!=nullptr, "Create pixel shader constant buffer"); D3D::SetDebugObjectName((ID3D11DeviceChild*)pscbuf, "pixel shader constant buffer used to emulate the GX pipeline"); // used when drawing clear quads s_ClearProgram = D3D::CompileAndCreatePixelShader(clear_program_code, sizeof(clear_program_code)); - CHECK(s_ClearProgram!=NULL, "Create clear pixel shader"); + CHECK(s_ClearProgram!=nullptr, "Create clear pixel shader"); D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ClearProgram, "clear pixel shader"); // used when copying/resolving the color buffer s_ColorCopyProgram[0] = D3D::CompileAndCreatePixelShader(color_copy_program_code, sizeof(color_copy_program_code)); - CHECK(s_ColorCopyProgram[0]!=NULL, "Create color copy pixel shader"); + CHECK(s_ColorCopyProgram[0]!=nullptr, "Create color copy pixel shader"); D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ColorCopyProgram[0], "color copy pixel shader"); // used for color conversion s_ColorMatrixProgram[0] = D3D::CompileAndCreatePixelShader(color_matrix_program_code, sizeof(color_matrix_program_code)); - CHECK(s_ColorMatrixProgram[0]!=NULL, "Create color matrix pixel shader"); + CHECK(s_ColorMatrixProgram[0]!=nullptr, "Create color matrix pixel shader"); D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ColorMatrixProgram[0], "color matrix pixel shader"); // used for depth copy s_DepthMatrixProgram[0] = D3D::CompileAndCreatePixelShader(depth_matrix_program, sizeof(depth_matrix_program)); - CHECK(s_DepthMatrixProgram[0]!=NULL, "Create depth matrix pixel shader"); + CHECK(s_DepthMatrixProgram[0]!=nullptr, "Create depth matrix pixel shader"); D3D::SetDebugObjectName((ID3D11DeviceChild*)s_DepthMatrixProgram[0], "depth matrix pixel shader"); Clear(); @@ -405,7 +405,7 @@ void PixelShaderCache::Init() if (g_Config.bEnableShaderDebugging) Clear(); - last_entry = NULL; + last_entry = nullptr; } // ONLY to be used during shutdown. @@ -416,7 +416,7 @@ void PixelShaderCache::Clear() PixelShaders.clear(); pixel_uid_checker.Invalidate(); - last_entry = NULL; + last_entry = nullptr; } // Used in Swap() when AA mode has changed @@ -465,7 +465,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components) if (uid == last_uid) { GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE,true); - return (last_entry->shader != NULL); + return (last_entry->shader != nullptr); } } @@ -480,7 +480,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components) last_entry = &entry; GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE,true); - return (entry.shader != NULL); + return (entry.shader != nullptr); } // Need to compile a new shader @@ -512,7 +512,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components) bool PixelShaderCache::InsertByteCode(const PixelShaderUid &uid, const void* bytecode, unsigned int bytecodelen) { ID3D11PixelShader* shader = D3D::CreatePixelShaderFromByteCode(bytecode, bytecodelen); - if (shader == NULL) + if (shader == nullptr) return false; // TODO: Somehow make the debug name a bit more specific diff --git a/Source/Core/VideoBackends/D3D/PixelShaderCache.h b/Source/Core/VideoBackends/D3D/PixelShaderCache.h index 26981dc481..55a31379e3 100644 --- a/Source/Core/VideoBackends/D3D/PixelShaderCache.h +++ b/Source/Core/VideoBackends/D3D/PixelShaderCache.h @@ -42,7 +42,7 @@ private: std::string code; - PSCacheEntry() : shader(NULL) {} + PSCacheEntry() : shader(nullptr) {} void Destroy() { SAFE_RELEASE(shader); } }; diff --git a/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp b/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp index 5e7cb5eda6..3d1d8077eb 100644 --- a/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp +++ b/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp @@ -119,7 +119,7 @@ static const char POINT_GS_COMMON[] = ; PointGeometryShader::PointGeometryShader() - : m_ready(false), m_paramsBuffer(NULL) + : m_ready(false), m_paramsBuffer(nullptr) { } void PointGeometryShader::Init() @@ -132,7 +132,7 @@ void PointGeometryShader::Init() D3D11_BUFFER_DESC bd = CD3D11_BUFFER_DESC(sizeof(PointGSParams_Padded), D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE); - hr = D3D::device->CreateBuffer(&bd, NULL, &m_paramsBuffer); + hr = D3D::device->CreateBuffer(&bd, nullptr, &m_paramsBuffer); CHECK(SUCCEEDED(hr), "create point geometry shader params buffer"); D3D::SetDebugObjectName(m_paramsBuffer, "point geometry shader params buffer"); @@ -178,14 +178,14 @@ bool PointGeometryShader::SetShader(u32 components, float pointSize, const std::string& numTexCoordsStr = numTexCoordsStream.str(); D3D_SHADER_MACRO macros[] = { { "NUM_TEXCOORDS", numTexCoordsStr.c_str() }, - { NULL, NULL } + { nullptr, nullptr } }; ID3D11GeometryShader* newShader = D3D::CompileAndCreateGeometryShader(code.GetBuffer(), unsigned int(strlen(code.GetBuffer())), macros); if (!newShader) { WARN_LOG(VIDEO, "Point geometry shader for components 0x%.08X failed to compile", components); // Add dummy shader to prevent trying to compile again - m_shaders[components] = NULL; + m_shaders[components] = nullptr; return false; } @@ -217,7 +217,7 @@ bool PointGeometryShader::SetShader(u32 components, float pointSize, DEBUG_LOG(VIDEO, "Point params: size %f, texOffset %f, vpWidth %f, vpHeight %f", pointSize, texOffset, vpWidth, vpHeight); - D3D::context->GSSetShader(shaderIt->second, NULL, 0); + D3D::context->GSSetShader(shaderIt->second, nullptr, 0); D3D::context->GSSetConstantBuffers(0, 1, &m_paramsBuffer); return true; diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 23467f2406..3b987fe7f7 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -44,14 +44,14 @@ static u32 s_LastAA = 0; static Television s_television; -ID3D11Buffer* access_efb_cbuf = NULL; -ID3D11BlendState* clearblendstates[4] = {NULL}; -ID3D11DepthStencilState* cleardepthstates[3] = {NULL}; -ID3D11BlendState* resetblendstate = NULL; -ID3D11DepthStencilState* resetdepthstate = NULL; -ID3D11RasterizerState* resetraststate = NULL; +ID3D11Buffer* access_efb_cbuf = nullptr; +ID3D11BlendState* clearblendstates[4] = {nullptr}; +ID3D11DepthStencilState* cleardepthstates[3] = {nullptr}; +ID3D11BlendState* resetblendstate = nullptr; +ID3D11DepthStencilState* resetdepthstate = nullptr; +ID3D11RasterizerState* resetraststate = nullptr; -static ID3D11Texture2D* s_screenshot_texture = NULL; +static ID3D11Texture2D* s_screenshot_texture = nullptr; // GX pipeline state @@ -145,7 +145,7 @@ void SetupDeviceObjects() CHECK(hr==S_OK, "Create rasterizer state for Renderer::ResetAPIState"); D3D::SetDebugObjectName((ID3D11DeviceChild*)resetraststate, "rasterizer state for Renderer::ResetAPIState"); - s_screenshot_texture = NULL; + s_screenshot_texture = nullptr; } // Kill off all device objects @@ -172,7 +172,7 @@ void TeardownDeviceObjects() void CreateScreenshotTexture(const TargetRectangle& rc) { D3D11_TEXTURE2D_DESC scrtex_desc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R8G8B8A8_UNORM, rc.GetWidth(), rc.GetHeight(), 1, 1, 0, D3D11_USAGE_STAGING, D3D11_CPU_ACCESS_READ|D3D11_CPU_ACCESS_WRITE); - HRESULT hr = D3D::device->CreateTexture2D(&scrtex_desc, NULL, &s_screenshot_texture); + HRESULT hr = D3D::device->CreateTexture2D(&scrtex_desc, nullptr, &s_screenshot_texture); CHECK(hr==S_OK, "Create screenshot staging texture"); D3D::SetDebugObjectName((ID3D11DeviceChild*)s_screenshot_texture, "staging screenshot texture"); } @@ -385,7 +385,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, 1.f, 1.f); D3D::context->RSSetViewports(1, &vp); D3D::context->PSSetConstantBuffers(0, 1, &access_efb_cbuf); - D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBDepthReadTexture()->GetRTV(), NULL); + D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBDepthReadTexture()->GetRTV(), nullptr); D3D::SetPointCopySampler(); D3D::drawShadedTexQuad(FramebufferManager::GetEFBDepthTexture()->GetSRV(), &RectToLock, @@ -464,7 +464,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) // TODO: The first five PE registers may change behavior of EFB pokes, this isn't implemented, yet. ResetAPIState(); - D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), NULL); + D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), nullptr); D3D::drawColorQuad(rgbaColor, (float)RectToLock.left * 2.f / (float)Renderer::GetTargetWidth() - 1.f, - (float)RectToLock.top * 2.f / (float)Renderer::GetTargetHeight() + 1.f, (float)RectToLock.right * 2.f / (float)Renderer::GetTargetWidth() - 1.f, @@ -570,7 +570,7 @@ void Renderer::ReinterpretPixelData(unsigned int convtype) D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, (float)g_renderer->GetTargetWidth(), (float)g_renderer->GetTargetHeight()); D3D::context->RSSetViewports(1, &vp); - D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTempTexture()->GetRTV(), NULL); + D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTempTexture()->GetRTV(), nullptr); D3D::SetPointCopySampler(); D3D::drawShadedTexQuad(FramebufferManager::GetEFBColorTexture()->GetSRV(), &source, g_renderer->GetTargetWidth(), g_renderer->GetTargetHeight(), pixel_shader, VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout()); @@ -770,7 +770,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl if (Height > (s_backbuffer_height - Y)) Height = s_backbuffer_height - Y; D3D11_VIEWPORT vp = CD3D11_VIEWPORT((float)X, (float)Y, (float)Width, (float)Height); D3D::context->RSSetViewports(1, &vp); - D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), NULL); + D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), nullptr); float ClearColor[4] = { 0.f, 0.f, 0.f, 1.f }; D3D::context->ClearRenderTargetView(D3D::GetBackBuffer()->GetRTV(), ClearColor); @@ -999,7 +999,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl s_LastEFBScale = g_ActiveConfig.iEFBScale; CalculateTargetSize(s_backbuffer_width, s_backbuffer_height); - D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), NULL); + D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), nullptr); delete g_framebuffer_manager; g_framebuffer_manager = new FramebufferManager; @@ -1089,7 +1089,7 @@ void Renderer::ApplyState(bool bUseDstAlpha) if (FAILED(hr)) PanicAlert("Fail %s %d, stage=%d\n", __FILE__, __LINE__, stage); else D3D::SetDebugObjectName((ID3D11DeviceChild*)samplerstate[stage], "sampler state used to emulate the GX pipeline"); } - // else samplerstate[stage] = NULL; + // else samplerstate[stage] = nullptr; } D3D::context->PSSetSamplers(0, 8, samplerstate); for (unsigned int stage = 0; stage < 8; stage++) @@ -1107,13 +1107,13 @@ void Renderer::ApplyState(bool bUseDstAlpha) D3D::context->PSSetConstantBuffers(0, 1, &PixelShaderCache::GetConstantBuffer()); D3D::context->VSSetConstantBuffers(0, 1, &VertexShaderCache::GetConstantBuffer()); - D3D::context->PSSetShader(PixelShaderCache::GetActiveShader(), NULL, 0); - D3D::context->VSSetShader(VertexShaderCache::GetActiveShader(), NULL, 0); + D3D::context->PSSetShader(PixelShaderCache::GetActiveShader(), nullptr, 0); + D3D::context->VSSetShader(VertexShaderCache::GetActiveShader(), nullptr, 0); } void Renderer::RestoreState() { - ID3D11ShaderResourceView* shader_resources[8] = { NULL }; + ID3D11ShaderResourceView* shader_resources[8] = { nullptr }; D3D::context->PSSetShaderResources(0, 8, shader_resources); D3D::stateman->PopBlendState(); diff --git a/Source/Core/VideoBackends/D3D/Television.cpp b/Source/Core/VideoBackends/D3D/Television.cpp index 816fe32a3a..50516b787d 100644 --- a/Source/Core/VideoBackends/D3D/Television.cpp +++ b/Source/Core/VideoBackends/D3D/Television.cpp @@ -59,7 +59,7 @@ static const char YUYV_DECODER_PS[] = ; Television::Television() - : m_yuyvTexture(NULL), m_yuyvTextureSRV(NULL), m_pShader(NULL) + : m_yuyvTexture(nullptr), m_yuyvTextureSRV(nullptr), m_pShader(nullptr) { } void Television::Init() @@ -99,7 +99,7 @@ void Television::Init() // Create YUYV-decoding pixel shader m_pShader = D3D::CompileAndCreatePixelShader(YUYV_DECODER_PS, sizeof(YUYV_DECODER_PS)); - CHECK(m_pShader != NULL, "compile and create yuyv decoder pixel shader"); + CHECK(m_pShader != nullptr, "compile and create yuyv decoder pixel shader"); D3D::SetDebugObjectName(m_pShader, "yuyv decoder pixel shader"); // Create sampler state and set border color diff --git a/Source/Core/VideoBackends/D3D/TextureCache.cpp b/Source/Core/VideoBackends/D3D/TextureCache.cpp index 4ea188986c..608cbd67cc 100644 --- a/Source/Core/VideoBackends/D3D/TextureCache.cpp +++ b/Source/Core/VideoBackends/D3D/TextureCache.cpp @@ -18,7 +18,7 @@ namespace DX11 { -static TextureEncoder* g_encoder = NULL; +static TextureEncoder* g_encoder = nullptr; const size_t MAX_COPY_BUFFERS = 32; ID3D11Buffer* efbcopycbuf[MAX_COPY_BUFFERS] = { 0 }; @@ -43,7 +43,7 @@ bool TextureCache::TCacheEntry::Save(const std::string& filename, unsigned int l return false; } - ID3D11Texture2D* pNewTexture = NULL; + ID3D11Texture2D* pNewTexture = nullptr; ID3D11Texture2D* pSurface = texture->GetTex(); D3D11_TEXTURE2D_DESC desc; pSurface->GetDesc(&desc); @@ -52,7 +52,7 @@ bool TextureCache::TCacheEntry::Save(const std::string& filename, unsigned int l desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; desc.Usage = D3D11_USAGE_STAGING; - HRESULT hr = D3D::device->CreateTexture2D(&desc, NULL, &pNewTexture); + HRESULT hr = D3D::device->CreateTexture2D(&desc, nullptr, &pNewTexture); bool saved_png = false; @@ -85,7 +85,7 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width, { D3D11_USAGE usage = D3D11_USAGE_DEFAULT; D3D11_CPU_ACCESS_FLAG cpu_access = (D3D11_CPU_ACCESS_FLAG)0; - D3D11_SUBRESOURCE_DATA srdata, *data = NULL; + D3D11_SUBRESOURCE_DATA srdata, *data = nullptr; if (tex_levels == 1) { @@ -134,7 +134,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo D3D::context->RSSetViewports(1, &vp); // set transformation - if (NULL == efbcopycbuf[cbufid]) + if (nullptr == efbcopycbuf[cbufid]) { const D3D11_BUFFER_DESC cbdesc = CD3D11_BUFFER_DESC(28 * sizeof(float), D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DEFAULT); D3D11_SUBRESOURCE_DATA data; @@ -155,7 +155,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo else D3D::SetPointCopySampler(); - D3D::context->OMSetRenderTargets(1, &texture->GetRTV(), NULL); + D3D::context->OMSetRenderTargets(1, &texture->GetRTV(), nullptr); // Create texture copy D3D::drawShadedTexQuad( @@ -208,7 +208,7 @@ TextureCache::~TextureCache() g_encoder->Shutdown(); delete g_encoder; - g_encoder = NULL; + g_encoder = nullptr; } } diff --git a/Source/Core/VideoBackends/D3D/VertexManager.cpp b/Source/Core/VideoBackends/D3D/VertexManager.cpp index 06ade13fa2..a68f4d63e8 100644 --- a/Source/Core/VideoBackends/D3D/VertexManager.cpp +++ b/Source/Core/VideoBackends/D3D/VertexManager.cpp @@ -41,8 +41,8 @@ void VertexManager::CreateDeviceObjects() m_vertex_buffers = new PID3D11Buffer[MAX_VBUFFER_COUNT]; for (m_current_index_buffer = 0; m_current_index_buffer < MAX_VBUFFER_COUNT; m_current_index_buffer++) { - m_index_buffers[m_current_index_buffer] = NULL; - CHECK(SUCCEEDED(D3D::device->CreateBuffer(&bufdesc, NULL, &m_index_buffers[m_current_index_buffer])), + m_index_buffers[m_current_index_buffer] = nullptr; + CHECK(SUCCEEDED(D3D::device->CreateBuffer(&bufdesc, nullptr, &m_index_buffers[m_current_index_buffer])), "Failed to create index buffer."); D3D::SetDebugObjectName((ID3D11DeviceChild*)m_index_buffers[m_current_index_buffer], "index buffer of VertexManager"); } @@ -50,8 +50,8 @@ void VertexManager::CreateDeviceObjects() bufdesc.ByteWidth = VBUFFER_SIZE; for (m_current_vertex_buffer = 0; m_current_vertex_buffer < MAX_VBUFFER_COUNT; m_current_vertex_buffer++) { - m_vertex_buffers[m_current_vertex_buffer] = NULL; - CHECK(SUCCEEDED(D3D::device->CreateBuffer(&bufdesc, NULL, &m_vertex_buffers[m_current_vertex_buffer])), + m_vertex_buffers[m_current_vertex_buffer] = nullptr; + CHECK(SUCCEEDED(D3D::device->CreateBuffer(&bufdesc, nullptr, &m_vertex_buffers[m_current_vertex_buffer])), "Failed to create vertex buffer."); D3D::SetDebugObjectName((ID3D11DeviceChild*)m_vertex_buffers[m_current_vertex_buffer], "Vertex buffer of VertexManager"); } @@ -167,7 +167,7 @@ void VertexManager::Draw(UINT stride) D3D::context->DrawIndexed(IndexGenerator::GetIndexLen(), m_index_draw_offset, 0); INCSTAT(stats.thisFrame.numIndexedDrawCalls); - D3D::context->GSSetShader(NULL, NULL, 0); + D3D::context->GSSetShader(nullptr, nullptr, 0); ((DX11::Renderer*)g_renderer)->RestoreCull(); } } @@ -191,7 +191,7 @@ void VertexManager::Draw(UINT stride) D3D::context->DrawIndexed(IndexGenerator::GetIndexLen(), m_index_draw_offset, 0); INCSTAT(stats.thisFrame.numIndexedDrawCalls); - D3D::context->GSSetShader(NULL, NULL, 0); + D3D::context->GSSetShader(nullptr, nullptr, 0); ((DX11::Renderer*)g_renderer)->RestoreCull(); } } diff --git a/Source/Core/VideoBackends/D3D/VertexShaderCache.cpp b/Source/Core/VideoBackends/D3D/VertexShaderCache.cpp index 7d35d84a36..d51ce98b30 100644 --- a/Source/Core/VideoBackends/D3D/VertexShaderCache.cpp +++ b/Source/Core/VideoBackends/D3D/VertexShaderCache.cpp @@ -23,10 +23,10 @@ const VertexShaderCache::VSCacheEntry *VertexShaderCache::last_entry; VertexShaderUid VertexShaderCache::last_uid; UidChecker VertexShaderCache::vertex_uid_checker; -static ID3D11VertexShader* SimpleVertexShader = NULL; -static ID3D11VertexShader* ClearVertexShader = NULL; -static ID3D11InputLayout* SimpleLayout = NULL; -static ID3D11InputLayout* ClearLayout = NULL; +static ID3D11VertexShader* SimpleVertexShader = nullptr; +static ID3D11VertexShader* ClearVertexShader = nullptr; +static ID3D11InputLayout* SimpleLayout = nullptr; +static ID3D11InputLayout* ClearLayout = nullptr; LinearDiskCache g_vs_disk_cache; @@ -35,7 +35,7 @@ ID3D11VertexShader* VertexShaderCache::GetClearVertexShader() { return ClearVert ID3D11InputLayout* VertexShaderCache::GetSimpleInputLayout() { return SimpleLayout; } ID3D11InputLayout* VertexShaderCache::GetClearInputLayout() { return ClearLayout; } -ID3D11Buffer* vscbuf = NULL; +ID3D11Buffer* vscbuf = nullptr; ID3D11Buffer* &VertexShaderCache::GetConstantBuffer() { @@ -114,7 +114,7 @@ void VertexShaderCache::Init() unsigned int cbsize = ((sizeof(VertexShaderConstants))&(~0xf))+0x10; // must be a multiple of 16 D3D11_BUFFER_DESC cbdesc = CD3D11_BUFFER_DESC(cbsize, D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE); - HRESULT hr = D3D::device->CreateBuffer(&cbdesc, NULL, &vscbuf); + HRESULT hr = D3D::device->CreateBuffer(&cbdesc, nullptr, &vscbuf); CHECK(hr==S_OK, "Create vertex shader constant buffer (size=%u)", cbsize); D3D::SetDebugObjectName((ID3D11DeviceChild*)vscbuf, "vertex shader constant buffer used to emulate the GX pipeline"); @@ -122,7 +122,7 @@ void VertexShaderCache::Init() D3D::CompileVertexShader(simple_shader_code, sizeof(simple_shader_code), &blob); D3D::device->CreateInputLayout(simpleelems, 2, blob->Data(), blob->Size(), &SimpleLayout); SimpleVertexShader = D3D::CreateVertexShaderFromByteCode(blob); - if (SimpleLayout == NULL || SimpleVertexShader == NULL) PanicAlert("Failed to create simple vertex shader or input layout at %s %d\n", __FILE__, __LINE__); + if (SimpleLayout == nullptr || SimpleVertexShader == nullptr) PanicAlert("Failed to create simple vertex shader or input layout at %s %d\n", __FILE__, __LINE__); blob->Release(); D3D::SetDebugObjectName((ID3D11DeviceChild*)SimpleVertexShader, "simple vertex shader"); D3D::SetDebugObjectName((ID3D11DeviceChild*)SimpleLayout, "simple input layout"); @@ -130,7 +130,7 @@ void VertexShaderCache::Init() D3D::CompileVertexShader(clear_shader_code, sizeof(clear_shader_code), &blob); D3D::device->CreateInputLayout(clearelems, 2, blob->Data(), blob->Size(), &ClearLayout); ClearVertexShader = D3D::CreateVertexShaderFromByteCode(blob); - if (ClearLayout == NULL || ClearVertexShader == NULL) PanicAlert("Failed to create clear vertex shader or input layout at %s %d\n", __FILE__, __LINE__); + if (ClearLayout == nullptr || ClearVertexShader == nullptr) PanicAlert("Failed to create clear vertex shader or input layout at %s %d\n", __FILE__, __LINE__); blob->Release(); D3D::SetDebugObjectName((ID3D11DeviceChild*)ClearVertexShader, "clear vertex shader"); D3D::SetDebugObjectName((ID3D11DeviceChild*)ClearLayout, "clear input layout"); @@ -152,7 +152,7 @@ void VertexShaderCache::Init() if (g_Config.bEnableShaderDebugging) Clear(); - last_entry = NULL; + last_entry = nullptr; } void VertexShaderCache::Clear() @@ -162,7 +162,7 @@ void VertexShaderCache::Clear() vshaders.clear(); vertex_uid_checker.Invalidate(); - last_entry = NULL; + last_entry = nullptr; } void VertexShaderCache::Shutdown() @@ -196,7 +196,7 @@ bool VertexShaderCache::SetShader(u32 components) if (uid == last_uid) { GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true); - return (last_entry->shader != NULL); + return (last_entry->shader != nullptr); } } @@ -209,16 +209,16 @@ bool VertexShaderCache::SetShader(u32 components) last_entry = &entry; GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true); - return (entry.shader != NULL); + return (entry.shader != nullptr); } VertexShaderCode code; GenerateVertexShaderCode(code, components, API_D3D); - D3DBlob* pbytecode = NULL; + D3DBlob* pbytecode = nullptr; D3D::CompileVertexShader(code.GetBuffer(), (int)strlen(code.GetBuffer()), &pbytecode); - if (pbytecode == NULL) + if (pbytecode == nullptr) { GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true); return false; @@ -240,7 +240,7 @@ bool VertexShaderCache::SetShader(u32 components) bool VertexShaderCache::InsertByteCode(const VertexShaderUid &uid, D3DBlob* bcodeblob) { ID3D11VertexShader* shader = D3D::CreateVertexShaderFromByteCode(bcodeblob); - if (shader == NULL) + if (shader == nullptr) return false; // TODO: Somehow make the debug name a bit more specific diff --git a/Source/Core/VideoBackends/D3D/VertexShaderCache.h b/Source/Core/VideoBackends/D3D/VertexShaderCache.h index 0c9c739f6b..2597963e55 100644 --- a/Source/Core/VideoBackends/D3D/VertexShaderCache.h +++ b/Source/Core/VideoBackends/D3D/VertexShaderCache.h @@ -40,7 +40,7 @@ private: std::string code; - VSCacheEntry() : shader(NULL), bytecode(NULL) {} + VSCacheEntry() : shader(nullptr), bytecode(nullptr) {} void SetByteCode(D3DBlob* blob) { SAFE_RELEASE(bytecode); diff --git a/Source/Core/VideoBackends/D3D/XFBEncoder.cpp b/Source/Core/VideoBackends/D3D/XFBEncoder.cpp index 25d69aed12..d32d76f88e 100644 --- a/Source/Core/VideoBackends/D3D/XFBEncoder.cpp +++ b/Source/Core/VideoBackends/D3D/XFBEncoder.cpp @@ -130,10 +130,10 @@ static const struct QuadVertex } QUAD_VERTS[4] = { { 0, 0 }, { 1, 0 }, { 0, 1 }, { 1, 1 } }; XFBEncoder::XFBEncoder() - : m_out(NULL), m_outRTV(NULL), m_outStage(NULL), m_encodeParams(NULL), - m_quad(NULL), m_vShader(NULL), m_quadLayout(NULL), m_pShader(NULL), - m_xfbEncodeBlendState(NULL), m_xfbEncodeDepthState(NULL), - m_xfbEncodeRastState(NULL), m_efbSampler(NULL) + : m_out(nullptr), m_outRTV(nullptr), m_outStage(nullptr), m_encodeParams(nullptr), + m_quad(nullptr), m_vShader(nullptr), m_quadLayout(nullptr), m_pShader(nullptr), + m_xfbEncodeBlendState(nullptr), m_xfbEncodeDepthState(nullptr), + m_xfbEncodeRastState(nullptr), m_efbSampler(nullptr) { } void XFBEncoder::Init() @@ -147,7 +147,7 @@ void XFBEncoder::Init() D3D11_TEXTURE2D_DESC t2dd = CD3D11_TEXTURE2D_DESC( DXGI_FORMAT_R8G8B8A8_UNORM, MAX_XFB_WIDTH/2, MAX_XFB_HEIGHT, 1, 1, D3D11_BIND_RENDER_TARGET); - hr = D3D::device->CreateTexture2D(&t2dd, NULL, &m_out); + hr = D3D::device->CreateTexture2D(&t2dd, nullptr, &m_out); CHECK(SUCCEEDED(hr), "create xfb encoder output texture"); D3D::SetDebugObjectName(m_out, "xfb encoder output texture"); @@ -164,7 +164,7 @@ void XFBEncoder::Init() t2dd.Usage = D3D11_USAGE_STAGING; t2dd.BindFlags = 0; t2dd.CPUAccessFlags = D3D11_CPU_ACCESS_READ; - hr = D3D::device->CreateTexture2D(&t2dd, NULL, &m_outStage); + hr = D3D::device->CreateTexture2D(&t2dd, nullptr, &m_outStage); CHECK(SUCCEEDED(hr), "create xfb encoder output staging buffer"); D3D::SetDebugObjectName(m_outStage, "xfb encoder output staging buffer"); @@ -172,7 +172,7 @@ void XFBEncoder::Init() D3D11_BUFFER_DESC bd = CD3D11_BUFFER_DESC(sizeof(XFBEncodeParams), D3D11_BIND_CONSTANT_BUFFER); - hr = D3D::device->CreateBuffer(&bd, NULL, &m_encodeParams); + hr = D3D::device->CreateBuffer(&bd, nullptr, &m_encodeParams); CHECK(SUCCEEDED(hr), "create xfb encode params buffer"); D3D::SetDebugObjectName(m_encodeParams, "xfb encoder params buffer"); @@ -188,14 +188,14 @@ void XFBEncoder::Init() // Create vertex shader - D3DBlob* bytecode = NULL; + D3DBlob* bytecode = nullptr; if (!D3D::CompileVertexShader(XFB_ENCODE_VS, sizeof(XFB_ENCODE_VS), &bytecode)) { ERROR_LOG(VIDEO, "XFB encode vertex shader failed to compile"); return; } - hr = D3D::device->CreateVertexShader(bytecode->Data(), bytecode->Size(), NULL, &m_vShader); + hr = D3D::device->CreateVertexShader(bytecode->Data(), bytecode->Size(), nullptr, &m_vShader); CHECK(SUCCEEDED(hr), "create xfb encode vertex shader"); D3D::SetDebugObjectName(m_vShader, "xfb encoder vertex shader"); @@ -279,8 +279,8 @@ void XFBEncoder::Encode(u8* dst, u32 width, u32 height, const EFBRectangle& srcR // Set up all the state for XFB encoding - D3D::context->PSSetShader(m_pShader, NULL, 0); - D3D::context->VSSetShader(m_vShader, NULL, 0); + D3D::context->PSSetShader(m_pShader, nullptr, 0); + D3D::context->VSSetShader(m_vShader, nullptr, 0); D3D::stateman->PushBlendState(m_xfbEncodeBlendState); D3D::stateman->PushDepthState(m_xfbEncodeDepthState); @@ -306,11 +306,11 @@ void XFBEncoder::Encode(u8* dst, u32 width, u32 height, const EFBRectangle& srcR params.TexRight = FLOAT(targetRect.right) / g_renderer->GetTargetWidth(); params.TexBottom = FLOAT(targetRect.bottom) / g_renderer->GetTargetHeight(); params.Gamma = gamma; - D3D::context->UpdateSubresource(m_encodeParams, 0, NULL, ¶ms, 0, 0); + D3D::context->UpdateSubresource(m_encodeParams, 0, nullptr, ¶ms, 0, 0); D3D::context->VSSetConstantBuffers(0, 1, &m_encodeParams); - D3D::context->OMSetRenderTargets(1, &m_outRTV, NULL); + D3D::context->OMSetRenderTargets(1, &m_outRTV, nullptr); ID3D11ShaderResourceView* pEFB = FramebufferManager::GetEFBColorTexture()->GetSRV(); @@ -329,13 +329,13 @@ void XFBEncoder::Encode(u8* dst, u32 width, u32 height, const EFBRectangle& srcR // Clean up state - IUnknown* nullDummy = NULL; + IUnknown* nullDummy = nullptr; D3D::context->PSSetSamplers(0, 1, (ID3D11SamplerState**)&nullDummy); D3D::context->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&nullDummy); D3D::context->PSSetConstantBuffers(0, 1, (ID3D11Buffer**)&nullDummy); - D3D::context->OMSetRenderTargets(0, NULL, NULL); + D3D::context->OMSetRenderTargets(0, nullptr, nullptr); D3D::context->VSSetConstantBuffers(0, 1, (ID3D11Buffer**)&nullDummy); @@ -343,8 +343,8 @@ void XFBEncoder::Encode(u8* dst, u32 width, u32 height, const EFBRectangle& srcR D3D::stateman->PopDepthState(); D3D::stateman->PopBlendState(); - D3D::context->PSSetShader(NULL, NULL, 0); - D3D::context->VSSetShader(NULL, NULL, 0); + D3D::context->PSSetShader(nullptr, nullptr, 0); + D3D::context->VSSetShader(nullptr, nullptr, 0); // Transfer staging buffer to GameCube/Wii RAM diff --git a/Source/Core/VideoBackends/D3D/main.cpp b/Source/Core/VideoBackends/D3D/main.cpp index 77ed8e9899..ae509cbfde 100644 --- a/Source/Core/VideoBackends/D3D/main.cpp +++ b/Source/Core/VideoBackends/D3D/main.cpp @@ -161,7 +161,7 @@ bool VideoBackend::Initialize(void *&window_handle) UpdateActiveConfig(); window_handle = (void*)EmuWindow::Create((HWND)window_handle, GetModuleHandle(0), _T("Loading - Please wait.")); - if (window_handle == NULL) + if (window_handle == nullptr) { ERROR_LOG(VIDEO, "An error has occurred while trying to create the window."); return false; @@ -230,8 +230,8 @@ void VideoBackend::Shutdown() delete g_vertex_manager; delete g_texture_cache; delete g_renderer; - g_renderer = NULL; - g_texture_cache = NULL; + g_renderer = nullptr; + g_texture_cache = nullptr; } } diff --git a/Source/Core/VideoBackends/OGL/FramebufferManager.cpp b/Source/Core/VideoBackends/OGL/FramebufferManager.cpp index 3fca224bb8..a9ccedf46d 100644 --- a/Source/Core/VideoBackends/OGL/FramebufferManager.cpp +++ b/Source/Core/VideoBackends/OGL/FramebufferManager.cpp @@ -81,19 +81,19 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glBindTexture(GL_TEXTURE_2D, m_efbDepth); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, m_targetWidth, m_targetHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, m_targetWidth, m_targetHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, nullptr); glBindTexture(GL_TEXTURE_2D, m_resolvedColorTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); // Bind target textures to the EFB framebuffer. @@ -152,13 +152,13 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glBindTexture(GL_TEXTURE_2D, m_resolvedDepthTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, m_targetWidth, m_targetHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, m_targetWidth, m_targetHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, nullptr); // Bind resolved textures to resolved framebuffer. @@ -446,7 +446,7 @@ XFBSourceBase* FramebufferManager::CreateXFBSource(unsigned int target_width, un glActiveTexture(GL_TEXTURE0 + 9); glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, target_width, target_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, target_width, target_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); return new XFBSource(texture); } diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp b/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp index 3e690cc8d0..99f5004bda 100644 --- a/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp +++ b/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp @@ -1739,15 +1739,15 @@ namespace GLExtensions void* GetFuncAddress(std::string name, void **func) { *func = GLInterface->GetFuncAddress(name); - if (*func == NULL) + if (*func == nullptr) { #if defined(__linux__) || defined(__APPLE__) // Give it a second try with dlsym *func = dlsym(RTLD_NEXT, name.c_str()); #endif - if (*func == NULL && _isES) + if (*func == nullptr && _isES) *func = (void*)0xFFFFFFFF; // Easy to determine invalid function, just so we continue on - if (*func == NULL) + if (*func == nullptr) ERROR_LOG(VIDEO, "Couldn't load function %s", name.c_str()); } return *func; @@ -1769,13 +1769,13 @@ namespace GLExtensions // We need them to grab the extension list // Also to check if there is an error grabbing the version // If it fails then the user's drivers don't support GL 3.0 - if (GetFuncAddress ("glGetIntegerv", (void**)&glGetIntegerv) == NULL) + if (GetFuncAddress ("glGetIntegerv", (void**)&glGetIntegerv) == nullptr) return false; - if (GetFuncAddress("glGetString", (void**)&glGetString) == NULL) + if (GetFuncAddress("glGetString", (void**)&glGetString) == nullptr) return false; - if (GetFuncAddress("glGetStringi", (void**)&glGetStringi) == NULL) + if (GetFuncAddress("glGetStringi", (void**)&glGetStringi) == nullptr) return false; - if (GetFuncAddress("glGetError", (void**)&glGetError) == NULL) + if (GetFuncAddress("glGetError", (void**)&glGetError) == nullptr) return false; InitVersion(); diff --git a/Source/Core/VideoBackends/OGL/GLUtil.cpp b/Source/Core/VideoBackends/OGL/GLUtil.cpp index abe2505e74..1e43f2a137 100644 --- a/Source/Core/VideoBackends/OGL/GLUtil.cpp +++ b/Source/Core/VideoBackends/OGL/GLUtil.cpp @@ -56,7 +56,7 @@ GLuint OpenGL_CompileProgram ( const char* vertexShader, const char* fragmentSha GLuint programID = glCreateProgram(); // compile vertex shader - glShaderSource(vertexShaderID, 1, &vertexShader, NULL); + glShaderSource(vertexShaderID, 1, &vertexShader, nullptr); glCompileShader(vertexShaderID); #if defined(_DEBUG) || defined(DEBUGFAST) || defined(DEBUG_GLSL) GLint Result = GL_FALSE; @@ -75,7 +75,7 @@ GLuint OpenGL_CompileProgram ( const char* vertexShader, const char* fragmentSha #endif // compile fragment shader - glShaderSource(fragmentShaderID, 1, &fragmentShader, NULL); + glShaderSource(fragmentShaderID, 1, &fragmentShader, nullptr); glCompileShader(fragmentShaderID); #if defined(_DEBUG) || defined(DEBUGFAST) || defined(DEBUG_GLSL) glGetShaderiv(fragmentShaderID, GL_COMPILE_STATUS, &Result); diff --git a/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp b/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp index dad409e47a..dd1ffc2dfd 100644 --- a/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp +++ b/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp @@ -50,9 +50,9 @@ static void SetPointer(u32 attrib, u32 stride, const AttributeFormat &format) glEnableVertexAttribArray(attrib); if (format.integer) - glVertexAttribIPointer(attrib, format.components, VarToGL(format.type), stride, (u8*)NULL + format.offset); + glVertexAttribIPointer(attrib, format.components, VarToGL(format.type), stride, (u8*)nullptr + format.offset); else - glVertexAttribPointer(attrib, format.components, VarToGL(format.type), true, stride, (u8*)NULL + format.offset); + glVertexAttribPointer(attrib, format.components, VarToGL(format.type), true, stride, (u8*)nullptr + format.offset); } void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl) diff --git a/Source/Core/VideoBackends/OGL/PostProcessing.cpp b/Source/Core/VideoBackends/OGL/PostProcessing.cpp index 211cf5d937..929fcd0de8 100644 --- a/Source/Core/VideoBackends/OGL/PostProcessing.cpp +++ b/Source/Core/VideoBackends/OGL/PostProcessing.cpp @@ -51,7 +51,7 @@ void Init() glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); // disable mipmaps glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glBindFramebuffer(GL_FRAMEBUFFER, s_fbo); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, s_texture, 0); FramebufferManager::SetFramebuffer(0); @@ -108,7 +108,7 @@ void Update ( u32 width, u32 height ) // alloc texture for framebuffer glActiveTexture(GL_TEXTURE0+9); glBindTexture(GL_TEXTURE_2D, s_texture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); } } diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp index 68c1e44399..c4e150d7d0 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp @@ -194,7 +194,7 @@ SHADER* ProgramShaderCache::SetShader ( DSTALPHA_MODE dstAlphaMode, u32 componen if (!CompileShader(newentry.shader, vcode.GetBuffer(), pcode.GetBuffer())) { GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true); - return NULL; + return nullptr; } INCSTAT(stats.numPixelShadersCreated); @@ -281,7 +281,7 @@ GLuint ProgramShaderCache::CompileSingleShader (GLuint type, const char* code ) const char *src[] = {s_glsl_header, code}; - glShaderSource(result, 2, src, NULL); + glShaderSource(result, 2, src, nullptr); glCompileShader(result); GLint compileStatus; glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus); @@ -396,7 +396,7 @@ void ProgramShaderCache::Init(void) CreateHeader(); CurrentProgram = 0; - last_entry = NULL; + last_entry = nullptr; } void ProgramShaderCache::Shutdown(void) @@ -421,7 +421,7 @@ void ProgramShaderCache::Shutdown(void) u8 *data = new u8[binary_size+sizeof(GLenum)]; u8 *binary = data + sizeof(GLenum); GLenum *prog_format = (GLenum*)data; - glGetProgramBinary(entry.second.shader.glprogid, binary_size, NULL, prog_format, binary); + glGetProgramBinary(entry.second.shader.glprogid, binary_size, nullptr, prog_format, binary); g_program_disk_cache.Append(entry.first, data, binary_size+sizeof(GLenum)); delete [] data; @@ -443,7 +443,7 @@ void ProgramShaderCache::Shutdown(void) vertex_uid_checker.Invalidate(); delete s_buffer; - s_buffer = 0; + s_buffer = nullptr; } void ProgramShaderCache::CreateHeader ( void ) diff --git a/Source/Core/VideoBackends/OGL/RasterFont.cpp b/Source/Core/VideoBackends/OGL/RasterFont.cpp index 1f2eefdb8b..1b7845887b 100644 --- a/Source/Core/VideoBackends/OGL/RasterFont.cpp +++ b/Source/Core/VideoBackends/OGL/RasterFont.cpp @@ -168,9 +168,9 @@ RasterFont::RasterFont() glBindBuffer(GL_ARRAY_BUFFER, VBO); glBindVertexArray(VAO); glEnableVertexAttribArray(SHADER_POSITION_ATTRIB); - glVertexAttribPointer(SHADER_POSITION_ATTRIB, 2, GL_FLOAT, 0, sizeof(GLfloat)*4, NULL); + glVertexAttribPointer(SHADER_POSITION_ATTRIB, 2, GL_FLOAT, 0, sizeof(GLfloat)*4, nullptr); glEnableVertexAttribArray(SHADER_TEXTURE0_ATTRIB); - glVertexAttribPointer(SHADER_TEXTURE0_ATTRIB, 2, GL_FLOAT, 0, sizeof(GLfloat)*4, (GLfloat*)NULL+2); + glVertexAttribPointer(SHADER_TEXTURE0_ATTRIB, 2, GL_FLOAT, 0, sizeof(GLfloat)*4, (GLfloat*)nullptr+2); } RasterFont::~RasterFont() diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index b4530a0bdb..3116961f5d 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -95,7 +95,7 @@ static GLuint s_ShowEFBCopyRegions_VBO = 0; static GLuint s_ShowEFBCopyRegions_VAO = 0; static SHADER s_ShowEFBCopyRegions; -static RasterFont* s_pfont = NULL; +static RasterFont* s_pfont = nullptr; // 1 for no MSAA. Use s_MSAASamples > 1 to check for MSAA. static int s_MSAASamples = 1; @@ -499,14 +499,14 @@ Renderer::Renderer() #if defined(_DEBUG) || defined(DEBUGFAST) if (GLExtensions::Supports("GL_KHR_debug")) { - glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, true); - glDebugMessageCallback( ErrorCallback, NULL ); + glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, true); + glDebugMessageCallback( ErrorCallback, nullptr ); glEnable( GL_DEBUG_OUTPUT ); } else if (GLExtensions::Supports("GL_ARB_debug_output")) { - glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, true); - glDebugMessageCallbackARB( ErrorCallback, NULL ); + glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, true); + glDebugMessageCallbackARB( ErrorCallback, nullptr ); glEnable( GL_DEBUG_OUTPUT ); } #endif @@ -639,7 +639,7 @@ void Renderer::Shutdown() s_ShowEFBCopyRegions_VBO = 0; delete s_pfont; - s_pfont = 0; + s_pfont = nullptr; s_ShowEFBCopyRegions.Destroy(); } @@ -671,9 +671,9 @@ void Renderer::Init() glBindBuffer(GL_ARRAY_BUFFER, s_ShowEFBCopyRegions_VBO); glBindVertexArray( s_ShowEFBCopyRegions_VAO ); glEnableVertexAttribArray(SHADER_POSITION_ATTRIB); - glVertexAttribPointer(SHADER_POSITION_ATTRIB, 2, GL_FLOAT, 0, sizeof(GLfloat)*5, NULL); + glVertexAttribPointer(SHADER_POSITION_ATTRIB, 2, GL_FLOAT, 0, sizeof(GLfloat)*5, nullptr); glEnableVertexAttribArray(SHADER_COLOR0_ATTRIB); - glVertexAttribPointer(SHADER_COLOR0_ATTRIB, 3, GL_FLOAT, 0, sizeof(GLfloat)*5, (GLfloat*)NULL+2); + glVertexAttribPointer(SHADER_COLOR0_ATTRIB, 3, GL_FLOAT, 0, sizeof(GLfloat)*5, (GLfloat*)nullptr+2); } // Create On-Screen-Messages @@ -703,7 +703,7 @@ void Renderer::DrawDebugInfo() // 2*Coords + 3*Color u32 length = stats.efb_regions.size() * sizeof(GLfloat) * (2+3)*2*6; glBindBuffer(GL_ARRAY_BUFFER, s_ShowEFBCopyRegions_VBO); - glBufferData(GL_ARRAY_BUFFER, length, NULL, GL_STREAM_DRAW); + glBufferData(GL_ARRAY_BUFFER, length, nullptr, GL_STREAM_DRAW); GLfloat *Vertices = (GLfloat*)glMapBufferRange(GL_ARRAY_BUFFER, 0, length, GL_MAP_WRITE_BIT); // Draw EFB copy regions rectangles @@ -1315,7 +1315,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl // Copy the framebuffer to screen. - const XFBSourceBase* xfbSource = NULL; + const XFBSourceBase* xfbSource = nullptr; if(g_ActiveConfig.bUseXFB) { diff --git a/Source/Core/VideoBackends/OGL/StreamBuffer.cpp b/Source/Core/VideoBackends/OGL/StreamBuffer.cpp index 2de5490eaa..be7f4eeacd 100644 --- a/Source/Core/VideoBackends/OGL/StreamBuffer.cpp +++ b/Source/Core/VideoBackends/OGL/StreamBuffer.cpp @@ -141,7 +141,7 @@ class MapAndOrphan : public StreamBuffer public: MapAndOrphan(u32 type, size_t size) : StreamBuffer(type, size) { glBindBuffer(m_buffertype, m_buffer); - glBufferData(m_buffertype, m_size, NULL, GL_STREAM_DRAW); + glBufferData(m_buffertype, m_size, nullptr, GL_STREAM_DRAW); } ~MapAndOrphan() { @@ -150,7 +150,7 @@ public: std::pair Map(size_t size, u32 stride) override { Align(stride); if(m_iterator + size >= m_size) { - glBufferData(m_buffertype, m_size, NULL, GL_STREAM_DRAW); + glBufferData(m_buffertype, m_size, nullptr, GL_STREAM_DRAW); m_iterator = 0; } u8* pointer = (u8*)glMapBufferRange(m_buffertype, m_iterator, size, @@ -178,7 +178,7 @@ public: MapAndSync(u32 type, size_t size) : StreamBuffer(type, size) { CreateFences(); glBindBuffer(m_buffertype, m_buffer); - glBufferData(m_buffertype, m_size, NULL, GL_STREAM_DRAW); + glBufferData(m_buffertype, m_size, nullptr, GL_STREAM_DRAW); } ~MapAndSync() { @@ -223,7 +223,7 @@ public: // PERSISTANT_BIT to make sure that the buffer can be used while mapped // COHERENT_BIT is set so we don't have to use a MemoryBarrier on write // CLIENT_STORAGE_BIT is set since we access the buffer more frequently on the client side then server side - glBufferStorage(m_buffertype, m_size, NULL, + glBufferStorage(m_buffertype, m_size, nullptr, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT | GL_CLIENT_STORAGE_BIT); m_pointer = (u8*)glMapBufferRange(m_buffertype, 0, m_size, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT); @@ -272,7 +272,7 @@ public: glBindBuffer(m_buffertype, 0); glFinish(); // ogl pipeline must be flushed, else this buffer can be in use FreeAlignedMemory(m_pointer); - m_pointer = NULL; + m_pointer = nullptr; } std::pair Map(size_t size, u32 stride) override { @@ -299,7 +299,7 @@ class BufferSubData : public StreamBuffer public: BufferSubData(u32 type, size_t size) : StreamBuffer(type, size) { glBindBuffer(m_buffertype, m_buffer); - glBufferData(m_buffertype, size, 0, GL_STATIC_DRAW); + glBufferData(m_buffertype, size, nullptr, GL_STATIC_DRAW); m_pointer = new u8[m_size]; } diff --git a/Source/Core/VideoBackends/OGL/TextureCache.cpp b/Source/Core/VideoBackends/OGL/TextureCache.cpp index cf17125f97..9262f9f4d1 100644 --- a/Source/Core/VideoBackends/OGL/TextureCache.cpp +++ b/Source/Core/VideoBackends/OGL/TextureCache.cpp @@ -242,7 +242,7 @@ TextureCache::TCacheEntryBase* TextureCache::CreateRenderTargetTexture( glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); - glTexImage2D(GL_TEXTURE_2D, 0, gl_iformat, scaled_tex_w, scaled_tex_h, 0, gl_format, gl_type, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, gl_iformat, scaled_tex_w, scaled_tex_h, 0, gl_format, gl_type, nullptr); glBindTexture(GL_TEXTURE_2D, 0); glGenFramebuffers(1, &entry->framebuffer); diff --git a/Source/Core/VideoBackends/OGL/TextureConverter.cpp b/Source/Core/VideoBackends/OGL/TextureConverter.cpp index 514dbd22f6..32225652f6 100644 --- a/Source/Core/VideoBackends/OGL/TextureConverter.cpp +++ b/Source/Core/VideoBackends/OGL/TextureConverter.cpp @@ -179,7 +179,7 @@ void Init() glGenTextures(1, &s_dstTexture); glBindTexture(GL_TEXTURE_2D, s_dstTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, renderBufferWidth, renderBufferHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, renderBufferWidth, renderBufferHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); FramebufferManager::SetFramebuffer(s_texConvFrameBuffer[0]); @@ -261,8 +261,8 @@ void EncodeToRamUsingShader(GLuint srcTexture, const TargetRectangle& sourceRc, // in this way, we only have one vram->ram transfer, but maybe a bigger // cpu overhead because of the pbo glBindBuffer(GL_PIXEL_PACK_BUFFER, s_PBO); - glBufferData(GL_PIXEL_PACK_BUFFER, dstSize, NULL, GL_STREAM_READ); - glReadPixels(0, 0, (GLsizei)dstWidth, (GLsizei)dstHeight, GL_BGRA, GL_UNSIGNED_BYTE, 0); + glBufferData(GL_PIXEL_PACK_BUFFER, dstSize, nullptr, GL_STREAM_READ); + glReadPixels(0, 0, (GLsizei)dstWidth, (GLsizei)dstHeight, GL_BGRA, GL_UNSIGNED_BYTE, nullptr); u8* pbo = (u8*)glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, dstSize, GL_MAP_READ_BIT); for (int i = 0; i < readLoops; i++) diff --git a/Source/Core/VideoBackends/OGL/VertexManager.cpp b/Source/Core/VideoBackends/OGL/VertexManager.cpp index 4af1a48953..89dfda38e2 100644 --- a/Source/Core/VideoBackends/OGL/VertexManager.cpp +++ b/Source/Core/VideoBackends/OGL/VertexManager.cpp @@ -60,7 +60,7 @@ void VertexManager::CreateDeviceObjects() s_indexBuffer = StreamBuffer::Create(GL_ELEMENT_ARRAY_BUFFER, MAX_IBUFFER_SIZE); m_index_buffers = s_indexBuffer->m_buffer; - m_CurrentVertexFmt = NULL; + m_CurrentVertexFmt = nullptr; m_last_vao = 0; } @@ -120,9 +120,9 @@ void VertexManager::Draw(u32 stride) } if(g_ogl_config.bSupportsGLBaseVertex) { - glDrawRangeElementsBaseVertex(primitive_mode, 0, max_index, index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_index_offset, (GLint)s_baseVertex); + glDrawRangeElementsBaseVertex(primitive_mode, 0, max_index, index_size, GL_UNSIGNED_SHORT, (u8*)nullptr+s_index_offset, (GLint)s_baseVertex); } else { - glDrawRangeElements(primitive_mode, 0, max_index, index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_index_offset); + glDrawRangeElements(primitive_mode, 0, max_index, index_size, GL_UNSIGNED_SHORT, (u8*)nullptr+s_index_offset); } INCSTAT(stats.thisFrame.numIndexedDrawCalls); } diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp index b37f428531..d902485bb8 100644 --- a/Source/Core/VideoBackends/OGL/main.cpp +++ b/Source/Core/VideoBackends/OGL/main.cpp @@ -256,20 +256,20 @@ void VideoBackend::Video_Cleanup() { TextureConverter::Shutdown(); VertexLoaderManager::Shutdown(); delete g_sampler_cache; - g_sampler_cache = NULL; + g_sampler_cache = nullptr; delete g_texture_cache; - g_texture_cache = NULL; + g_texture_cache = nullptr; PostProcessing::Shutdown(); ProgramShaderCache::Shutdown(); VertexShaderManager::Shutdown(); PixelShaderManager::Shutdown(); delete g_perf_query; - g_perf_query = NULL; + g_perf_query = nullptr; delete g_vertex_manager; - g_vertex_manager = NULL; + g_vertex_manager = nullptr; OpcodeDecoder_Shutdown(); delete g_renderer; - g_renderer = NULL; + g_renderer = nullptr; GLInterface->ClearCurrent(); } } diff --git a/Source/Core/VideoBackends/Software/BPMemLoader.cpp b/Source/Core/VideoBackends/Software/BPMemLoader.cpp index 738b909fc0..7672e233ac 100644 --- a/Source/Core/VideoBackends/Software/BPMemLoader.cpp +++ b/Source/Core/VideoBackends/Software/BPMemLoader.cpp @@ -100,7 +100,7 @@ void SWBPWritten(int address, int newvalue) u32 tlutTMemAddr = (newvalue & 0x3FF) << 9; u32 tlutXferCount = (newvalue & 0x1FFC00) >> 5; - u8 *ptr = 0; + u8 *ptr = nullptr; // TODO - figure out a cleaner way. if (Core::g_CoreStartupParameter.bWii) diff --git a/Source/Core/VideoBackends/Software/DebugUtil.cpp b/Source/Core/VideoBackends/Software/DebugUtil.cpp index 6b5b1f7c7d..e6995b5068 100644 --- a/Source/Core/VideoBackends/Software/DebugUtil.cpp +++ b/Source/Core/VideoBackends/Software/DebugUtil.cpp @@ -39,7 +39,7 @@ void Init() { memset(ObjectBuffer[i], 0, sizeof(ObjectBuffer[i])); DrawnToBuffer[i] = false; - ObjectBufferName[i] = 0; + ObjectBufferName[i] = nullptr; BufferBase[i] = 0; } } diff --git a/Source/Core/VideoBackends/Software/OpcodeDecoder.cpp b/Source/Core/VideoBackends/Software/OpcodeDecoder.cpp index 069876741d..ff2b4f0bb8 100644 --- a/Source/Core/VideoBackends/Software/OpcodeDecoder.cpp +++ b/Source/Core/VideoBackends/Software/OpcodeDecoder.cpp @@ -19,7 +19,7 @@ typedef void (*DecodingFunction)(u32); namespace OpcodeDecoder { -static DecodingFunction currentFunction = NULL; +static DecodingFunction currentFunction = nullptr; static u32 minCommandSize; static u16 streamSize; static u16 streamAddress; diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index d8288adc1a..8329024e3a 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -101,7 +101,7 @@ void Init() interruptSet = false; interruptWaiting = false; - g_pVideoData = 0; + g_pVideoData = nullptr; g_bSkipCurrentFrame = false; } diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp index c56390ba90..deb934ee2f 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.cpp +++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp @@ -28,7 +28,7 @@ static std::string s_sScreenshotName; // Rasterfont isn't compatible with GLES // degasus: I think it does, but I can't test it -RasterFont* s_pfont = NULL; +RasterFont* s_pfont = nullptr; void SWRenderer::Init() { @@ -44,7 +44,7 @@ void SWRenderer::Shutdown() if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL) { delete s_pfont; - s_pfont = 0; + s_pfont = nullptr; } } diff --git a/Source/Core/VideoBackends/Software/SWVertexLoader.cpp b/Source/Core/VideoBackends/Software/SWVertexLoader.cpp index fbecdaeb79..63d96dcd2c 100644 --- a/Source/Core/VideoBackends/Software/SWVertexLoader.cpp +++ b/Source/Core/VideoBackends/Software/SWVertexLoader.cpp @@ -40,7 +40,7 @@ SWVertexLoader::SWVertexLoader() : SWVertexLoader::~SWVertexLoader() { delete m_SetupUnit; - m_SetupUnit = NULL; + m_SetupUnit = nullptr; } void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType) @@ -89,8 +89,8 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType) m_VertexSize = 0; // Reset pipeline - m_positionLoader = NULL; - m_normalLoader = NULL; + m_positionLoader = nullptr; + m_normalLoader = nullptr; m_NumAttributeLoaders = 0; // Reset vertex @@ -164,7 +164,7 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType) m_normalLoader = VertexLoader_Normal::GetFunction(g_VtxDesc.Normal, m_CurrentVat->g0.NormalFormat, m_CurrentVat->g0.NormalElements, m_CurrentVat->g0.NormalIndex3); - if (m_normalLoader == 0) + if (m_normalLoader == nullptr) { ERROR_LOG(VIDEO, "VertexLoader_Normal::GetFunction returned zero!"); } @@ -176,7 +176,7 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType) switch (colDesc[i]) { case NOT_PRESENT: - m_colorLoader[i] = NULL; + m_colorLoader[i] = nullptr; break; case DIRECT: switch (colComp[i]) diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp index c5178f682c..4651e444a4 100644 --- a/Source/Core/VideoBackends/Software/SWmain.cpp +++ b/Source/Core/VideoBackends/Software/SWmain.cpp @@ -60,7 +60,7 @@ std::string VideoSoftware::GetName() void *DllDebugger(void *_hParent, bool Show) { - return NULL; + return nullptr; } void VideoSoftware::ShowConfig(void *_hParent) diff --git a/Source/Core/VideoBackends/Software/TextureSampler.cpp b/Source/Core/VideoBackends/Software/TextureSampler.cpp index 87ac79563b..b77248ff9d 100644 --- a/Source/Core/VideoBackends/Software/TextureSampler.cpp +++ b/Source/Core/VideoBackends/Software/TextureSampler.cpp @@ -106,7 +106,7 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample) TexImage0& ti0 = texUnit.texImage0[subTexmap]; TexTLUT& texTlut = texUnit.texTlut[subTexmap]; - u8 *imageSrc, *imageSrcOdd = NULL; + u8 *imageSrc, *imageSrcOdd = nullptr; if (texUnit.texImage1[subTexmap].image_type) { imageSrc = &texMem[texUnit.texImage1[subTexmap].tmem_even * TMEM_LINE_SIZE]; diff --git a/Source/Core/VideoCommon/AVIDump.cpp b/Source/Core/VideoCommon/AVIDump.cpp index e2c2417837..3089aa85f2 100644 --- a/Source/Core/VideoCommon/AVIDump.cpp +++ b/Source/Core/VideoCommon/AVIDump.cpp @@ -68,7 +68,7 @@ bool AVIDump::CreateFile() AVIFileInit(); NOTICE_LOG(VIDEO, "Opening AVI file (%s) for dumping", movie_file_name); // TODO: Make this work with AVIFileOpenW without it throwing REGDB_E_CLASSNOTREG - HRESULT hr = AVIFileOpenA(&m_file, movie_file_name, OF_WRITE | OF_CREATE, NULL); + HRESULT hr = AVIFileOpenA(&m_file, movie_file_name, OF_WRITE | OF_CREATE, nullptr); if (FAILED(hr)) { if (hr == AVIERR_BADFORMAT) NOTICE_LOG(VIDEO, "The file couldn't be read, indicating a corrupt file or an unrecognized format."); @@ -99,7 +99,7 @@ bool AVIDump::CreateFile() } } - if (FAILED(AVIMakeCompressedStream(&m_streamCompressed, m_stream, &m_options, NULL))) + if (FAILED(AVIMakeCompressedStream(&m_streamCompressed, m_stream, &m_options, nullptr))) { NOTICE_LOG(VIDEO, "AVIMakeCompressedStream failed"); Stop(); @@ -121,19 +121,19 @@ void AVIDump::CloseFile() if (m_streamCompressed) { AVIStreamClose(m_streamCompressed); - m_streamCompressed = NULL; + m_streamCompressed = nullptr; } if (m_stream) { AVIStreamClose(m_stream); - m_stream = NULL; + m_stream = nullptr; } if (m_file) { AVIFileRelease(m_file); - m_file = NULL; + m_file = nullptr; } AVIFileExit(); @@ -160,7 +160,7 @@ void AVIDump::AddFrame(const u8* data, int w, int h) m_bitmap.biHeight = h; } - AVIStreamWrite(m_streamCompressed, ++m_frameCount, 1, const_cast(data), m_bitmap.biSizeImage, AVIIF_KEYFRAME, NULL, &m_byteBuffer); + AVIStreamWrite(m_streamCompressed, ++m_frameCount, 1, const_cast(data), m_bitmap.biSizeImage, AVIIF_KEYFRAME, nullptr, &m_byteBuffer); m_totalBytes += m_byteBuffer; // Close the recording if the file is more than 2gb // VfW can't properly save files over 2gb in size, but can keep writing to them up to 4gb. @@ -215,11 +215,11 @@ extern "C" { #include } -AVFormatContext *s_FormatContext = NULL; -AVStream *s_Stream = NULL; -AVFrame *s_BGRFrame = NULL, *s_YUVFrame = NULL; -uint8_t *s_YUVBuffer = NULL; -uint8_t *s_OutBuffer = NULL; +AVFormatContext *s_FormatContext = nullptr; +AVStream *s_Stream = nullptr; +AVFrame *s_BGRFrame = nullptr, *s_YUVFrame = nullptr; +uint8_t *s_YUVBuffer = nullptr; +uint8_t *s_OutBuffer = nullptr; int s_width; int s_height; int s_size; @@ -245,14 +245,14 @@ bool AVIDump::Start(int w, int h) bool AVIDump::CreateFile() { - AVCodec *codec = NULL; + AVCodec *codec = nullptr; s_FormatContext = avformat_alloc_context(); snprintf(s_FormatContext->filename, sizeof(s_FormatContext->filename), "%s", (File::GetUserPath(D_DUMPFRAMES_IDX) + "framedump0.avi").c_str()); File::CreateFullPath(s_FormatContext->filename); - if (!(s_FormatContext->oformat = av_guess_format("avi", NULL, NULL)) || + if (!(s_FormatContext->oformat = av_guess_format("avi", nullptr, nullptr)) || !(s_Stream = avformat_new_stream(s_FormatContext, codec))) { CloseFile(); @@ -270,7 +270,7 @@ bool AVIDump::CreateFile() s_Stream->codec->pix_fmt = g_Config.bUseFFV1 ? PIX_FMT_BGRA : PIX_FMT_YUV420P; if (!(codec = avcodec_find_encoder(s_Stream->codec->codec_id)) || - (avcodec_open2(s_Stream->codec, codec, NULL) < 0)) + (avcodec_open2(s_Stream->codec, codec, nullptr) < 0)) { CloseFile(); return false; @@ -294,7 +294,7 @@ bool AVIDump::CreateFile() return false; } - avformat_write_header(s_FormatContext, NULL); + avformat_write_header(s_FormatContext, nullptr); return true; } @@ -307,7 +307,7 @@ void AVIDump::AddFrame(const u8* data, int width, int height) // width and height struct SwsContext *s_SwsContext; if ((s_SwsContext = sws_getContext(width, height, PIX_FMT_BGR24, s_width, s_height, - s_Stream->codec->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL))) + s_Stream->codec->pix_fmt, SWS_BICUBIC, nullptr, nullptr, nullptr))) { sws_scale(s_SwsContext, s_BGRFrame->data, s_BGRFrame->linesize, 0, height, s_YUVFrame->data, s_YUVFrame->linesize); @@ -334,7 +334,7 @@ void AVIDump::AddFrame(const u8* data, int width, int height) av_interleaved_write_frame(s_FormatContext, &pkt); // Encode delayed frames - outsize = avcodec_encode_video(s_Stream->codec, s_OutBuffer, s_size, NULL); + outsize = avcodec_encode_video(s_Stream->codec, s_OutBuffer, s_size, nullptr); } } @@ -352,31 +352,31 @@ void AVIDump::CloseFile() if (s_Stream->codec) avcodec_close(s_Stream->codec); av_free(s_Stream); - s_Stream = NULL; + s_Stream = nullptr; } if (s_YUVBuffer) delete[] s_YUVBuffer; - s_YUVBuffer = NULL; + s_YUVBuffer = nullptr; if (s_OutBuffer) delete[] s_OutBuffer; - s_OutBuffer = NULL; + s_OutBuffer = nullptr; if (s_BGRFrame) av_free(s_BGRFrame); - s_BGRFrame = NULL; + s_BGRFrame = nullptr; if (s_YUVFrame) av_free(s_YUVFrame); - s_YUVFrame = NULL; + s_YUVFrame = nullptr; if (s_FormatContext) { if (s_FormatContext->pb) avio_close(s_FormatContext->pb); av_free(s_FormatContext); - s_FormatContext = NULL; + s_FormatContext = nullptr; } } diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index c417e0d26b..19df3ba008 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -268,7 +268,7 @@ void BPWritten(const BPCmd& bp) u32 tlutTMemAddr = (bp.newvalue & 0x3FF) << 9; u32 tlutXferCount = (bp.newvalue & 0x1FFC00) >> 5; - u8 *ptr = 0; + u8 *ptr = nullptr; // TODO - figure out a cleaner way. if (GetConfig(CONFIG_ISWII)) diff --git a/Source/Core/VideoCommon/Debugger.cpp b/Source/Core/VideoCommon/Debugger.cpp index affeb9183a..bd711439a9 100644 --- a/Source/Core/VideoCommon/Debugger.cpp +++ b/Source/Core/VideoCommon/Debugger.cpp @@ -15,7 +15,7 @@ //void UpdateFPSDisplay(const char *text); extern NativeVertexFormat *g_nativeVertexFmt; -GFXDebuggerBase *g_pdebugger = NULL; +GFXDebuggerBase *g_pdebugger = nullptr; volatile bool GFXDebuggerPauseFlag = false; // if true, the GFX thread will be spin locked until it's false again volatile PauseEvent GFXDebuggerToPauseAtNext = NOT_PAUSE; // Event which will trigger spin locking the GFX thread volatile int GFXDebuggerEventToPauseCount = 0; // Number of events to wait for until GFX thread will be paused @@ -27,14 +27,14 @@ void GFXDebuggerUpdateScreen() if (D3D::bFrameInProgress) { D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface()); - D3D::dev->SetDepthStencilSurface(NULL); + D3D::dev->SetDepthStencilSurface(nullptr); - D3D::dev->StretchRect(FramebufferManager::GetEFBColorRTSurface(), NULL, - D3D::GetBackBufferSurface(), NULL, + D3D::dev->StretchRect(FramebufferManager::GetEFBColorRTSurface(), nullptr, + D3D::GetBackBufferSurface(), nullptr, D3DTEXF_LINEAR); D3D::dev->EndScene(); - D3D::dev->Present(NULL, NULL, NULL, NULL); + D3D::dev->Present(nullptr, nullptr, nullptr, nullptr); D3D::dev->SetRenderTarget(0, FramebufferManager::GetEFBColorRTSurface()); D3D::dev->SetDepthStencilSurface(FramebufferManager::GetEFBDepthRTSurface()); @@ -43,7 +43,7 @@ void GFXDebuggerUpdateScreen() else { D3D::dev->EndScene(); - D3D::dev->Present(NULL, NULL, NULL, NULL); + D3D::dev->Present(nullptr, nullptr, nullptr, nullptr); D3D::dev->BeginScene(); }*/ } diff --git a/Source/Core/VideoCommon/EmuWindow.cpp b/Source/Core/VideoCommon/EmuWindow.cpp index b5570a9a0f..46c2b4ffa0 100644 --- a/Source/Core/VideoCommon/EmuWindow.cpp +++ b/Source/Core/VideoCommon/EmuWindow.cpp @@ -15,9 +15,9 @@ namespace EmuWindow { -HWND m_hWnd = NULL; -HWND m_hParent = NULL; -HINSTANCE m_hInstance = NULL; +HWND m_hWnd = nullptr; +HWND m_hParent = nullptr; +HINSTANCE m_hInstance = nullptr; WNDCLASSEX wndClass; const TCHAR m_szClassName[] = _T("DolphinEmuWnd"); int g_winstyle; @@ -81,7 +81,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) case WM_CLOSE: // When the user closes the window, we post an event to the main window to call Stop() // Which then handles all the necessary steps to Shutdown the core - if (m_hParent == NULL) + if (m_hParent == nullptr) { // Stop the game //PostMessage(m_hParent, WM_USER, WM_USER_STOP, 0); @@ -126,12 +126,12 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T wndClass.cbClsExtra = 0; wndClass.cbWndExtra = 0; wndClass.hInstance = hInstance; - wndClass.hIcon = LoadIcon( NULL, IDI_APPLICATION ); - wndClass.hCursor = NULL; + wndClass.hIcon = LoadIcon( nullptr, IDI_APPLICATION ); + wndClass.hCursor = nullptr; wndClass.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH ); - wndClass.lpszMenuName = NULL; + wndClass.lpszMenuName = nullptr; wndClass.lpszClassName = m_szClassName; - wndClass.hIconSm = LoadIcon( NULL, IDI_APPLICATION ); + wndClass.hIconSm = LoadIcon( nullptr, IDI_APPLICATION ); m_hInstance = hInstance; RegisterClassEx( &wndClass ); @@ -139,7 +139,7 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T m_hParent = parent; m_hWnd = CreateWindow(m_szClassName, title, (g_ActiveConfig.backend_info.bSupports3DVision && g_ActiveConfig.b3DVision) ? WS_EX_TOPMOST | WS_POPUP : WS_CHILD, - 0, 0, width, height, m_hParent, NULL, hInstance, NULL); + 0, 0, width, height, m_hParent, nullptr, hInstance, nullptr); return m_hWnd; } diff --git a/Source/Core/VideoCommon/Fifo.cpp b/Source/Core/VideoCommon/Fifo.cpp index 233f1e8109..02e80ceccf 100644 --- a/Source/Core/VideoCommon/Fifo.cpp +++ b/Source/Core/VideoCommon/Fifo.cpp @@ -70,7 +70,7 @@ void Fifo_Shutdown() { if (GpuRunningState) PanicAlert("Fifo shutting down while active"); FreeMemoryPages(videoBuffer, FIFO_SIZE); - videoBuffer = NULL; + videoBuffer = nullptr; } u8* GetVideoBufferStartPtr() diff --git a/Source/Core/VideoCommon/FramebufferManagerBase.cpp b/Source/Core/VideoCommon/FramebufferManagerBase.cpp index 0cd1eb4a83..f23af5e36c 100644 --- a/Source/Core/VideoCommon/FramebufferManagerBase.cpp +++ b/Source/Core/VideoCommon/FramebufferManagerBase.cpp @@ -14,7 +14,7 @@ unsigned int FramebufferManagerBase::s_last_xfb_height = 1; FramebufferManagerBase::FramebufferManagerBase() { - m_realXFBSource = NULL; + m_realXFBSource = nullptr; // can't hurt memset(m_overlappingXFBArray, 0, sizeof(m_overlappingXFBArray)); @@ -34,7 +34,7 @@ FramebufferManagerBase::~FramebufferManagerBase() const XFBSourceBase* const* FramebufferManagerBase::GetXFBSource(u32 xfbAddr, u32 fbWidth, u32 fbHeight, u32 &xfbCount) { if (!g_ActiveConfig.bUseXFB) - return NULL; + return nullptr; if (g_ActiveConfig.bUseRealXFB) return GetRealXFBSource(xfbAddr, fbWidth, fbHeight, xfbCount); @@ -77,7 +77,7 @@ const XFBSourceBase* const* FramebufferManagerBase::GetVirtualXFBSource(u32 xfbA xfbCount = 0; if (m_virtualXFBList.empty()) // no Virtual XFBs available - return NULL; + return nullptr; u32 srcLower = xfbAddr; u32 srcUpper = xfbAddr + 2 * fbWidth * fbHeight; @@ -143,7 +143,7 @@ void FramebufferManagerBase::CopyToVirtualXFB(u32 xfbAddr, u32 fbWidth, u32 fbHe if (vxfb->xfbSource && (vxfb->xfbSource->texWidth != target_width || vxfb->xfbSource->texHeight != target_height)) { //delete vxfb->xfbSource; - //vxfb->xfbSource = NULL; + //vxfb->xfbSource = nullptr; } if (!vxfb->xfbSource) diff --git a/Source/Core/VideoCommon/FramebufferManagerBase.h b/Source/Core/VideoCommon/FramebufferManagerBase.h index 6f0b73f570..4cfbbcacba 100644 --- a/Source/Core/VideoCommon/FramebufferManagerBase.h +++ b/Source/Core/VideoCommon/FramebufferManagerBase.h @@ -58,7 +58,7 @@ public: protected: struct VirtualXFB { - VirtualXFB() : xfbSource(NULL) {} + VirtualXFB() : xfbSource(nullptr) {} // Address and size in GameCube RAM u32 xfbAddr; diff --git a/Source/Core/VideoCommon/HiresTextures.cpp b/Source/Core/VideoCommon/HiresTextures.cpp index 286e3e28d5..151173f637 100644 --- a/Source/Core/VideoCommon/HiresTextures.cpp +++ b/Source/Core/VideoCommon/HiresTextures.cpp @@ -70,7 +70,7 @@ void Init(const char *gameCode) for (auto& rFilename : rFilenames) { std::string FileName; - SplitPath(rFilename, NULL, &FileName, NULL); + SplitPath(rFilename, nullptr, &FileName, nullptr); if (FileName.substr(0, strlen(code)).compare(code) == 0 && textureMap.find(FileName) == textureMap.end()) textureMap.insert(std::map::value_type(FileName, rFilename)); @@ -95,7 +95,7 @@ PC_TexFormat GetHiresTex(const char *fileName, unsigned int *pWidth, unsigned in int channels; u8 *temp = SOIL_load_image(textureMap[key].c_str(), &width, &height, &channels, SOIL_LOAD_RGBA); - if (temp == NULL) + if (temp == nullptr) { ERROR_LOG(VIDEO, "Custom texture %s failed to load", textureMap[key].c_str()); return PC_TEX_FMT_NONE; diff --git a/Source/Core/VideoCommon/ImageWrite.cpp b/Source/Core/VideoCommon/ImageWrite.cpp index a3c9dec86a..d16164887c 100644 --- a/Source/Core/VideoCommon/ImageWrite.cpp +++ b/Source/Core/VideoCommon/ImageWrite.cpp @@ -35,8 +35,8 @@ bool TextureToPng(u8* data, int row_stride, const std::string& filename, int wid char title[] = "Dolphin Screenshot"; char title_key[] = "Title"; - png_structp png_ptr = NULL; - png_infop info_ptr = NULL; + png_structp png_ptr = nullptr; + png_infop info_ptr = nullptr; // Open file for writing (binary mode) File::IOFile fp(filename, "wb"); @@ -46,8 +46,8 @@ bool TextureToPng(u8* data, int row_stride, const std::string& filename, int wid } // Initialize write structure - 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) { PanicAlert("Screenshot failed: Could not allocate write struct\n"); goto finalise; @@ -55,7 +55,7 @@ bool TextureToPng(u8* data, int row_stride, const std::string& filename, int wid // Initialize info structure info_ptr = png_create_info_struct(png_ptr); - if (info_ptr == NULL) { + if (info_ptr == nullptr) { PanicAlert("Screenshot failed: Could not allocate info struct\n"); goto finalise; } @@ -96,13 +96,13 @@ bool TextureToPng(u8* data, int row_stride, const std::string& filename, int wid } // End write - png_write_end(png_ptr, NULL); + png_write_end(png_ptr, nullptr); success = true; finalise: - if (info_ptr != NULL) png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); - if (png_ptr != NULL) png_destroy_write_struct(&png_ptr, (png_infopp)NULL); + if (info_ptr != nullptr) png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); + if (png_ptr != nullptr) png_destroy_write_struct(&png_ptr, (png_infopp)nullptr); return success; } diff --git a/Source/Core/VideoCommon/IndexGenerator.cpp b/Source/Core/VideoCommon/IndexGenerator.cpp index 809a2be2e2..0989b65283 100644 --- a/Source/Core/VideoCommon/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/IndexGenerator.cpp @@ -33,7 +33,7 @@ void IndexGenerator::Init() primitive_table[3] = IndexGenerator::AddStrip; primitive_table[4] = IndexGenerator::AddFan; } - primitive_table[1] = NULL; + primitive_table[1] = nullptr; primitive_table[5] = &IndexGenerator::AddLineList; primitive_table[6] = &IndexGenerator::AddLineStrip; primitive_table[7] = &IndexGenerator::AddPoints; diff --git a/Source/Core/VideoCommon/OpcodeDecoding.cpp b/Source/Core/VideoCommon/OpcodeDecoding.cpp index 8c680a04c5..703f691e7e 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.cpp +++ b/Source/Core/VideoCommon/OpcodeDecoding.cpp @@ -31,7 +31,7 @@ #include "VideoCommon/XFMemory.h" -u8* g_pVideoData = 0; +u8* g_pVideoData = nullptr; bool g_bRecordFifoData = false; #if _M_SSE >= 0x301 @@ -85,7 +85,7 @@ void InterpretDisplayList(u32 address, u32 size) u8* startAddress = Memory::GetPointer(address); // Avoid the crash if Memory::GetPointer failed .. - if (startAddress != 0) + if (startAddress != nullptr) { g_pVideoData = startAddress; diff --git a/Source/Core/VideoCommon/PerfQueryBase.cpp b/Source/Core/VideoCommon/PerfQueryBase.cpp index cf59b3101c..3950d7f297 100644 --- a/Source/Core/VideoCommon/PerfQueryBase.cpp +++ b/Source/Core/VideoCommon/PerfQueryBase.cpp @@ -1,7 +1,7 @@ #include "VideoCommon/PerfQueryBase.h" #include "VideoCommon/VideoConfig.h" -PerfQueryBase* g_perf_query = 0; +PerfQueryBase* g_perf_query = nullptr; bool PerfQueryBase::ShouldEmulate() { diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index e51294e55c..1b8bae7935 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -224,17 +224,17 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T { // Non-uid template parameters will write to the dummy data (=> gets optimized out) pixel_shader_uid_data dummy_data; - pixel_shader_uid_data& uid_data = (&out.template GetUidData() != NULL) + pixel_shader_uid_data& uid_data = (&out.template GetUidData() != nullptr) ? out.template GetUidData() : dummy_data; out.SetBuffer(text); - const bool is_writing_shadercode = (out.GetBuffer() != NULL); + const bool is_writing_shadercode = (out.GetBuffer() != nullptr); #ifndef ANDROID locale_t locale; locale_t old_locale; if (is_writing_shadercode) { - locale = newlocale(LC_NUMERIC_MASK, "C", NULL); // New locale for compilation + locale = newlocale(LC_NUMERIC_MASK, "C", nullptr); // New locale for compilation old_locale = uselocale(locale); // Apply the locale for this thread } #endif @@ -1177,7 +1177,7 @@ static inline void WriteFog(T& out, pixel_shader_uid_data& uid_data) } else { - if (bpmem.fog.c_proj_fsel.fsel != 2 && out.GetBuffer() != NULL) + if (bpmem.fog.c_proj_fsel.fsel != 2 && out.GetBuffer() != nullptr) WARN_LOG(VIDEO, "Unknown Fog Type! %08x", bpmem.fog.c_proj_fsel.fsel); } diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index e275238ab0..52668c4511 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -42,7 +42,7 @@ int frameCount; int OSDChoice, OSDTime; -Renderer *g_renderer = NULL; +Renderer *g_renderer = nullptr; std::mutex Renderer::s_criticalScreenshot; std::string Renderer::s_sScreenshotName; diff --git a/Source/Core/VideoCommon/ShaderGenCommon.h b/Source/Core/VideoCommon/ShaderGenCommon.h index 97dab6acf4..ca3650855c 100644 --- a/Source/Core/VideoCommon/ShaderGenCommon.h +++ b/Source/Core/VideoCommon/ShaderGenCommon.h @@ -36,7 +36,7 @@ public: * @note When implementing this method in a child class, you likely want to return the argument of the last SetBuffer call here * @note SetBuffer() should be called before using GetBuffer(). */ - const char* GetBuffer() { return NULL; } + const char* GetBuffer() { return nullptr; } /* * Can be used to give the object a place to write to. This should be called before using Write(). @@ -51,10 +51,10 @@ public: /* * Returns a pointer to an internally stored object of the uid_data type. - * @warning since most child classes use the default implementation you shouldn't access this directly without adding precautions against NULL access (e.g. via adding a dummy structure, cf. the vertex/pixel shader generators) + * @warning since most child classes use the default implementation you shouldn't access this directly without adding precautions against nullptr access (e.g. via adding a dummy structure, cf. the vertex/pixel shader generators) */ template - uid_data& GetUidData() { return *(uid_data*)NULL; } + uid_data& GetUidData() { return *(uid_data*)nullptr; } }; /** @@ -106,7 +106,7 @@ private: class ShaderCode : public ShaderGeneratorInterface { public: - ShaderCode() : buf(NULL), write_ptr(NULL) + ShaderCode() : buf(nullptr), write_ptr(nullptr) { } diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 1c9bb0ba2a..c5f4f127f2 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -25,7 +25,7 @@ enum TextureCache *g_texture_cache; -GC_ALIGNED16(u8 *TextureCache::temp) = NULL; +GC_ALIGNED16(u8 *TextureCache::temp) = nullptr; unsigned int TextureCache::temp_size; TextureCache::TexCache TextureCache::textures; @@ -72,7 +72,7 @@ TextureCache::~TextureCache() { Invalidate(); FreeAlignedMemory(temp); - temp = NULL; + temp = nullptr; } void TextureCache::OnConfigChanged(VideoConfig& config) @@ -334,7 +334,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, unsigned int const tlutaddr, int const tlutfmt, bool const use_mipmaps, unsigned int maxlevel, bool const from_tmem) { if (0 == address) - return NULL; + return nullptr; // TexelSizeInNibbles(format) * width * height / 16; const unsigned int bsw = TexDecoder_GetBlockWidthInTexels(texformat) - 1; @@ -431,7 +431,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, { // delete the texture and make a new one delete entry; - entry = NULL; + entry = nullptr; } } @@ -452,7 +452,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, if(entry) { delete entry; - entry = NULL; + entry = nullptr; } } using_custom_texture = true; @@ -480,7 +480,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, texLevels = (use_native_mips || using_custom_lods) ? texLevels : 1; // TODO: Should be forced to 1 for non-pow2 textures (e.g. efb copies with automatically adjusted IR) // create the entry/texture - if (NULL == entry) + if (nullptr == entry) { textures[texID] = entry = g_texture_cache->CreateTexture(width, height, expandedWidth, texLevels, pcfmt); @@ -522,8 +522,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, { src_data += texture_size; - const u8* ptr_even = NULL; - const u8* ptr_odd = NULL; + const u8* ptr_even = nullptr; + const u8* ptr_odd = nullptr; if (from_tmem) { ptr_even = &texMem[bpmem.tex[stage/4].texImage1[stage%4].tmem_even * TMEM_LINE_SIZE + texture_size]; @@ -862,11 +862,11 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat { // remove it and recreate it as a render target delete entry; - entry = NULL; + entry = nullptr; } } - if (NULL == entry) + if (nullptr == entry) { // create the texture textures[dstAddr] = entry = g_texture_cache->CreateRenderTargetTexture(scaled_tex_w, scaled_tex_h); diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp index 44bc3726e2..f7fd921c27 100644 --- a/Source/Core/VideoCommon/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/TextureConversionShader.cpp @@ -604,7 +604,7 @@ void WriteZ24Encoder(char*& p, API_TYPE ApiType) const char *GenerateEncodingShader(u32 format,API_TYPE ApiType) { #ifndef ANDROID - locale_t locale = newlocale(LC_NUMERIC_MASK, "C", NULL); // New locale for compilation + locale_t locale = newlocale(LC_NUMERIC_MASK, "C", nullptr); // New locale for compilation locale_t old_locale = uselocale(locale); // Apply the locale for this thread #endif text[sizeof(text) - 1] = 0x7C; // canary diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp index dac42c0b4d..c943b3c04d 100644 --- a/Source/Core/VideoCommon/VertexLoader.cpp +++ b/Source/Core/VideoCommon/VertexLoader.cpp @@ -464,10 +464,10 @@ void LOADERDECL TexMtx_Write_Float4() VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr) { - m_compiledCode = NULL; + m_compiledCode = nullptr; m_numLoadedVertices = 0; m_VertexSize = 0; - m_NativeFmt = 0; + m_NativeFmt = nullptr; loop_counter = 0; VertexLoader_Normal::Init(); VertexLoader_Position::Init(); @@ -594,7 +594,7 @@ void VertexLoader::CompileVertexTranslator() TPipelineFunction pFunc = VertexLoader_Normal::GetFunction(m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3); - if (pFunc == 0) + if (pFunc == nullptr) { Host_SysMessage( StringFromFormat("VertexLoader_Normal::GetFunction(%i %i %i %i) returned zero!", @@ -829,7 +829,7 @@ void VertexLoader::SetupRunVertices(int vtx_attr_group, int primitive, int const m_numLoadedVertices += count; // Flush if our vertex format is different from the currently set. - if (g_nativeVertexFmt != NULL && g_nativeVertexFmt != m_NativeFmt) + if (g_nativeVertexFmt != nullptr && g_nativeVertexFmt != m_NativeFmt) { // We really must flush here. It's possible that the native representations // of the two vtx formats are the same, but we have no way to easily check that diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp index b7ad98e67d..5757dc6f45 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp @@ -44,7 +44,7 @@ void Init() { MarkAllDirty(); for (VertexLoader*& vertexLoader : g_VertexLoaders) - vertexLoader = NULL; + vertexLoader = nullptr; RecomputeCachedArraybases(); } diff --git a/Source/Core/VideoCommon/VertexLoader_Position.cpp b/Source/Core/VideoCommon/VertexLoader_Position.cpp index 5ca07e7792..f95ef665bf 100644 --- a/Source/Core/VideoCommon/VertexLoader_Position.cpp +++ b/Source/Core/VideoCommon/VertexLoader_Position.cpp @@ -123,11 +123,11 @@ void LOADERDECL Pos_ReadIndex_Float_SSSE3() static TPipelineFunction tableReadPosition[4][8][2] = { { - {NULL, NULL,}, - {NULL, NULL,}, - {NULL, NULL,}, - {NULL, NULL,}, - {NULL, NULL,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, }, { {Pos_ReadDirect, Pos_ReadDirect,}, diff --git a/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp b/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp index d8fcf9bbaa..b7a6a3ec7b 100644 --- a/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp +++ b/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp @@ -132,11 +132,11 @@ void LOADERDECL TexCoord_ReadIndex_Float2_SSSE3() static TPipelineFunction tableReadTexCoord[4][8][2] = { { - {NULL, NULL,}, - {NULL, NULL,}, - {NULL, NULL,}, - {NULL, NULL,}, - {NULL, NULL,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, + {nullptr, nullptr,}, }, { {TexCoord_ReadDirect, TexCoord_ReadDirect,}, diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp index 3e2e02eecd..67c18286aa 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/VertexShaderGen.cpp @@ -60,17 +60,17 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ { // Non-uid template parameters will write to the dummy data (=> gets optimized out) vertex_shader_uid_data dummy_data; - vertex_shader_uid_data& uid_data = (&out.template GetUidData() != NULL) + vertex_shader_uid_data& uid_data = (&out.template GetUidData() != nullptr) ? out.template GetUidData() : dummy_data; out.SetBuffer(text); - const bool is_writing_shadercode = (out.GetBuffer() != NULL); + const bool is_writing_shadercode = (out.GetBuffer() != nullptr); #ifndef ANDROID locale_t locale; locale_t old_locale; if (is_writing_shadercode) { - locale = newlocale(LC_NUMERIC_MASK, "C", NULL); // New locale for compilation + locale = newlocale(LC_NUMERIC_MASK, "C", nullptr); // New locale for compilation old_locale = uselocale(locale); // Apply the locale for this thread } #endif diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp index 36e52b6654..a2d6d19845 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.cpp +++ b/Source/Core/VideoCommon/VideoBackendBase.cpp @@ -12,8 +12,8 @@ #include "VideoCommon/VideoBackendBase.h" std::vector g_available_video_backends; -VideoBackend* g_video_backend = NULL; -static VideoBackend* s_default_backend = NULL; +VideoBackend* g_video_backend = nullptr; +static VideoBackend* s_default_backend = nullptr; #ifdef _WIN32 #include @@ -36,7 +36,7 @@ static bool IsGteVista() void VideoBackend::PopulateList() { - VideoBackend* backends[4] = { NULL }; + VideoBackend* backends[4] = { nullptr }; // OGL > D3D11 > SW #if !defined(USE_GLES) || USE_GLES3 @@ -69,7 +69,7 @@ void VideoBackend::ClearList() void VideoBackend::ActivateBackend(const std::string& name) { - if (name.length() == 0) // If NULL, set it to the default backend (expected behavior) + if (name.length() == 0) // If nullptr, set it to the default backend (expected behavior) g_video_backend = s_default_backend; for (VideoBackend* backend : g_available_video_backends) diff --git a/Source/DSPSpy/main_spy.cpp b/Source/DSPSpy/main_spy.cpp index a4c7800cb9..a003f04c60 100644 --- a/Source/DSPSpy/main_spy.cpp +++ b/Source/DSPSpy/main_spy.cpp @@ -51,7 +51,7 @@ // Used for communications with the DSP, such as dumping registers etc. u16 dspbuffer[16 * 1024] __attribute__ ((aligned (0x4000))); -static void *xfb = NULL; +static void *xfb = nullptr; void (*reboot)() = (void(*)())0x80001800; GXRModeObj *rmode; @@ -522,7 +522,7 @@ void InitGeneral() // Obtain the preferred video mode from the system // This will correspond to the settings in the Wii menu - rmode = VIDEO_GetPreferredMode(NULL); + rmode = VIDEO_GetPreferredMode(nullptr); // Allocate memory for the display in the uncached region xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); diff --git a/Source/DSPSpy/real_dsp.cpp b/Source/DSPSpy/real_dsp.cpp index d792711543..c5df21e2d7 100644 --- a/Source/DSPSpy/real_dsp.cpp +++ b/Source/DSPSpy/real_dsp.cpp @@ -28,7 +28,7 @@ void RealDSP::Init() u32 level; _CPU_ISR_Disable(level); - IRQ_Request(IRQ_DSP_DSP, dsp_irq_handler, NULL); + IRQ_Request(IRQ_DSP_DSP, dsp_irq_handler, nullptr); _CPU_ISR_Restore(level); } diff --git a/docs/DSP/DSP_InterC/DSP_InterC/DSP_InterC.cpp b/docs/DSP/DSP_InterC/DSP_InterC/DSP_InterC.cpp index d4eabf1873..aeddd410b5 100644 --- a/docs/DSP/DSP_InterC/DSP_InterC/DSP_InterC.cpp +++ b/docs/DSP/DSP_InterC/DSP_InterC/DSP_InterC.cpp @@ -35,7 +35,7 @@ void Decode(uint16 startAddress, uint16 endAddress) int _tmain(int argc, _TCHAR* argv[]) { FILE* pFile = fopen("c:\\_\\dsp_rom.bin", "rb"); - if (pFile == NULL) + if (pFile == nullptr) return -1; fread(g_IMemory, 0x1000, 1, pFile);