clang-modernize -use-nullptr

and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine
This commit is contained in:
Tillmann Karras 2014-03-09 21:14:26 +01:00
parent f28116b7da
commit d802d39281
292 changed files with 1526 additions and 1526 deletions

View File

@ -22,7 +22,7 @@ void AOSound::SoundLoop()
format.rate = m_mixer->GetSampleRate(); format.rate = m_mixer->GetSampleRate();
format.byte_format = AO_FMT_LITTLE; 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) if (!device)
{ {
PanicAlertT("AudioCommon: Error opening AO device.\n"); PanicAlertT("AudioCommon: Error opening AO device.\n");
@ -73,7 +73,7 @@ void AOSound::Stop()
ao_shutdown(); ao_shutdown();
device = NULL; device = nullptr;
} }
} }

View File

@ -12,7 +12,7 @@
#define BUFFER_SIZE_MAX 8192 #define BUFFER_SIZE_MAX 8192
#define BUFFER_SIZE_BYTES (BUFFER_SIZE_MAX*2*2) #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]; mix_buffer = new u8[BUFFER_SIZE_BYTES];
} }
@ -204,11 +204,11 @@ bool AlsaSound::AlsaInit()
void AlsaSound::AlsaShutdown() void AlsaSound::AlsaShutdown()
{ {
if (handle != NULL) if (handle != nullptr)
{ {
snd_pcm_drop(handle); snd_pcm_drop(handle);
snd_pcm_close(handle); snd_pcm_close(handle);
handle = NULL; handle = nullptr;
} }
} }

View File

@ -40,8 +40,8 @@ bool CoreAudioSound::Start()
desc.componentFlags = 0; desc.componentFlags = 0;
desc.componentFlagsMask = 0; desc.componentFlagsMask = 0;
desc.componentManufacturer = kAudioUnitManufacturer_Apple; desc.componentManufacturer = kAudioUnitManufacturer_Apple;
component = FindNextComponent(NULL, &desc); component = FindNextComponent(nullptr, &desc);
if (component == NULL) { if (component == nullptr) {
ERROR_LOG(AUDIO, "error finding audio component"); ERROR_LOG(AUDIO, "error finding audio component");
return false; return false;
} }

View File

@ -123,7 +123,7 @@ float* design_fir(unsigned int *n, float* fc, float opt)
float fc1; // Cutoff frequencies float fc1; // Cutoff frequencies
// Sanity check // Sanity check
if(*n==0) return NULL; if(*n==0) return nullptr;
MathUtil::Clamp(&fc[0],float(0.001),float(1)); MathUtil::Clamp(&fc[0],float(0.001),float(1));
float *w=(float*)calloc(sizeof(float),*n); float *w=(float*)calloc(sizeof(float),*n);
@ -188,7 +188,7 @@ void done(void)
{ {
free(filter_coefs_lfe); free(filter_coefs_lfe);
} }
filter_coefs_lfe = NULL; filter_coefs_lfe = nullptr;
} }
float* calc_coefficients_125Hz_lowpass(int rate) float* calc_coefficients_125Hz_lowpass(int rate)
@ -378,5 +378,5 @@ void dpl2reset()
{ {
olddelay = -1; olddelay = -1;
oldfreq = 0; oldfreq = 0;
filter_coefs_lfe = NULL; filter_coefs_lfe = nullptr;
} }

View File

@ -32,7 +32,7 @@ bool DSound::CreateBuffer()
dsbdesc.lpwfxFormat = (WAVEFORMATEX *)&pcmwf; dsbdesc.lpwfxFormat = (WAVEFORMATEX *)&pcmwf;
dsbdesc.guid3DAlgorithm = DS3DALG_DEFAULT; dsbdesc.guid3DAlgorithm = DS3DALG_DEFAULT;
HRESULT res = ds->CreateSoundBuffer(&dsbdesc, &dsBuffer, NULL); HRESULT res = ds->CreateSoundBuffer(&dsbdesc, &dsBuffer, nullptr);
if (SUCCEEDED(res)) if (SUCCEEDED(res))
{ {
dsBuffer->SetCurrentPosition(0); dsBuffer->SetCurrentPosition(0);
@ -43,7 +43,7 @@ bool DSound::CreateBuffer()
{ {
// Failed. // Failed.
PanicAlertT("Sound buffer creation failed: %08x", res); PanicAlertT("Sound buffer creation failed: %08x", res);
dsBuffer = NULL; dsBuffer = nullptr;
return false; return false;
} }
} }
@ -130,7 +130,7 @@ void DSound::SetVolume(int volume)
// This is in "dBA attenuation" from 0 to -10000, logarithmic // This is in "dBA attenuation" from 0 to -10000, logarithmic
m_volume = (int)floor(log10((float)volume) * 5000.0f) - 10000; m_volume = (int)floor(log10((float)volume) * 5000.0f) - 10000;
if (dsBuffer != NULL) if (dsBuffer != nullptr)
dsBuffer->SetVolume(m_volume); dsBuffer->SetVolume(m_volume);
} }
@ -143,7 +143,7 @@ void DSound::Clear(bool mute)
{ {
m_muted = mute; m_muted = mute;
if (dsBuffer != NULL) if (dsBuffer != nullptr)
{ {
if (m_muted) if (m_muted)
{ {

View File

@ -27,7 +27,7 @@ bool OpenALStream::Start()
ALCdevice *pDevice = alcOpenDevice(defDevName); ALCdevice *pDevice = alcOpenDevice(defDevName);
if (pDevice) if (pDevice)
{ {
ALCcontext *pContext = alcCreateContext(pDevice, NULL); ALCcontext *pContext = alcCreateContext(pDevice, nullptr);
if (pContext) if (pContext)
{ {
// Used to determine an appropriate period size (2x period = total buffer size) // Used to determine an appropriate period size (2x period = total buffer size)
@ -83,7 +83,7 @@ void OpenALStream::Stop()
ALCcontext *pContext = alcGetCurrentContext(); ALCcontext *pContext = alcGetCurrentContext();
ALCdevice *pDevice = alcGetContextsDevice(pContext); ALCdevice *pDevice = alcGetContextsDevice(pContext);
alcMakeContextCurrent(NULL); alcMakeContextCurrent(nullptr);
alcDestroyContext(pContext); alcDestroyContext(pContext);
alcCloseDevice(pDevice); alcCloseDevice(pDevice);
} }

View File

@ -44,7 +44,7 @@ class OpenALStream: public SoundStream
{ {
#if defined HAVE_OPENAL && HAVE_OPENAL #if defined HAVE_OPENAL && HAVE_OPENAL
public: public:
OpenALStream(CMixer *mixer, void *hWnd = NULL) OpenALStream(CMixer *mixer, void *hWnd = nullptr)
: SoundStream(mixer) : SoundStream(mixer)
, uiSource(0) , uiSource(0)
{} {}

View File

@ -17,7 +17,7 @@ static SLEngineItf engineEngine;
static SLObjectItf outputMixObject; static SLObjectItf outputMixObject;
// buffer queue player interfaces // buffer queue player interfaces
static SLObjectItf bqPlayerObject = NULL; static SLObjectItf bqPlayerObject = nullptr;
static SLPlayItf bqPlayerPlay; static SLPlayItf bqPlayerPlay;
static SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue; static SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue;
static SLMuteSoloItf bqPlayerMuteSolo; static SLMuteSoloItf bqPlayerMuteSolo;
@ -32,7 +32,7 @@ static int curBuffer = 0;
static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context) { static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context) {
assert(bq == bqPlayerBufferQueue); assert(bq == bqPlayerBufferQueue);
assert(NULL == context); assert(nullptr == context);
short *nextBuffer = buffer[curBuffer]; short *nextBuffer = buffer[curBuffer];
int nextSize = sizeof(buffer[0]); int nextSize = sizeof(buffer[0]);
@ -53,7 +53,7 @@ bool OpenSLESStream::Start()
{ {
SLresult result; SLresult result;
// create engine // create engine
result = slCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL); result = slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr);
assert(SL_RESULT_SUCCESS == result); assert(SL_RESULT_SUCCESS == result);
result = (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); result = (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result); assert(SL_RESULT_SUCCESS == result);
@ -79,7 +79,7 @@ bool OpenSLESStream::Start()
// configure audio sink // configure audio sink
SLDataLocator_OutputMix loc_outmix = {SL_DATALOCATOR_OUTPUTMIX, outputMixObject}; SLDataLocator_OutputMix loc_outmix = {SL_DATALOCATOR_OUTPUTMIX, outputMixObject};
SLDataSink audioSnk = {&loc_outmix, NULL}; SLDataSink audioSnk = {&loc_outmix, nullptr};
// create audio player // create audio player
const SLInterfaceID ids[2] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME}; const SLInterfaceID ids[2] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME};
@ -94,7 +94,7 @@ bool OpenSLESStream::Start()
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_BUFFERQUEUE, result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_BUFFERQUEUE,
&bqPlayerBufferQueue); &bqPlayerBufferQueue);
assert(SL_RESULT_SUCCESS == result); assert(SL_RESULT_SUCCESS == result);
result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, NULL); result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, nullptr);
assert(SL_RESULT_SUCCESS == result); assert(SL_RESULT_SUCCESS == result);
result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING); result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING);
assert(SL_RESULT_SUCCESS == result); assert(SL_RESULT_SUCCESS == result);
@ -113,22 +113,22 @@ bool OpenSLESStream::Start()
void OpenSLESStream::Stop() void OpenSLESStream::Stop()
{ {
if (bqPlayerObject != NULL) { if (bqPlayerObject != nullptr) {
(*bqPlayerObject)->Destroy(bqPlayerObject); (*bqPlayerObject)->Destroy(bqPlayerObject);
bqPlayerObject = NULL; bqPlayerObject = nullptr;
bqPlayerPlay = NULL; bqPlayerPlay = nullptr;
bqPlayerBufferQueue = NULL; bqPlayerBufferQueue = nullptr;
bqPlayerMuteSolo = NULL; bqPlayerMuteSolo = nullptr;
bqPlayerVolume = NULL; bqPlayerVolume = nullptr;
} }
if (outputMixObject != NULL) { if (outputMixObject != nullptr) {
(*outputMixObject)->Destroy(outputMixObject); (*outputMixObject)->Destroy(outputMixObject);
outputMixObject = NULL; outputMixObject = nullptr;
} }
if (engineObject != NULL) { if (engineObject != nullptr) {
(*engineObject)->Destroy(engineObject); (*engineObject)->Destroy(engineObject);
engineObject = NULL; engineObject = nullptr;
engineEngine = NULL; engineEngine = nullptr;
} }
} }
#endif #endif

View File

@ -11,7 +11,7 @@ class OpenSLESStream : public SoundStream
{ {
#ifdef ANDROID #ifdef ANDROID
public: public:
OpenSLESStream(CMixer *mixer, void *hWnd = NULL) OpenSLESStream(CMixer *mixer, void *hWnd = nullptr)
: SoundStream(mixer) : SoundStream(mixer)
{}; {};
@ -27,6 +27,6 @@ private:
Common::Event soundSyncEvent; Common::Event soundSyncEvent;
#else #else
public: public:
OpenSLESStream(CMixer *mixer, void *hWnd = NULL): SoundStream(mixer) {} OpenSLESStream(CMixer *mixer, void *hWnd = nullptr): SoundStream(mixer) {}
#endif // HAVE_OPENSL #endif // HAVE_OPENSL
}; };

View File

@ -47,7 +47,7 @@ void PulseAudio::SoundLoop()
if (PulseInit()) if (PulseInit())
{ {
while (m_run_thread.load() && m_pa_connected == 1 && m_pa_error >= 0) 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) if(m_pa_error < 0)
ERROR_LOG(AUDIO, "PulseAudio error: %s", pa_strerror(m_pa_error)); 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_ml = pa_mainloop_new();
m_pa_mlapi = pa_mainloop_get_api(m_pa_ml); m_pa_mlapi = pa_mainloop_get_api(m_pa_ml);
m_pa_ctx = pa_context_new(m_pa_mlapi, "dolphin-emu"); 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); pa_context_set_state_callback(m_pa_ctx, StateCallback, this);
// wait until we're connected to the pulseaudio server // wait until we're connected to the pulseaudio server
while (m_pa_connected == 0 && m_pa_error >= 0) 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) if (m_pa_connected == 2 || m_pa_error < 0)
{ {
@ -85,7 +85,7 @@ bool PulseAudio::PulseInit()
ss.format = PA_SAMPLE_S16LE; ss.format = PA_SAMPLE_S16LE;
ss.channels = 2; ss.channels = 2;
ss.rate = m_mixer->GetSampleRate(); 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_write_callback(m_pa_s, WriteCallback, this);
pa_stream_set_underflow_callback(m_pa_s, UnderflowCallback, 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.prebuf = -1; // start as early as possible
m_pa_ba.tlength = BUFFER_SIZE; // designed latency, only change this flag for low latency output 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); 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) if (m_pa_error < 0)
{ {
ERROR_LOG(AUDIO, "PulseAudio failed to initialize: %s", pa_strerror(m_pa_error)); 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) void PulseAudio::UnderflowCallback(pa_stream* s)
{ {
m_pa_ba.tlength += BUFFER_SIZE; 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); 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 return; // error will be printed from main loop
m_mixer->Mix((s16*) buffer, length / sizeof(s16) / CHANNEL_COUNT); 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). // Callbacks that forward to internal methods (required because PulseAudio is a C API).

View File

@ -11,7 +11,7 @@ enum {BUF_SIZE = 32*1024};
WaveFileWriter::WaveFileWriter(): WaveFileWriter::WaveFileWriter():
skip_silence(false), skip_silence(false),
audio_size(0), audio_size(0),
conv_buffer(NULL) conv_buffer(nullptr)
{ {
} }

View File

@ -158,7 +158,7 @@ XAudio2::XAudio2(CMixer *mixer)
: SoundStream(mixer) : SoundStream(mixer)
, m_mastering_voice(nullptr) , m_mastering_voice(nullptr)
, m_volume(1.0f) , m_volume(1.0f)
, m_cleanup_com(SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) , m_cleanup_com(SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED)))
{ {
} }

View File

@ -159,7 +159,7 @@ XAudio2_7::XAudio2_7(CMixer *mixer)
: SoundStream(mixer) : SoundStream(mixer)
, m_mastering_voice(nullptr) , m_mastering_voice(nullptr)
, m_volume(1.0f) , m_volume(1.0f)
, m_cleanup_com(SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) , m_cleanup_com(SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED)))
{ {
} }

View File

@ -50,13 +50,13 @@ ALDeviceList::ALDeviceList()
defaultDeviceIndex = 0; defaultDeviceIndex = 0;
// grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices // grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices
//if (LoadOAL10Library(NULL, &ALFunction) == TRUE) { //if (LoadOAL10Library(nullptr, &ALFunction) == TRUE) {
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) if (alcIsExtensionPresent(nullptr, "ALC_ENUMERATION_EXT"))
{ {
const char *devices = alcGetString(NULL, ALC_DEVICE_SPECIFIER); const char *devices = alcGetString(nullptr, ALC_DEVICE_SPECIFIER);
const char *defaultDeviceName = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); const char *defaultDeviceName = alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER);
// go through device list (each device terminated with a single NULL, list terminated with double NULL) // go through device list (each device terminated with a single nullptr, list terminated with double nullptr)
for (s32 index = 0; devices != NULL && strlen(devices) > 0; index++, devices += strlen(devices) + 1) for (s32 index = 0; devices != nullptr && strlen(devices) > 0; index++, devices += strlen(devices) + 1)
{ {
if (strcmp(defaultDeviceName, devices) == 0) if (strcmp(defaultDeviceName, devices) == 0)
{ {
@ -65,7 +65,7 @@ ALDeviceList::ALDeviceList()
ALCdevice *device = alcOpenDevice(devices); ALCdevice *device = alcOpenDevice(devices);
if (device) if (device)
{ {
ALCcontext *context = alcCreateContext(device, NULL); ALCcontext *context = alcCreateContext(device, nullptr);
if (context) if (context)
{ {
alcMakeContextCurrent(context); alcMakeContextCurrent(context);
@ -79,7 +79,7 @@ ALDeviceList::ALDeviceList()
bNewName = false; bNewName = false;
} }
} }
if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) if ((bNewName) && (actualDeviceName != nullptr) && (strlen(actualDeviceName) > 0))
{ {
ALDeviceInfo.bSelected = true; ALDeviceInfo.bSelected = true;
ALDeviceInfo.strDeviceName = actualDeviceName; ALDeviceInfo.strDeviceName = actualDeviceName;
@ -120,7 +120,7 @@ ALDeviceList::ALDeviceList()
vDeviceInfo.push_back(ALDeviceInfo); vDeviceInfo.push_back(ALDeviceInfo);
} }
alcMakeContextCurrent(NULL); alcMakeContextCurrent(nullptr);
alcDestroyContext(context); alcDestroyContext(context);
} }
alcCloseDevice(device); alcCloseDevice(device);
@ -163,7 +163,7 @@ char * ALDeviceList::GetDeviceName(s32 index)
if (index < GetNumDevices()) if (index < GetNumDevices())
return (char *)vDeviceInfo[index].strDeviceName.c_str(); return (char *)vDeviceInfo[index].strDeviceName.c_str();
else else
return NULL; return nullptr;
} }
/* /*

View File

@ -14,7 +14,7 @@ const char procfile[] = "/proc/cpuinfo";
char *GetCPUString() char *GetCPUString()
{ {
const char marker[] = "Hardware\t: "; const char marker[] = "Hardware\t: ";
char *cpu_string = 0; char *cpu_string = nullptr;
// Count the number of processor lines in /proc/cpuinfo // Count the number of processor lines in /proc/cpuinfo
char buf[1024]; char buf[1024];
@ -38,7 +38,7 @@ char *GetCPUString()
unsigned char GetCPUImplementer() unsigned char GetCPUImplementer()
{ {
const char marker[] = "CPU implementer\t: "; const char marker[] = "CPU implementer\t: ";
char *implementer_string = 0; char *implementer_string = nullptr;
unsigned char implementer = 0; unsigned char implementer = 0;
char buf[1024]; char buf[1024];
@ -65,7 +65,7 @@ unsigned char GetCPUImplementer()
unsigned short GetCPUPart() unsigned short GetCPUPart()
{ {
const char marker[] = "CPU part\t: "; const char marker[] = "CPU part\t: ";
char *part_string = 0; char *part_string = nullptr;
unsigned short part = 0; unsigned short part = 0;
char buf[1024]; char buf[1024];
@ -105,11 +105,11 @@ bool CheckCPUFeature(const char *feature)
continue; continue;
char *featurestring = buf + sizeof(marker) - 1; char *featurestring = buf + sizeof(marker) - 1;
char *token = strtok(featurestring, " "); char *token = strtok(featurestring, " ");
while (token != NULL) while (token != nullptr)
{ {
if (strstr(token, feature)) if (strstr(token, feature))
return true; return true;
token = strtok(NULL, " "); token = strtok(nullptr, " ");
} }
} }

View File

@ -710,7 +710,7 @@ protected:
size_t region_size; size_t region_size;
public: public:
ARMXCodeBlock() : region(NULL), region_size(0) {} ARMXCodeBlock() : region(nullptr), region_size(0) {}
virtual ~ARMXCodeBlock() { if (region) FreeCodeSpace(); } virtual ~ARMXCodeBlock() { if (region) FreeCodeSpace(); }
// Call this before you generate any code. // Call this before you generate any code.
@ -735,7 +735,7 @@ public:
{ {
#ifndef __SYMBIAN32__ #ifndef __SYMBIAN32__
FreeMemoryPages(region, region_size); FreeMemoryPages(region, region_size);
region = NULL; region = nullptr;
#endif #endif
region_size = 0; region_size = 0;
} }

View File

@ -152,7 +152,7 @@ void MemChecks::AddFromStrings(const TMemChecksStr& mcstrs)
void MemChecks::Add(const TMemCheck& _rMemoryCheck) void MemChecks::Add(const TMemCheck& _rMemoryCheck)
{ {
if (GetMemCheck(_rMemoryCheck.StartAddress) == 0) if (GetMemCheck(_rMemoryCheck.StartAddress) == nullptr)
m_MemChecks.push_back(_rMemoryCheck); m_MemChecks.push_back(_rMemoryCheck);
} }
@ -184,7 +184,7 @@ TMemCheck *MemChecks::GetMemCheck(u32 address)
} }
// none found // none found
return 0; return nullptr;
} }
void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr, bool write, int size, u32 pc) void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr, bool write, int size, u32 pc)

View File

@ -41,7 +41,7 @@ std::vector<std::string> cdio_get_devices()
{ {
std::vector<std::string> drives; std::vector<std::string> drives;
const DWORD buffsize = GetLogicalDriveStrings(0, NULL); const DWORD buffsize = GetLogicalDriveStrings(0, nullptr);
std::vector<TCHAR> buff(buffsize); std::vector<TCHAR> buff(buffsize);
if (GetLogicalDriveStrings(buffsize, buff.data()) == buffsize - 1) if (GetLogicalDriveStrings(buffsize, buff.data()) == buffsize - 1)
{ {
@ -77,7 +77,7 @@ std::vector<std::string> cdio_get_devices()
return( drives ); return( drives );
classes_to_match = IOServiceMatching( kIOCDMediaClass ); classes_to_match = IOServiceMatching( kIOCDMediaClass );
if( classes_to_match == NULL ) if( classes_to_match == nullptr )
return( drives ); return( drives );
CFDictionarySetValue( classes_to_match, CFDictionarySetValue( classes_to_match,
@ -101,7 +101,7 @@ std::vector<std::string> cdio_get_devices()
IORegistryEntryCreateCFProperty( next_media, IORegistryEntryCreateCFProperty( next_media,
CFSTR( kIOBSDNameKey ), kCFAllocatorDefault, CFSTR( kIOBSDNameKey ), kCFAllocatorDefault,
0 ); 0 );
if( str_bsd_path == NULL ) if( str_bsd_path == nullptr )
{ {
IOObjectRelease( next_media ); IOObjectRelease( next_media );
continue; continue;
@ -118,7 +118,7 @@ std::vector<std::string> cdio_get_devices()
sizeof(psz_buf) - dev_path_length, sizeof(psz_buf) - dev_path_length,
kCFStringEncodingASCII)) kCFStringEncodingASCII))
{ {
if(psz_buf != NULL) if(psz_buf != nullptr)
{ {
std::string str = psz_buf; std::string str = psz_buf;
drives.push_back(str); drives.push_back(str);
@ -151,7 +151,7 @@ static struct
{ "/dev/acd%d", 0, 27 }, { "/dev/acd%d", 0, 27 },
{ "/dev/cd%d", 0, 27 }, { "/dev/cd%d", 0, 27 },
#endif #endif
{ NULL, 0, 0 } { nullptr, 0, 0 }
}; };
// Returns true if a device is a block or char device and not a symbolic link // Returns true if a device is a block or char device and not a symbolic link
@ -196,7 +196,7 @@ std::vector<std::string> cdio_get_devices ()
for (unsigned int j = checklist[i].num_min; j <= checklist[i].num_max; ++j) for (unsigned int j = checklist[i].num_min; j <= checklist[i].num_max; ++j)
{ {
std::string drive = StringFromFormat(checklist[i].format, 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)); drives.push_back(std::move(drive));
} }

View File

@ -206,7 +206,7 @@ public:
void DoLinkedList(LinkedListItem<T>*& list_start, LinkedListItem<T>** list_end=0) void DoLinkedList(LinkedListItem<T>*& list_start, LinkedListItem<T>** list_end=0)
{ {
LinkedListItem<T>* list_cur = list_start; LinkedListItem<T>* list_cur = list_start;
LinkedListItem<T>* prev = 0; LinkedListItem<T>* prev = nullptr;
while (true) while (true)
{ {
@ -220,7 +220,7 @@ public:
{ {
if (mode == MODE_READ) if (mode == MODE_READ)
{ {
cur->next = 0; cur->next = nullptr;
list_cur = cur; list_cur = cur;
if (prev) if (prev)
prev->next = cur; prev->next = cur;
@ -239,13 +239,13 @@ public:
if (mode == MODE_READ) if (mode == MODE_READ)
{ {
if (prev) if (prev)
prev->next = 0; prev->next = nullptr;
if (list_end) if (list_end)
*list_end = prev; *list_end = prev;
if (list_cur) if (list_cur)
{ {
if (list_start == list_cur) if (list_start == list_cur)
list_start = 0; list_start = nullptr;
do do
{ {
LinkedListItem<T>* next = list_cur->next; LinkedListItem<T>* next = list_cur->next;
@ -393,7 +393,7 @@ public:
} }
// Get data // Get data
u8 *ptr = 0; u8 *ptr = nullptr;
PointerWrap p(&ptr, PointerWrap::MODE_MEASURE); PointerWrap p(&ptr, PointerWrap::MODE_MEASURE);
_class.DoState(p); _class.DoState(p);
size_t const sz = (size_t)ptr; size_t const sz = (size_t)ptr;

View File

@ -127,7 +127,7 @@ inline u64 _rotr64(u64 x, unsigned int shift){
// Restore the global locale // Restore the global locale
_configthreadlocale(_DISABLE_PER_THREAD_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 // Configure the thread to set the locale only for this thread
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE); _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);

View File

@ -18,7 +18,7 @@
ConsoleListener::ConsoleListener() ConsoleListener::ConsoleListener()
{ {
#ifdef _WIN32 #ifdef _WIN32
hConsole = NULL; hConsole = nullptr;
bUseColor = true; bUseColor = true;
#else #else
bUseColor = isatty(fileno(stdout)); bUseColor = isatty(fileno(stdout));
@ -68,19 +68,19 @@ void ConsoleListener::UpdateHandle()
void ConsoleListener::Close() void ConsoleListener::Close()
{ {
#ifdef _WIN32 #ifdef _WIN32
if (hConsole == NULL) if (hConsole == nullptr)
return; return;
FreeConsole(); FreeConsole();
hConsole = NULL; hConsole = nullptr;
#else #else
fflush(NULL); fflush(nullptr);
#endif #endif
} }
bool ConsoleListener::IsOpen() bool ConsoleListener::IsOpen()
{ {
#ifdef _WIN32 #ifdef _WIN32
return (hConsole != NULL); return (hConsole != nullptr);
#else #else
return true; return true;
#endif #endif
@ -280,11 +280,11 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
{ {
// First 10 chars white // First 10 chars white
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY); SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
WriteConsole(hConsole, Text, 10, &cCharsWritten, NULL); WriteConsole(hConsole, Text, 10, &cCharsWritten, nullptr);
Text += 10; Text += 10;
} }
SetConsoleTextAttribute(hConsole, Color); SetConsoleTextAttribute(hConsole, Color);
WriteConsole(hConsole, Text, (DWORD)strlen(Text), &cCharsWritten, NULL); WriteConsole(hConsole, Text, (DWORD)strlen(Text), &cCharsWritten, nullptr);
#else #else
char ColorAttr[16] = ""; char ColorAttr[16] = "";
char ResetAttr[16] = ""; char ResetAttr[16] = "";

View File

@ -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) static void silly_random(u8 * rndArea, u8 count)
{ {
u16 i; u16 i;
srand((unsigned) (time(NULL))); srand((unsigned) (time(nullptr)));
for(i=0;i<count;i++) for(i=0;i<count;i++)
{ {

View File

@ -84,7 +84,7 @@ static void InitSymbolPath( PSTR lpszSymbolPath, PCSTR lpszIniPath )
} }
// Add user defined path // Add user defined path
if ( lpszIniPath != NULL ) if ( lpszIniPath != nullptr )
if ( lpszIniPath[0] != '\0' ) if ( lpszIniPath[0] != '\0' )
{ {
strcat( lpszSymbolPath, ";" ); strcat( lpszSymbolPath, ";" );
@ -140,7 +140,7 @@ static BOOL GetFunctionInfoFromAddresses( ULONG fnAddress, ULONG stackAddress, L
DWORD dwSymSize = 10000; DWORD dwSymSize = 10000;
TCHAR lpszUnDSymbol[BUFFERSIZE]=_T("?"); TCHAR lpszUnDSymbol[BUFFERSIZE]=_T("?");
CHAR lpszNonUnicodeUnDSymbol[BUFFERSIZE]="?"; CHAR lpszNonUnicodeUnDSymbol[BUFFERSIZE]="?";
LPTSTR lpszParamSep = NULL; LPTSTR lpszParamSep = nullptr;
LPTSTR lpszParsed = lpszUnDSymbol; LPTSTR lpszParsed = lpszUnDSymbol;
PIMAGEHLP_SYMBOL pSym = (PIMAGEHLP_SYMBOL)GlobalAlloc( GMEM_FIXED, dwSymSize ); PIMAGEHLP_SYMBOL pSym = (PIMAGEHLP_SYMBOL)GlobalAlloc( GMEM_FIXED, dwSymSize );
@ -193,13 +193,13 @@ static BOOL GetFunctionInfoFromAddresses( ULONG fnAddress, ULONG stackAddress, L
// Let's go through the stack, and modify the function prototype, and insert the actual // Let's go through the stack, and modify the function prototype, and insert the actual
// parameter values from the stack // parameter values from the stack
if ( _tcsstr( lpszUnDSymbol, _T("(void)") ) == NULL && _tcsstr( lpszUnDSymbol, _T("()") ) == NULL) if ( _tcsstr( lpszUnDSymbol, _T("(void)") ) == nullptr && _tcsstr( lpszUnDSymbol, _T("()") ) == nullptr)
{ {
ULONG index = 0; ULONG index = 0;
for( ; ; index++ ) for( ; ; index++ )
{ {
lpszParamSep = _tcschr( lpszParsed, _T(',') ); lpszParamSep = _tcschr( lpszParsed, _T(',') );
if ( lpszParamSep == NULL ) if ( lpszParamSep == nullptr )
break; break;
*lpszParamSep = _T('\0'); *lpszParamSep = _T('\0');
@ -211,7 +211,7 @@ static BOOL GetFunctionInfoFromAddresses( ULONG fnAddress, ULONG stackAddress, L
} }
lpszParamSep = _tcschr( lpszParsed, _T(')') ); lpszParamSep = _tcschr( lpszParsed, _T(')') );
if ( lpszParamSep != NULL ) if ( lpszParamSep != nullptr )
{ {
*lpszParamSep = _T('\0'); *lpszParamSep = _T('\0');
@ -254,7 +254,7 @@ static BOOL GetSourceInfoFromAddress( UINT address, LPTSTR lpszSourceInfo )
PCSTR2LPTSTR( lineInfo.FileName, lpszFileName ); PCSTR2LPTSTR( lineInfo.FileName, lpszFileName );
TCHAR fname[_MAX_FNAME]; TCHAR fname[_MAX_FNAME];
TCHAR ext[_MAX_EXT]; TCHAR ext[_MAX_EXT];
_tsplitpath(lpszFileName, NULL, NULL, fname, ext); _tsplitpath(lpszFileName, nullptr, nullptr, fname, ext);
_stprintf( lpszSourceInfo, _T("%s%s(%d)"), fname, ext, lineInfo.LineNumber ); _stprintf( lpszSourceInfo, _T("%s%s(%d)"), fname, ext, lineInfo.LineNumber );
ret = TRUE; ret = TRUE;
} }
@ -338,11 +338,11 @@ void StackTrace( HANDLE hThread, const char* lpszMessage, FILE *file )
hProcess, hProcess,
hThread, hThread,
&callStack, &callStack,
NULL, nullptr,
NULL, nullptr,
SymFunctionTableAccess, SymFunctionTableAccess,
SymGetModuleBase, SymGetModuleBase,
NULL); nullptr);
if ( index == 0 ) if ( index == 0 )
continue; continue;
@ -393,11 +393,11 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
hProcess, hProcess,
hThread, hThread,
&callStack, &callStack,
NULL, nullptr,
NULL, nullptr,
SymFunctionTableAccess, SymFunctionTableAccess,
SymGetModuleBase, SymGetModuleBase,
NULL); nullptr);
if ( index == 0 ) if ( index == 0 )
continue; continue;

View File

@ -65,8 +65,8 @@ public:
ElementPtr *tmpptr = m_read_ptr; ElementPtr *tmpptr = m_read_ptr;
// advance the read pointer // advance the read pointer
m_read_ptr = AtomicLoad(tmpptr->next); m_read_ptr = AtomicLoad(tmpptr->next);
// set the next element to NULL to stop the recursive deletion // set the next element to nullptr to stop the recursive deletion
tmpptr->next = NULL; tmpptr->next = nullptr;
delete tmpptr; // this also deletes the element delete tmpptr; // this also deletes the element
} }
@ -81,7 +81,7 @@ public:
ElementPtr *tmpptr = m_read_ptr; ElementPtr *tmpptr = m_read_ptr;
m_read_ptr = AtomicLoadAcquire(tmpptr->next); m_read_ptr = AtomicLoadAcquire(tmpptr->next);
t = std::move(tmpptr->current); t = std::move(tmpptr->current);
tmpptr->next = NULL; tmpptr->next = nullptr;
delete tmpptr; delete tmpptr;
return true; return true;
} }
@ -100,7 +100,7 @@ private:
class ElementPtr class ElementPtr
{ {
public: public:
ElementPtr() : next(NULL) {} ElementPtr() : next(nullptr) {}
~ElementPtr() ~ElementPtr()
{ {

View File

@ -150,7 +150,7 @@ bool CreateDir(const std::string &path)
{ {
INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str()); INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str());
#ifdef _WIN32 #ifdef _WIN32
if (::CreateDirectory(UTF8ToTStr(path).c_str(), NULL)) if (::CreateDirectory(UTF8ToTStr(path).c_str(), nullptr))
return true; return true;
DWORD error = GetLastError(); DWORD error = GetLastError();
if (error == ERROR_ALREADY_EXISTS) if (error == ERROR_ALREADY_EXISTS)
@ -250,7 +250,7 @@ bool Rename(const std::string &srcFilename, const std::string &destFilename)
auto df = UTF8ToTStr(destFilename); auto df = UTF8ToTStr(destFilename);
// The Internet seems torn about whether ReplaceFile is atomic or not. // The Internet seems torn about whether ReplaceFile is atomic or not.
// Hopefully it's atomic enough... // 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; return true;
// Might have failed because the destination doesn't exist. // Might have failed because the destination doesn't exist.
if (GetLastError() == ERROR_FILE_NOT_FOUND) if (GetLastError() == ERROR_FILE_NOT_FOUND)
@ -481,7 +481,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry)
FSTEntry entry; FSTEntry entry;
const std::string virtualName(TStrToUTF8(ffd.cFileName)); const std::string virtualName(TStrToUTF8(ffd.cFileName));
#else #else
struct dirent dirent, *result = NULL; struct dirent dirent, *result = nullptr;
DIR *dirp = opendir(directory.c_str()); DIR *dirp = opendir(directory.c_str());
if (!dirp) if (!dirp)
@ -549,7 +549,7 @@ bool DeleteDirRecursively(const std::string &directory)
{ {
const std::string virtualName(TStrToUTF8(ffd.cFileName)); const std::string virtualName(TStrToUTF8(ffd.cFileName));
#else #else
struct dirent dirent, *result = NULL; struct dirent dirent, *result = nullptr;
DIR *dirp = opendir(directory.c_str()); DIR *dirp = opendir(directory.c_str());
if (!dirp) if (!dirp)
return false; 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)); const std::string virtualName(TStrToUTF8(ffd.cFileName));
#else #else
struct dirent dirent, *result = NULL; struct dirent dirent, *result = nullptr;
DIR *dirp = opendir(source_path.c_str()); DIR *dirp = opendir(source_path.c_str());
if (!dirp) return; if (!dirp) return;
@ -660,11 +660,11 @@ std::string GetCurrentDir()
{ {
char *dir; char *dir;
// Get the current working directory (getcwd uses malloc) // Get the current working directory (getcwd uses malloc)
if (!(dir = __getcwd(NULL, 0))) { if (!(dir = __getcwd(nullptr, 0))) {
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s",
GetLastErrorMsg()); GetLastErrorMsg());
return NULL; return nullptr;
} }
std::string strDir = dir; std::string strDir = dir;
free(dir); free(dir);
@ -682,11 +682,11 @@ std::string GetTempFilenameForAtomicWrite(const std::string &path)
std::string abs = path; std::string abs = path;
#ifdef _WIN32 #ifdef _WIN32
TCHAR absbuf[MAX_PATH]; 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); abs = TStrToUTF8(absbuf);
#else #else
char absbuf[PATH_MAX]; char absbuf[PATH_MAX];
if (realpath(path.c_str(), absbuf) != NULL) if (realpath(path.c_str(), absbuf) != nullptr)
abs = absbuf; abs = absbuf;
#endif #endif
return abs + ".xxx"; return abs + ".xxx";
@ -715,7 +715,7 @@ std::string& GetExeDirectory()
if (DolphinPath.empty()) if (DolphinPath.empty())
{ {
TCHAR Dolphin_exe_Path[2048]; TCHAR Dolphin_exe_Path[2048];
GetModuleFileName(NULL, Dolphin_exe_Path, 2048); GetModuleFileName(nullptr, Dolphin_exe_Path, 2048);
DolphinPath = TStrToUTF8(Dolphin_exe_Path); DolphinPath = TStrToUTF8(Dolphin_exe_Path);
DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of('\\')); 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; HKEY hkey;
DWORD local = 0; DWORD local = 0;
TCHAR configPath[MAX_PATH] = {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; DWORD size = 4;
if (RegQueryValueEx(hkey, TEXT("LocalUserConfig"), NULL, NULL, reinterpret_cast<LPBYTE>(&local), &size) != ERROR_SUCCESS) if (RegQueryValueEx(hkey, TEXT("LocalUserConfig"), nullptr, nullptr, reinterpret_cast<LPBYTE>(&local), &size) != ERROR_SUCCESS)
local = 0; local = 0;
size = MAX_PATH; 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; configPath[0] = 0;
RegCloseKey(hkey); 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. // Get Program Files path in case we need it.
TCHAR my_documents[MAX_PATH]; 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 if (local) // Case 1-2
paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP; 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() IOFile::IOFile()
: m_file(NULL), m_good(true) : m_file(nullptr), m_good(true)
{} {}
IOFile::IOFile(std::FILE* file) IOFile::IOFile(std::FILE* file)
@ -968,7 +968,7 @@ IOFile::IOFile(std::FILE* file)
{} {}
IOFile::IOFile(const std::string& filename, const char openmode[]) IOFile::IOFile(const std::string& filename, const char openmode[])
: m_file(NULL), m_good(true) : m_file(nullptr), m_good(true)
{ {
Open(filename, openmode); Open(filename, openmode);
} }
@ -979,7 +979,7 @@ IOFile::~IOFile()
} }
IOFile::IOFile(IOFile&& other) IOFile::IOFile(IOFile&& other)
: m_file(NULL), m_good(true) : m_file(nullptr), m_good(true)
{ {
Swap(other); Swap(other);
} }
@ -1014,14 +1014,14 @@ bool IOFile::Close()
if (!IsOpen() || 0 != std::fclose(m_file)) if (!IsOpen() || 0 != std::fclose(m_file))
m_good = false; m_good = false;
m_file = NULL; m_file = nullptr;
return m_good; return m_good;
} }
std::FILE* IOFile::ReleaseHandle() std::FILE* IOFile::ReleaseHandle()
{ {
std::FILE* const ret = m_file; std::FILE* const ret = m_file;
m_file = NULL; m_file = nullptr;
return ret; return ret;
} }

View File

@ -167,7 +167,7 @@ public:
bool Close(); bool Close();
template <typename T> template <typename T>
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; size_t read_bytes = 0;
if (!IsOpen() || length != (read_bytes = std::fread(data, sizeof(T), length, m_file))) if (!IsOpen() || length != (read_bytes = std::fread(data, sizeof(T), length, m_file)))
@ -198,11 +198,11 @@ public:
return WriteArray(reinterpret_cast<const char*>(data), length); return WriteArray(reinterpret_cast<const char*>(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 // m_good is set to false when a read, write or other function fails
bool IsGood() { return m_good; } bool IsGood() { return m_good; }
operator void*() { return m_good ? m_file : NULL; } operator void*() { return m_good ? m_file : nullptr; }
std::FILE* ReleaseHandle(); std::FILE* ReleaseHandle();

View File

@ -212,7 +212,7 @@ const IniFile::Section* IniFile::GetSection(const std::string& sectionName) cons
for (const Section& sect : sections) for (const Section& sect : sections)
if (!strcasecmp(sect.name.c_str(), sectionName.c_str())) if (!strcasecmp(sect.name.c_str(), sectionName.c_str()))
return (&(sect)); return (&(sect));
return 0; return nullptr;
} }
IniFile::Section* IniFile::GetSection(const std::string& sectionName) IniFile::Section* IniFile::GetSection(const std::string& sectionName)
@ -220,7 +220,7 @@ IniFile::Section* IniFile::GetSection(const std::string& sectionName)
for (Section& sect : sections) for (Section& sect : sections)
if (!strcasecmp(sect.name.c_str(), sectionName.c_str())) if (!strcasecmp(sect.name.c_str(), sectionName.c_str()))
return (&(sect)); return (&(sect));
return 0; return nullptr;
} }
IniFile::Section* IniFile::GetOrCreateSection(const std::string& sectionName) 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; if (in.fail()) return false;
Section* current_section = NULL; Section* current_section = nullptr;
while (!in.eof()) while (!in.eof())
{ {
char templine[MAX_BYTES]; char templine[MAX_BYTES];

View File

@ -70,7 +70,7 @@ public:
// good header, read some key/value pairs // good header, read some key/value pairs
K key; K key;
V *value = NULL; V *value = nullptr;
u32 value_size; u32 value_size;
u32 entry_number; u32 entry_number;

View File

@ -30,7 +30,7 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
va_end(args); va_end(args);
} }
LogManager *LogManager::m_logManager = NULL; LogManager *LogManager::m_logManager = nullptr;
LogManager::LogManager() LogManager::LogManager()
{ {
@ -145,7 +145,7 @@ void LogManager::Init()
void LogManager::Shutdown() void LogManager::Shutdown()
{ {
delete m_logManager; delete m_logManager;
m_logManager = NULL; m_logManager = nullptr;
} }
LogContainer::LogContainer(const char* shortName, const char* fullName, bool enable) LogContainer::LogContainer(const char* shortName, const char* fullName, bool enable)

View File

@ -52,7 +52,7 @@ int AshmemCreateFileMapping(const char *name, size_t size)
void MemArena::GrabLowMemSpace(size_t size) void MemArena::GrabLowMemSpace(size_t size)
{ {
#ifdef _WIN32 #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) #elif defined(ANDROID)
fd = AshmemCreateFileMapping("Dolphin-emu", size); fd = AshmemCreateFileMapping("Dolphin-emu", size);
if (fd < 0) 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++) for (int i = 0; i < num_views; i++)
{ {
if (views[i].out_ptr_low) if (views[i].out_ptr_low)
*views[i].out_ptr_low = 0; *views[i].out_ptr_low = nullptr;
if (views[i].out_ptr) if (views[i].out_ptr)
*views[i].out_ptr = 0; *views[i].out_ptr = nullptr;
} }
int i; 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."); PanicAlert("MemoryMap_Setup: Failed finding a memory base.");
exit(0); exit(0);
return 0; return nullptr;
} }
#else #else
#ifdef _WIN32 #ifdef _WIN32
// Try a whole range of possible bases. Return once we got a valid one. // Try a whole range of possible bases. Return once we got a valid one.
u32 max_base_addr = 0x7FFF0000 - 0x31000000; 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) 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); arena->ReleaseView(*outptr, view->size);
freeset.insert(*outptr); freeset.insert(*outptr);
*outptr = NULL; *outptr = nullptr;
} }
} }
} }

View File

@ -31,7 +31,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
#if defined(_WIN32) #if defined(_WIN32)
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#else #else
static char *map_hint = 0; static char *map_hint = nullptr;
#if defined(__x86_64__) && !defined(MAP_32BIT) #if defined(__x86_64__) && !defined(MAP_32BIT)
// This OS has no flag to enforce allocation below the 4 GB boundary, // 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 // 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 defined(__FreeBSD__)
if (ptr == MAP_FAILED) if (ptr == MAP_FAILED)
{ {
ptr = NULL; ptr = nullptr;
#else #else
if (ptr == NULL) if (ptr == nullptr)
{ {
#endif #endif
PanicAlert("Failed to allocate executable memory"); PanicAlert("Failed to allocate executable memory");
@ -88,14 +88,14 @@ void* AllocateMemoryPages(size_t size)
#ifdef _WIN32 #ifdef _WIN32
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE); void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
#else #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); MAP_ANON | MAP_PRIVATE, -1, 0);
#endif #endif
// printf("Mapped memory at %p (size %ld)\n", ptr, // printf("Mapped memory at %p (size %ld)\n", ptr,
// (unsigned long)size); // (unsigned long)size);
if (ptr == NULL) if (ptr == nullptr)
PanicAlert("Failed to allocate raw memory"); PanicAlert("Failed to allocate raw memory");
return ptr; return ptr;
@ -106,7 +106,7 @@ void* AllocateAlignedMemory(size_t size,size_t alignment)
#ifdef _WIN32 #ifdef _WIN32
void* ptr = _aligned_malloc(size,alignment); void* ptr = _aligned_malloc(size,alignment);
#else #else
void* ptr = NULL; void* ptr = nullptr;
#ifdef ANDROID #ifdef ANDROID
ptr = memalign(alignment, size); ptr = memalign(alignment, size);
#else #else
@ -118,7 +118,7 @@ void* AllocateAlignedMemory(size_t size,size_t alignment)
// printf("Mapped memory at %p (size %ld)\n", ptr, // printf("Mapped memory at %p (size %ld)\n", ptr,
// (unsigned long)size); // (unsigned long)size);
if (ptr == NULL) if (ptr == nullptr)
PanicAlert("Failed to allocate aligned memory"); PanicAlert("Failed to allocate aligned memory");
return ptr; return ptr;
@ -185,7 +185,7 @@ std::string MemUsage()
// Print information about the memory usage of the process. // Print information about the memory usage of the process.
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); 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))) if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc)))
Ret = StringFromFormat("%s K", ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str()); Ret = StringFromFormat("%s K", ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str());

View File

@ -21,9 +21,9 @@ const char* GetLastErrorMsg()
#ifdef _WIN32 #ifdef _WIN32
static __declspec(thread) char err_str[buff_size] = {}; 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), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
err_str, buff_size, NULL); err_str, buff_size, nullptr);
#else #else
static __thread char err_str[buff_size] = {}; static __thread char err_str[buff_size] = {};

View File

@ -72,9 +72,9 @@ public:
#if defined(_WIN32) && defined(USE_CONDITION_VARIABLES) #if defined(_WIN32) && defined(USE_CONDITION_VARIABLES)
InitializeConditionVariable(&m_handle); InitializeConditionVariable(&m_handle);
#elif defined(_WIN32) #elif defined(_WIN32)
m_handle = CreateEvent(NULL, false, false, NULL); m_handle = CreateEvent(nullptr, false, false, nullptr);
#else #else
pthread_cond_init(&m_handle, NULL); pthread_cond_init(&m_handle, nullptr);
#endif #endif
} }

View File

@ -143,7 +143,7 @@ public:
#ifdef _WIN32 #ifdef _WIN32
InitializeSRWLock(&m_handle); InitializeSRWLock(&m_handle);
#else #else
pthread_mutex_init(&m_handle, NULL); pthread_mutex_init(&m_handle, nullptr);
#endif #endif
} }
@ -238,7 +238,7 @@ public:
typedef Mutex mutex_type; typedef Mutex mutex_type;
unique_lock() unique_lock()
: pm(NULL), owns(false) : pm(nullptr), owns(false)
{} {}
/*explicit*/ unique_lock(mutex_type& m) /*explicit*/ unique_lock(mutex_type& m)
@ -290,11 +290,11 @@ public:
unique_lock(const unique_lock&) /*= delete*/; unique_lock(const unique_lock&) /*= delete*/;
unique_lock(unique_lock&& other) unique_lock(unique_lock&& other)
: pm(NULL), owns(false) : pm(nullptr), owns(false)
{ {
#else #else
unique_lock(const unique_lock& u) unique_lock(const unique_lock& u)
: pm(NULL), owns(false) : pm(nullptr), owns(false)
{ {
// ugly const_cast to get around lack of rvalue references // ugly const_cast to get around lack of rvalue references
unique_lock& other = const_cast<unique_lock&>(u); unique_lock& other = const_cast<unique_lock&>(u);
@ -335,7 +335,7 @@ public:
{ {
auto const ret = mutex(); auto const ret = mutex();
pm = NULL; pm = nullptr;
owns = false; owns = false;
return ret; return ret;

View File

@ -193,7 +193,7 @@ public:
WaitForSingleObject(m_handle, INFINITE); WaitForSingleObject(m_handle, INFINITE);
detach(); detach();
#else #else
pthread_join(m_id.m_thread, NULL); pthread_join(m_id.m_thread, nullptr);
m_id = id(); m_id = id();
#endif #endif
} }
@ -238,9 +238,9 @@ private:
void StartThread(F* param) void StartThread(F* param)
{ {
#ifdef USE_BEGINTHREADEX #ifdef USE_BEGINTHREADEX
m_handle = (HANDLE)_beginthreadex(NULL, 0, &RunAndDelete<F>, param, 0, &m_id.m_thread); m_handle = (HANDLE)_beginthreadex(nullptr, 0, &RunAndDelete<F>, param, 0, &m_id.m_thread);
#elif defined(_WIN32) #elif defined(_WIN32)
m_handle = CreateThread(NULL, 0, &RunAndDelete<F>, param, 0, &m_id.m_thread); m_handle = CreateThread(nullptr, 0, &RunAndDelete<F>, param, 0, &m_id.m_thread);
#else #else
pthread_attr_t attr; pthread_attr_t attr;
pthread_attr_init(&attr); pthread_attr_init(&attr);

View File

@ -28,7 +28,7 @@
// faster than sscanf // faster than sscanf
bool AsciiToHex(const char* _szValue, u32& result) bool AsciiToHex(const char* _szValue, u32& result)
{ {
char *endptr = NULL; char *endptr = nullptr;
const u32 value = strtoul(_szValue, &endptr, 16); const u32 value = strtoul(_szValue, &endptr, 16);
if (!endptr || *endptr) 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. // will be present in the middle of a multibyte sequence.
// //
// This is why we lookup an ANSI (cp1252) locale here and use _vsnprintf_l. // 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) if (!c_locale)
c_locale = _create_locale(LC_ALL, ".1252"); c_locale = _create_locale(LC_ALL, ".1252");
writtenCount = _vsnprintf_l(out, outsize, format, c_locale, args); 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, ...) std::string StringFromFormat(const char* format, ...)
{ {
va_list args; va_list args;
char *buf = NULL; char *buf = nullptr;
#ifdef _WIN32 #ifdef _WIN32
int required = 0; int required = 0;
@ -159,7 +159,7 @@ std::string StripQuotes(const std::string& s)
bool TryParse(const std::string &str, u32 *const output) bool TryParse(const std::string &str, u32 *const output)
{ {
char *endptr = NULL; char *endptr = nullptr;
// Reset errno to a value other than ERANGE // Reset errno to a value other than ERANGE
errno = 0; errno = 0;

View File

@ -46,7 +46,7 @@ Symbol *SymbolDB::GetSymbolFromName(const char *name)
if (!strcmp(func.second.name.c_str(), name)) if (!strcmp(func.second.name.c_str(), name))
return &func.second; return &func.second;
} }
return 0; return nullptr;
} }
void SymbolDB::AddCompleteSymbol(const Symbol &symbol) void SymbolDB::AddCompleteSymbol(const Symbol &symbol)

View File

@ -79,8 +79,8 @@ protected:
public: public:
SymbolDB() {} SymbolDB() {}
virtual ~SymbolDB() {} virtual ~SymbolDB() {}
virtual Symbol *GetSymbolFromAddr(u32 addr) { return 0; } virtual Symbol *GetSymbolFromAddr(u32 addr) { return nullptr; }
virtual Symbol *AddFunction(u32 startAddr) { return 0;} virtual Symbol *AddFunction(u32 startAddr) { return nullptr;}
void AddCompleteSymbol(const Symbol &symbol); void AddCompleteSymbol(const Symbol &symbol);
@ -90,7 +90,7 @@ public:
if (iter != checksumToFunction.end()) if (iter != checksumToFunction.end())
return iter->second; return iter->second;
else else
return 0; return nullptr;
} }
const XFuncMap &Symbols() const {return functions;} const XFuncMap &Symbols() const {return functions;}

View File

@ -27,7 +27,7 @@ u32 Timer::GetTimeMs()
return timeGetTime(); return timeGetTime();
#else #else
struct timeval t; struct timeval t;
(void)gettimeofday(&t, NULL); (void)gettimeofday(&t, nullptr);
return ((u32)(t.tv_sec * 1000 + t.tv_usec / 1000)); return ((u32)(t.tv_sec * 1000 + t.tv_usec / 1000));
#endif #endif
} }
@ -184,7 +184,7 @@ std::string Timer::GetTimeFormatted()
return StringFromFormat("%s:%03i", tmp, tp.millitm); return StringFromFormat("%s:%03i", tmp, tp.millitm);
#else #else
struct timeval t; struct timeval t;
(void)gettimeofday(&t, NULL); (void)gettimeofday(&t, nullptr);
return StringFromFormat("%s:%03d", tmp, (int)(t.tv_usec / 1000)); return StringFromFormat("%s:%03d", tmp, (int)(t.tv_usec / 1000));
#endif #endif
} }
@ -198,7 +198,7 @@ double Timer::GetDoubleTime()
(void)::ftime(&tp); (void)::ftime(&tp);
#else #else
struct timeval t; struct timeval t;
(void)gettimeofday(&t, NULL); (void)gettimeofday(&t, nullptr);
#endif #endif
// Get continuous timestamp // Get continuous timestamp
u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970(); u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970();

View File

@ -265,7 +265,7 @@ protected:
inline void Write64(u64 value) {*(u64*)code = (value); code += 8;} inline void Write64(u64 value) {*(u64*)code = (value); code += 8;}
public: public:
XEmitter() { code = NULL; } XEmitter() { code = nullptr; }
XEmitter(u8 *code_ptr) { code = code_ptr; } XEmitter(u8 *code_ptr) { code = code_ptr; }
virtual ~XEmitter() {} virtual ~XEmitter() {}
@ -773,7 +773,7 @@ protected:
size_t region_size; size_t region_size;
public: public:
XCodeBlock() : region(NULL), region_size(0) {} XCodeBlock() : region(nullptr), region_size(0) {}
virtual ~XCodeBlock() { if (region) FreeCodeSpace(); } virtual ~XCodeBlock() { if (region) FreeCodeSpace(); }
// Call this before you generate any code. // Call this before you generate any code.
@ -797,7 +797,7 @@ public:
void FreeCodeSpace() void FreeCodeSpace()
{ {
FreeMemoryPages(region, region_size); FreeMemoryPages(region, region_size);
region = NULL; region = nullptr;
region_size = 0; region_size = 0;
} }

View File

@ -72,7 +72,7 @@ enum
}; };
// pointer to the code currently being run, (used by log messages that include the code name) // 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 bool b_RanOnce = false;
static std::vector<ARCode> arCodes; static std::vector<ARCode> arCodes;

View File

@ -81,6 +81,6 @@ void InstallExceptionHandler()
sa.sa_sigaction = &sigsegv_handler; sa.sa_sigaction = &sigsegv_handler;
sa.sa_flags = SA_SIGINFO; sa.sa_flags = SA_SIGINFO;
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
sigaction(SIGSEGV, &sa, NULL); sigaction(SIGSEGV, &sa, nullptr);
} }
} // namespace } // namespace

View File

@ -125,7 +125,7 @@ bool CBoot::FindMapFile(std::string* existing_map_file,
bool CBoot::LoadMapFromFilename() bool CBoot::LoadMapFromFilename()
{ {
std::string strMapFilename; std::string strMapFilename;
bool found = FindMapFile(&strMapFilename, NULL); bool found = FindMapFile(&strMapFilename, nullptr);
if (found && g_symbolDB.LoadMap(strMapFilename.c_str())) if (found && g_symbolDB.LoadMap(strMapFilename.c_str()))
{ {
UpdateDebugger_MapLoaded(); UpdateDebugger_MapLoaded();
@ -201,7 +201,7 @@ bool CBoot::BootUp()
case SCoreStartupParameter::BOOT_ISO: case SCoreStartupParameter::BOOT_ISO:
{ {
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_StartupPara.m_strFilename); DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_StartupPara.m_strFilename);
if (pVolume == NULL) if (pVolume == nullptr)
break; break;
bool isoWii = DiscIO::IsVolumeWiiDisc(pVolume); bool isoWii = DiscIO::IsVolumeWiiDisc(pVolume);

View File

@ -30,10 +30,10 @@ public:
// Tries to find a map file for the current game by looking first in the // Tries to find a map file for the current game by looking first in the
// local user directory, then in the shared user directory. // 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. // 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. // file should be saved.
// //
// Returns true if a map file exists, false if none could be found. // Returns true if a map file exists, false if none could be found.
@ -43,7 +43,7 @@ public:
private: private:
static void RunFunction(u32 _iAddr); 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 LoadMapFromFilename();
static bool Boot_ELF(const char *filename); static bool Boot_ELF(const char *filename);

View File

@ -34,13 +34,13 @@ CDolLoader::~CDolLoader()
for (auto& sect : text_section) for (auto& sect : text_section)
{ {
delete [] sect; delete [] sect;
sect = NULL; sect = nullptr;
} }
for (auto& sect : data_section) for (auto& sect : data_section)
{ {
delete [] sect; delete [] sect;
sect = NULL; sect = nullptr;
} }
} }
@ -54,9 +54,9 @@ void CDolLoader::Initialize(u8* _pBuffer, u32 _Size)
p[i] = Common::swap32(p[i]); p[i] = Common::swap32(p[i]);
for (auto& sect : text_section) for (auto& sect : text_section)
sect = NULL; sect = nullptr;
for (auto& sect : data_section) for (auto& sect : data_section)
sect = NULL; sect = nullptr;
u32 HID4_pattern = 0x7c13fba6; u32 HID4_pattern = 0x7c13fba6;
u32 HID4_mask = 0xfc1fffff; u32 HID4_mask = 0xfc1fffff;

View File

@ -90,7 +90,7 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename)
// DOL // DOL
const DiscIO::SNANDContent* pContent = ContentLoader.GetContentByIndex(ContentLoader.GetBootIndex()); const DiscIO::SNANDContent* pContent = ContentLoader.GetContentByIndex(ContentLoader.GetBootIndex());
if (pContent == NULL) if (pContent == nullptr)
return false; return false;
WII_IPC_HLE_Interface::SetDefaultContentFile(_pFilename); WII_IPC_HLE_Interface::SetDefaultContentFile(_pFilename);
@ -119,7 +119,7 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename)
// Load patches and run startup patches // Load patches and run startup patches
const DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_pFilename); const DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_pFilename);
if (pVolume != NULL) if (pVolume != nullptr)
PatchEngine::LoadPatches(); PatchEngine::LoadPatches();
return true; return true;

View File

@ -82,7 +82,7 @@ ElfReader::ElfReader(void *ptr)
const char *ElfReader::GetSectionName(int section) const const char *ElfReader::GetSectionName(int section) const
{ {
if (sections[section].sh_type == SHT_NULL) if (sections[section].sh_type == SHT_NULL)
return NULL; return nullptr;
int nameOffset = sections[section].sh_name; int nameOffset = sections[section].sh_name;
char *ptr = (char*)GetSectionDataPtr(header->e_shstrndx); char *ptr = (char*)GetSectionDataPtr(header->e_shstrndx);
@ -90,7 +90,7 @@ const char *ElfReader::GetSectionName(int section) const
if (ptr) if (ptr)
return ptr + nameOffset; return ptr + nameOffset;
else else
return NULL; return nullptr;
} }
bool ElfReader::LoadInto(u32 vaddr) bool ElfReader::LoadInto(u32 vaddr)
@ -181,7 +181,7 @@ SectionID ElfReader::GetSectionByName(const char *name, int firstSection) const
{ {
const char *secname = GetSectionName(i); const char *secname = GetSectionName(i);
if (secname != NULL && strcmp(name, secname) == 0) if (secname != nullptr && strcmp(name, secname) == 0)
return i; return i;
} }
return -1; return -1;

View File

@ -51,11 +51,11 @@ public:
const u8 *GetSectionDataPtr(int section) const const u8 *GetSectionDataPtr(int section) const
{ {
if (section < 0 || section >= header->e_shnum) if (section < 0 || section >= header->e_shnum)
return 0; return nullptr;
if (sections[section].sh_type != SHT_NOBITS) if (sections[section].sh_type != SHT_NOBITS)
return GetPtr(sections[section].sh_offset); return GetPtr(sections[section].sh_offset);
else else
return 0; return nullptr;
} }
bool IsCodeSection(int section) const bool IsCodeSection(int section) const
{ {

View File

@ -125,7 +125,7 @@ void SConfig::Init()
void SConfig::Shutdown() void SConfig::Shutdown()
{ {
delete m_Instance; delete m_Instance;
m_Instance = NULL; m_Instance = nullptr;
} }
SConfig::~SConfig() SConfig::~SConfig()

View File

@ -79,7 +79,7 @@ void EmuThread();
bool g_bStopping = false; bool g_bStopping = false;
bool g_bHwInit = false; bool g_bHwInit = false;
bool g_bStarted = false; bool g_bStarted = false;
void *g_pWindowHandle = NULL; void *g_pWindowHandle = nullptr;
std::string g_stateFileName; std::string g_stateFileName;
std::thread g_EmuThread; std::thread g_EmuThread;

View File

@ -21,7 +21,7 @@
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
SCoreStartupParameter::SCoreStartupParameter() SCoreStartupParameter::SCoreStartupParameter()
: hInstance(0), : hInstance(nullptr),
bEnableDebugging(false), bAutomaticStart(false), bBootToPause(false), bEnableDebugging(false), bAutomaticStart(false), bBootToPause(false),
bJITNoBlockCache(false), bJITBlockLinking(true), bJITNoBlockCache(false), bJITBlockLinking(true),
bJITOff(false), bJITOff(false),
@ -125,7 +125,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
} }
std::string Extension; std::string Extension;
SplitPath(m_strFilename, NULL, NULL, &Extension); SplitPath(m_strFilename, nullptr, nullptr, &Extension);
if (!strcasecmp(Extension.c_str(), ".gcm") || if (!strcasecmp(Extension.c_str(), ".gcm") ||
!strcasecmp(Extension.c_str(), ".iso") || !strcasecmp(Extension.c_str(), ".iso") ||
!strcasecmp(Extension.c_str(), ".wbfs") || !strcasecmp(Extension.c_str(), ".wbfs") ||
@ -135,7 +135,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
{ {
m_BootType = BOOT_ISO; m_BootType = BOOT_ISO;
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(m_strFilename); DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(m_strFilename);
if (pVolume == NULL) if (pVolume == nullptr)
{ {
if (bootDrive) if (bootDrive)
PanicAlertT("Could not read \"%s\". " PanicAlertT("Could not read \"%s\". "
@ -223,7 +223,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
const DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(m_strFilename); const DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(m_strFilename);
const DiscIO::INANDContentLoader& ContentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(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. //WAD is valid yet cannot be booted. Install instead.
u64 installed = DiscIO::CNANDContentManager::Access().Install_WiiWAD(m_strFilename); u64 installed = DiscIO::CNANDContentManager::Access().Install_WiiWAD(m_strFilename);

View File

@ -43,7 +43,7 @@ static std::mutex tsWriteLock;
Common::FifoQueue<BaseEvent, false> tsQueue; Common::FifoQueue<BaseEvent, false> tsQueue;
// event pools // event pools
Event *eventPool = 0; Event *eventPool = nullptr;
int downcount, slicelength; int downcount, slicelength;
int maxSliceLength = MAX_SLICE_LENGTH; int maxSliceLength = MAX_SLICE_LENGTH;
@ -59,7 +59,7 @@ u64 fakeTBStartTicks;
int ev_lost; int ev_lost;
void (*advanceCallback)(int cyclesExecuted) = NULL; void (*advanceCallback)(int cyclesExecuted) = nullptr;
Event* GetNewEvent() Event* GetNewEvent()
{ {
@ -236,7 +236,7 @@ void ClearPendingEvents()
void AddEventToQueue(Event* ne) void AddEventToQueue(Event* ne)
{ {
Event* prev = NULL; Event* prev = nullptr;
Event** pNext = &first; Event** pNext = &first;
for(;;) for(;;)
{ {

View File

@ -79,7 +79,7 @@ static const char *err_string[] =
}; };
DSPAssembler::DSPAssembler(const AssemblerSettings &settings) : DSPAssembler::DSPAssembler(const AssemblerSettings &settings) :
gdg_buffer(NULL), gdg_buffer(nullptr),
m_cur_addr(0), m_cur_addr(0),
m_cur_pass(0), m_cur_pass(0),
m_current_param(0), m_current_param(0),
@ -127,7 +127,7 @@ bool DSPAssembler::Assemble(const char *text, std::vector<u16> &code, std::vecto
if(gdg_buffer) { if(gdg_buffer) {
free(gdg_buffer); free(gdg_buffer);
gdg_buffer = NULL; gdg_buffer = nullptr;
} }
last_error_str = "(no errors)"; last_error_str = "(no errors)";
@ -310,7 +310,7 @@ char *DSPAssembler::FindBrackets(char *src, char *dst)
} }
if (count) if (count)
ShowError(ERR_NO_MATCHING_BRACKETS); ShowError(ERR_NO_MATCHING_BRACKETS);
return NULL; return nullptr;
} }
// Bizarre in-place expression evaluator. // Bizarre in-place expression evaluator.
@ -323,7 +323,7 @@ u32 DSPAssembler::ParseExpression(const char *ptr)
char *s_buffer = (char *)malloc(1024); char *s_buffer = (char *)malloc(1024);
strcpy(s_buffer, ptr); strcpy(s_buffer, ptr);
while ((pbuf = FindBrackets(s_buffer, d_buffer)) != NULL) while ((pbuf = FindBrackets(s_buffer, d_buffer)) != nullptr)
{ {
val = ParseExpression(d_buffer); val = ParseExpression(d_buffer);
sprintf(d_buffer, "%s%d%s", s_buffer, val, pbuf); sprintf(d_buffer, "%s%d%s", s_buffer, val, pbuf);
@ -359,14 +359,14 @@ u32 DSPAssembler::ParseExpression(const char *ptr)
d_buffer[i] = c; d_buffer[i] = c;
} }
while ((pbuf = strstr(d_buffer, "+")) != NULL) while ((pbuf = strstr(d_buffer, "+")) != nullptr)
{ {
*pbuf = 0x0; *pbuf = 0x0;
val = ParseExpression(d_buffer) + ParseExpression(pbuf+1); val = ParseExpression(d_buffer) + ParseExpression(pbuf+1);
sprintf(d_buffer, "%d", val); sprintf(d_buffer, "%d", val);
} }
while ((pbuf = strstr(d_buffer, "-")) != NULL) while ((pbuf = strstr(d_buffer, "-")) != nullptr)
{ {
*pbuf = 0x0; *pbuf = 0x0;
val = ParseExpression(d_buffer) - ParseExpression(pbuf+1); val = ParseExpression(d_buffer) - ParseExpression(pbuf+1);
@ -378,28 +378,28 @@ u32 DSPAssembler::ParseExpression(const char *ptr)
sprintf(d_buffer, "%d", val); sprintf(d_buffer, "%d", val);
} }
while ((pbuf = strstr(d_buffer, "*")) != NULL) while ((pbuf = strstr(d_buffer, "*")) != nullptr)
{ {
*pbuf = 0x0; *pbuf = 0x0;
val = ParseExpression(d_buffer) * ParseExpression(pbuf+1); val = ParseExpression(d_buffer) * ParseExpression(pbuf+1);
sprintf(d_buffer, "%d", val); sprintf(d_buffer, "%d", val);
} }
while ((pbuf = strstr(d_buffer, "/")) != NULL) while ((pbuf = strstr(d_buffer, "/")) != nullptr)
{ {
*pbuf = 0x0; *pbuf = 0x0;
val = ParseExpression(d_buffer) / ParseExpression(pbuf+1); val = ParseExpression(d_buffer) / ParseExpression(pbuf+1);
sprintf(d_buffer, "%d", val); sprintf(d_buffer, "%d", val);
} }
while ((pbuf = strstr(d_buffer, "|")) != NULL) while ((pbuf = strstr(d_buffer, "|")) != nullptr)
{ {
*pbuf = 0x0; *pbuf = 0x0;
val = ParseExpression(d_buffer) | ParseExpression(pbuf+1); val = ParseExpression(d_buffer) | ParseExpression(pbuf+1);
sprintf(d_buffer, "%d", val); sprintf(d_buffer, "%d", val);
} }
while ((pbuf = strstr(d_buffer, "&")) != NULL) while ((pbuf = strstr(d_buffer, "&")) != nullptr)
{ {
*pbuf = 0x0; *pbuf = 0x0;
val = ParseExpression(d_buffer) & ParseExpression(pbuf+1); val = ParseExpression(d_buffer) & ParseExpression(pbuf+1);
@ -420,7 +420,7 @@ u32 DSPAssembler::GetParams(char *parstr, param_t *par)
tmpstr = strtok(tmpstr, ",\x00"); tmpstr = strtok(tmpstr, ",\x00");
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
if (tmpstr == NULL) if (tmpstr == nullptr)
break; break;
tmpstr = skip_spaces(tmpstr); tmpstr = skip_spaces(tmpstr);
if (strlen(tmpstr) == 0) if (strlen(tmpstr) == 0)
@ -463,7 +463,7 @@ u32 DSPAssembler::GetParams(char *parstr, param_t *par)
par[i].type = P_VAL; par[i].type = P_VAL;
break; break;
} }
tmpstr = strtok(NULL, ",\x00"); tmpstr = strtok(nullptr, ",\x00");
} }
return count; return count;
} }
@ -493,7 +493,7 @@ const opc_t *DSPAssembler::FindOpcode(const char *opcode, u32 par_count, const o
} }
} }
ShowError(ERR_UNKNOWN_OPCODE); ShowError(ERR_UNKNOWN_OPCODE);
return NULL; return nullptr;
} }
// weird... // weird...
@ -780,8 +780,8 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass)
//printf("A: %s\n", line); //printf("A: %s\n", line);
code_line++; code_line++;
param_t params[10] = {{0, P_NONE, NULL}}; param_t params[10] = {{0, P_NONE, nullptr}};
param_t params_ext[10] = {{0, P_NONE, NULL}}; param_t params_ext[10] = {{0, P_NONE, nullptr}};
bool upper = true; bool upper = true;
for (int i = 0; i < LINEBUF_SIZE; i++) 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, " "); opcode = strtok(ptr, " ");
char *opcode_ext = NULL; char *opcode_ext = nullptr;
u32 params_count = 0; u32 params_count = 0;
u32 params_count_ext = 0; u32 params_count_ext = 0;
if (opcode) if (opcode)
{ {
if ((opcode_ext = strstr(opcode, "'")) != NULL) if ((opcode_ext = strstr(opcode, "'")) != nullptr)
{ {
opcode_ext[0] = '\0'; opcode_ext[0] = '\0';
opcode_ext++; opcode_ext++;
if (strlen(opcode_ext) == 0) if (strlen(opcode_ext) == 0)
opcode_ext = NULL; opcode_ext = nullptr;
} }
// now we have opcode and label // now we have opcode and label
params_count = 0; params_count = 0;
params_count_ext = 0; params_count_ext = 0;
char *paramstr = strtok(NULL, "\0"); char *paramstr = strtok(nullptr, "\0");
char *paramstr_ext = 0; char *paramstr_ext = nullptr;
// there is valid opcode so probably we have parameters // there is valid opcode so probably we have parameters
if (paramstr) if (paramstr)
{ {
if ((paramstr_ext = strstr(paramstr, ":")) != NULL) if ((paramstr_ext = strstr(paramstr, ":")) != nullptr)
{ {
paramstr_ext[0] = '\0'; paramstr_ext[0] = '\0';
paramstr_ext++; paramstr_ext++;
@ -899,14 +899,14 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass)
if (strcmp(opcode, "EQU") == 0) if (strcmp(opcode, "EQU") == 0)
{ {
lval = params[0].val; lval = params[0].val;
opcode = NULL; opcode = nullptr;
} }
} }
if (pass == 1) if (pass == 1)
labels.RegisterLabel(label, lval); labels.RegisterLabel(label, lval);
} }
if (opcode == NULL) if (opcode == nullptr)
continue; continue;
// check if opcode is reserved compiler word // check if opcode is reserved compiler word
@ -981,7 +981,7 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass)
VerifyParams(opc, params, params_count); VerifyParams(opc, params, params_count);
const opc_t *opc_ext = NULL; const opc_t *opc_ext = nullptr;
// Check for opcode extensions. // Check for opcode extensions.
if (opc->extended) if (opc->extended)
{ {

View File

@ -73,7 +73,7 @@ public:
// one for each word of code, indicating the source assembler code line number it came from. // 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. // If returns false, call GetErrorString to get some text to present to the user.
bool Assemble(const char *text, std::vector<u16> &code, std::vector<int> *line_numbers = NULL); bool Assemble(const char *text, std::vector<u16> &code, std::vector<int> *line_numbers = nullptr);
std::string GetErrorString() const { return last_error_str; } std::string GetErrorString() const { return last_error_str; }
err_t GetError() const { return last_error; } err_t GetError() const { return last_error; }
@ -103,8 +103,8 @@ private:
void InitPass(int pass); void InitPass(int pass);
bool AssembleFile(const char *fname, int pass); bool AssembleFile(const char *fname, int pass);
void ShowError(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 = NULL); // void ShowWarning(err_t err_code, const char *extra_info = nullptr);
char *FindBrackets(char *src, char *dst); char *FindBrackets(char *src, char *dst);
const opc_t *FindOpcode(const char *opcode, u32 par_count, const opc_t * const opcod, int opcod_size); const opc_t *FindOpcode(const char *opcode, u32 par_count, const opc_t * const opcod, int opcod_size);

View File

@ -114,7 +114,7 @@ void CodeToHeader(const std::vector<u16> &code, std::string _filename,
header.reserve(code_padded.size() * 4); header.reserve(code_padded.size() * 4);
header.append("#define NUM_UCODES 1\n\n"); header.append("#define NUM_UCODES 1\n\n");
std::string filename; 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(StringFromFormat("const char* UCODE_NAMES[NUM_UCODES] = {\"%s\"};\n\n", filename.c_str()));
header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n"); header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n");
@ -151,7 +151,7 @@ void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string>
for (u32 i = 0; i < numCodes; i++) for (u32 i = 0; i < numCodes; i++)
{ {
std::string filename; std::string filename;
if (! SplitPath(filenames->at(i), NULL, &filename, NULL)) if (! SplitPath(filenames->at(i), nullptr, &filename, nullptr))
filename = filenames->at(i); filename = filenames->at(i);
header.append(StringFromFormat("\t\"%s\",\n", filename.c_str())); header.append(StringFromFormat("\t\"%s\",\n", filename.c_str()));
} }

View File

@ -41,7 +41,7 @@ DSPBreakpoints dsp_breakpoints;
DSPCoreState core_state = DSPCORE_STOP; DSPCoreState core_state = DSPCORE_STOP;
u16 cyclesLeft = 0; u16 cyclesLeft = 0;
bool init_hax = false; bool init_hax = false;
DSPEmitter *dspjit = NULL; DSPEmitter *dspjit = nullptr;
Common::Event step_event; Common::Event step_event;
static bool LoadRom(const char *fname, int size_in_words, u16 *rom) 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.iram, DSP_IRAM_BYTE_SIZE);
FreeMemoryPages(g_dsp.dram, DSP_DRAM_BYTE_SIZE); FreeMemoryPages(g_dsp.dram, DSP_DRAM_BYTE_SIZE);
FreeMemoryPages(g_dsp.coef, DSP_COEF_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, 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; g_dsp.step_counter = 0;
cyclesLeft = 0; cyclesLeft = 0;
init_hax = false; init_hax = false;
dspjit = NULL; dspjit = nullptr;
g_dsp.irom = (u16*)AllocateMemoryPages(DSP_IROM_BYTE_SIZE); g_dsp.irom = (u16*)AllocateMemoryPages(DSP_IROM_BYTE_SIZE);
g_dsp.iram = (u16*)AllocateMemoryPages(DSP_IRAM_BYTE_SIZE); g_dsp.iram = (u16*)AllocateMemoryPages(DSP_IRAM_BYTE_SIZE);
@ -218,7 +218,7 @@ void DSPCore_Shutdown()
if(dspjit) { if(dspjit) {
delete dspjit; delete dspjit;
dspjit = NULL; dspjit = nullptr;
} }
DSPCore_FreeMemoryPages(); DSPCore_FreeMemoryPages();
} }

View File

@ -208,8 +208,8 @@ bool DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16
const u32 op1 = binbuf[*pc & 0x0fff]; const u32 op1 = binbuf[*pc & 0x0fff];
const DSPOPCTemplate *opc = NULL; const DSPOPCTemplate *opc = nullptr;
const DSPOPCTemplate *opc_ext = NULL; const DSPOPCTemplate *opc_ext = nullptr;
// find opcode // find opcode
for (int j = 0; j < opcodes_size; j++) 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; 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) if (!opc)
opc = &fake_op; opc = &fake_op;

View File

@ -18,7 +18,7 @@ using namespace Gen;
DSPEmitter::DSPEmitter() : gpr(*this), storeIndex(-1), storeIndex2(-1) DSPEmitter::DSPEmitter() : gpr(*this), storeIndex(-1), storeIndex2(-1)
{ {
m_compiledCode = NULL; m_compiledCode = nullptr;
AllocCodeSpace(COMPILED_CODE_SIZE); AllocCodeSpace(COMPILED_CODE_SIZE);
@ -37,7 +37,7 @@ DSPEmitter::DSPEmitter() : gpr(*this), storeIndex(-1), storeIndex2(-1)
for(int i = 0x0000; i < MAX_BLOCKS; i++) for(int i = 0x0000; i < MAX_BLOCKS; i++)
{ {
blocks[i] = (DSPCompiledCode)stubEntryPoint; blocks[i] = (DSPCompiledCode)stubEntryPoint;
blockLinks[i] = 0; blockLinks[i] = nullptr;
blockSize[i] = 0; blockSize[i] = 0;
} }
} }
@ -55,7 +55,7 @@ void DSPEmitter::ClearIRAM()
for(int i = 0x0000; i < 0x1000; i++) for(int i = 0x0000; i < 0x1000; i++)
{ {
blocks[i] = (DSPCompiledCode)stubEntryPoint; blocks[i] = (DSPCompiledCode)stubEntryPoint;
blockLinks[i] = 0; blockLinks[i] = nullptr;
blockSize[i] = 0; blockSize[i] = 0;
unresolvedJumps[i].clear(); unresolvedJumps[i].clear();
} }
@ -71,7 +71,7 @@ void DSPEmitter::ClearIRAMandDSPJITCodespaceReset()
for(int i = 0x0000; i < 0x10000; i++) for(int i = 0x0000; i < 0x10000; i++)
{ {
blocks[i] = (DSPCompiledCode)stubEntryPoint; blocks[i] = (DSPCompiledCode)stubEntryPoint;
blockLinks[i] = 0; blockLinks[i] = nullptr;
blockSize[i] = 0; blockSize[i] = 0;
unresolvedJumps[i].clear(); unresolvedJumps[i].clear();
} }
@ -345,7 +345,7 @@ void DSPEmitter::Compile(u16 start_addr)
{ {
// Mark the block to be recompiled again // Mark the block to be recompiled again
blocks[i] = (DSPCompiledCode)stubEntryPoint; blocks[i] = (DSPCompiledCode)stubEntryPoint;
blockLinks[i] = 0; blockLinks[i] = nullptr;
blockSize[i] = 0; blockSize[i] = 0;
} }
} }

View File

@ -292,7 +292,7 @@ const DSPOPCTemplate opcodes[] =
}; };
const DSPOPCTemplate cw = 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 // extended opcodes
@ -353,43 +353,43 @@ const pdlabel_t pdlabels[] =
{0xffae, "COEF_A1_7", "COEF_A1_7",}, {0xffae, "COEF_A1_7", "COEF_A1_7",},
{0xffaf, "COEF_A2_7", "COEF_A2_7",}, {0xffaf, "COEF_A2_7", "COEF_A2_7",},
{0xffb0, "0xffb0", 0,}, {0xffb0, "0xffb0", nullptr,},
{0xffb1, "0xffb1", 0,}, {0xffb1, "0xffb1", nullptr,},
{0xffb2, "0xffb2", 0,}, {0xffb2, "0xffb2", nullptr,},
{0xffb3, "0xffb3", 0,}, {0xffb3, "0xffb3", nullptr,},
{0xffb4, "0xffb4", 0,}, {0xffb4, "0xffb4", nullptr,},
{0xffb5, "0xffb5", 0,}, {0xffb5, "0xffb5", nullptr,},
{0xffb6, "0xffb6", 0,}, {0xffb6, "0xffb6", nullptr,},
{0xffb7, "0xffb7", 0,}, {0xffb7, "0xffb7", nullptr,},
{0xffb8, "0xffb8", 0,}, {0xffb8, "0xffb8", nullptr,},
{0xffb9, "0xffb9", 0,}, {0xffb9, "0xffb9", nullptr,},
{0xffba, "0xffba", 0,}, {0xffba, "0xffba", nullptr,},
{0xffbb, "0xffbb", 0,}, {0xffbb, "0xffbb", nullptr,},
{0xffbc, "0xffbc", 0,}, {0xffbc, "0xffbc", nullptr,},
{0xffbd, "0xffbd", 0,}, {0xffbd, "0xffbd", nullptr,},
{0xffbe, "0xffbe", 0,}, {0xffbe, "0xffbe", nullptr,},
{0xffbf, "0xffbf", 0,}, {0xffbf, "0xffbf", nullptr,},
{0xffc0, "0xffc0", 0,}, {0xffc0, "0xffc0", nullptr,},
{0xffc1, "0xffc1", 0,}, {0xffc1, "0xffc1", nullptr,},
{0xffc2, "0xffc2", 0,}, {0xffc2, "0xffc2", nullptr,},
{0xffc3, "0xffc3", 0,}, {0xffc3, "0xffc3", nullptr,},
{0xffc4, "0xffc4", 0,}, {0xffc4, "0xffc4", nullptr,},
{0xffc5, "0xffc5", 0,}, {0xffc5, "0xffc5", nullptr,},
{0xffc6, "0xffc6", 0,}, {0xffc6, "0xffc6", nullptr,},
{0xffc7, "0xffc7", 0,}, {0xffc7, "0xffc7", nullptr,},
{0xffc8, "0xffc8", 0,}, {0xffc8, "0xffc8", nullptr,},
{0xffc9, "DSCR", "DSP DMA Control Reg",}, {0xffc9, "DSCR", "DSP DMA Control Reg",},
{0xffca, "0xffca", 0,}, {0xffca, "0xffca", nullptr,},
{0xffcb, "DSBL", "DSP DMA Block Length",}, {0xffcb, "DSBL", "DSP DMA Block Length",},
{0xffcc, "0xffcc", 0,}, {0xffcc, "0xffcc", nullptr,},
{0xffcd, "DSPA", "DSP DMA DMEM Address",}, {0xffcd, "DSPA", "DSP DMA DMEM Address",},
{0xffce, "DSMAH", "DSP DMA Mem Address H",}, {0xffce, "DSMAH", "DSP DMA Mem Address H",},
{0xffcf, "DSMAL", "DSP DMA Mem Address L",}, {0xffcf, "DSMAL", "DSP DMA Mem Address L",},
{0xffd0, "0xffd0",0,}, {0xffd0, "0xffd0",nullptr,},
{0xffd1, "SampleFormat", "SampleFormat",}, {0xffd1, "SampleFormat", "SampleFormat",},
{0xffd2, "0xffd2",0,}, {0xffd2, "0xffd2",nullptr,},
{0xffd3, "UnkZelda", "Unk Zelda reads/writes from/to it",}, {0xffd3, "UnkZelda", "Unk Zelda reads/writes from/to it",},
{0xffd4, "ACSAH", "Accelerator start address H",}, {0xffd4, "ACSAH", "Accelerator start address H",},
{0xffd5, "ACSAL", "Accelerator start address L",}, {0xffd5, "ACSAL", "Accelerator start address L",},
@ -402,36 +402,36 @@ const pdlabel_t pdlabels[] =
{0xffdc, "yn2", "yn2",}, {0xffdc, "yn2", "yn2",},
{0xffdd, "ARAM", "Direct Read from ARAM (uses ADPCM)",}, {0xffdd, "ARAM", "Direct Read from ARAM (uses ADPCM)",},
{0xffde, "GAIN", "Gain",}, {0xffde, "GAIN", "Gain",},
{0xffdf, "0xffdf", 0,}, {0xffdf, "0xffdf", nullptr,},
{0xffe0, "0xffe0",0,}, {0xffe0, "0xffe0",nullptr,},
{0xffe1, "0xffe1",0,}, {0xffe1, "0xffe1",nullptr,},
{0xffe2, "0xffe2",0,}, {0xffe2, "0xffe2",nullptr,},
{0xffe3, "0xffe3",0,}, {0xffe3, "0xffe3",nullptr,},
{0xffe4, "0xffe4",0,}, {0xffe4, "0xffe4",nullptr,},
{0xffe5, "0xffe5",0,}, {0xffe5, "0xffe5",nullptr,},
{0xffe6, "0xffe6",0,}, {0xffe6, "0xffe6",nullptr,},
{0xffe7, "0xffe7",0,}, {0xffe7, "0xffe7",nullptr,},
{0xffe8, "0xffe8",0,}, {0xffe8, "0xffe8",nullptr,},
{0xffe9, "0xffe9",0,}, {0xffe9, "0xffe9",nullptr,},
{0xffea, "0xffea",0,}, {0xffea, "0xffea",nullptr,},
{0xffeb, "0xffeb",0,}, {0xffeb, "0xffeb",nullptr,},
{0xffec, "0xffec",0,}, {0xffec, "0xffec",nullptr,},
{0xffed, "0xffed",0,}, {0xffed, "0xffed",nullptr,},
{0xffee, "0xffee",0,}, {0xffee, "0xffee",nullptr,},
{0xffef, "AMDM", "ARAM DMA Request Mask",}, {0xffef, "AMDM", "ARAM DMA Request Mask",},
{0xfff0, "0xfff0",0,}, {0xfff0, "0xfff0",nullptr,},
{0xfff1, "0xfff1",0,}, {0xfff1, "0xfff1",nullptr,},
{0xfff2, "0xfff2",0,}, {0xfff2, "0xfff2",nullptr,},
{0xfff3, "0xfff3",0,}, {0xfff3, "0xfff3",nullptr,},
{0xfff4, "0xfff4",0,}, {0xfff4, "0xfff4",nullptr,},
{0xfff5, "0xfff5",0,}, {0xfff5, "0xfff5",nullptr,},
{0xfff6, "0xfff6",0,}, {0xfff6, "0xfff6",nullptr,},
{0xfff7, "0xfff7",0,}, {0xfff7, "0xfff7",nullptr,},
{0xfff8, "0xfff8",0,}, {0xfff8, "0xfff8",nullptr,},
{0xfff9, "0xfff9",0,}, {0xfff9, "0xfff9",nullptr,},
{0xfffa, "0xfffa",0,}, {0xfffa, "0xfffa",nullptr,},
{0xfffb, "DIRQ", "DSP IRQ Request",}, {0xfffb, "DIRQ", "DSP IRQ Request",},
{0xfffc, "DMBH", "DSP Mailbox H",}, {0xfffc, "DMBH", "DSP Mailbox H",},
{0xfffd, "DMBL", "DSP Mailbox L",}, {0xfffd, "DMBL", "DSP Mailbox L",},

View File

@ -95,7 +95,7 @@ static void WriteBlockLink(DSPEmitter& emitter, u16 dest)
// Jump directly to the called block if it has already been compiled. // Jump directly to the called block if it has already been compiled.
if (!(dest >= emitter.startAddr && dest <= emitter.compilePC)) if (!(dest >= emitter.startAddr && dest <= emitter.compilePC))
{ {
if (emitter.blockLinks[dest] != 0 ) if (emitter.blockLinks[dest] != nullptr )
{ {
emitter.gpr.flushRegs(); emitter.gpr.flushRegs();
// Check if we have enough cycles to execute the next block // Check if we have enough cycles to execute the next block

View File

@ -71,7 +71,7 @@ static void *reg_ptr(int reg)
#endif #endif
default: default:
_assert_msg_(DSPLLE, 0, "cannot happen"); _assert_msg_(DSPLLE, 0, "cannot happen");
return NULL; return nullptr;
} }
} }

View File

@ -31,7 +31,7 @@ void DSPEmitter::dsp_reg_stack_push(int stack_reg)
MOVZX(32, 8, EAX, R(AL)); MOVZX(32, 8, EAX, R(AL));
#endif #endif
MOV(16, MComplex(EAX, EAX, 1, 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); gpr.putXReg(tmp1);
} }
@ -50,7 +50,7 @@ void DSPEmitter::dsp_reg_stack_pop(int stack_reg)
MOVZX(32, 8, EAX, R(AL)); MOVZX(32, 8, EAX, R(AL));
#endif #endif
MOV(16, R(tmp1), MComplex(EAX, EAX, 1, 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)); MOV(16, M(&g_dsp.r.st[stack_reg]), R(tmp1));
gpr.putXReg(tmp1); gpr.putXReg(tmp1);

View File

@ -10,7 +10,7 @@
#include "Core/Debugger/Dump.h" #include "Core/Debugger/Dump.h"
CDump::CDump(const char* _szFilename) : CDump::CDump(const char* _szFilename) :
m_pData(NULL) m_pData(nullptr)
{ {
File::IOFile pStream(_szFilename, "rb"); File::IOFile pStream(_szFilename, "rb");
if (pStream) if (pStream)
@ -25,10 +25,10 @@ CDump::CDump(const char* _szFilename) :
CDump::~CDump(void) CDump::~CDump(void)
{ {
if (m_pData != NULL) if (m_pData != nullptr)
{ {
delete[] m_pData; delete[] m_pData;
m_pData = NULL; m_pData = nullptr;
} }
} }

View File

@ -129,7 +129,7 @@ FifoDataFile *FifoDataFile::Load(const std::string &filename, bool flagsOnly)
File::IOFile file; File::IOFile file;
file.Open(filename, "rb"); file.Open(filename, "rb");
if (!file) if (!file)
return NULL; return nullptr;
FileHeader header; FileHeader header;
file.ReadBytes(&header, sizeof(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) if (header.fileId != FILE_ID || header.min_loader_version > VERSION_NUMBER)
{ {
file.Close(); file.Close();
return NULL; return nullptr;
} }
FifoDataFile* dataFile = new FifoDataFile; FifoDataFile* dataFile = new FifoDataFile;

View File

@ -39,13 +39,13 @@ bool FifoPlayer::Open(const std::string& filename)
if (m_FileLoadedCb) if (m_FileLoadedCb)
m_FileLoadedCb(); m_FileLoadedCb();
return (m_File != NULL); return (m_File != nullptr);
} }
void FifoPlayer::Close() void FifoPlayer::Close()
{ {
delete m_File; delete m_File;
m_File = NULL; m_File = nullptr;
m_FrameRangeStart = 0; m_FrameRangeStart = 0;
m_FrameRangeEnd = 0; m_FrameRangeEnd = 0;
@ -158,9 +158,9 @@ FifoPlayer::FifoPlayer() :
m_ObjectRangeStart(0), m_ObjectRangeStart(0),
m_ObjectRangeEnd(10000), m_ObjectRangeEnd(10000),
m_EarlyMemoryUpdates(false), m_EarlyMemoryUpdates(false),
m_FileLoadedCb(NULL), m_FileLoadedCb(nullptr),
m_FrameWrittenCb(NULL), m_FrameWrittenCb(nullptr),
m_File(NULL) m_File(nullptr)
{ {
m_Loop = SConfig::GetInstance().m_LocalCoreStartupParameter.bLoopFifoReplay; m_Loop = SConfig::GetInstance().m_LocalCoreStartupParameter.bLoopFifoReplay;
} }
@ -271,7 +271,7 @@ void FifoPlayer::WriteAllMemoryUpdates()
void FifoPlayer::WriteMemory(const MemoryUpdate& memUpdate) void FifoPlayer::WriteMemory(const MemoryUpdate& memUpdate)
{ {
u8 *mem = NULL; u8 *mem = nullptr;
if (memUpdate.address & 0x10000000) if (memUpdate.address & 0x10000000)
mem = &Memory::m_pEXRAM[memUpdate.address & Memory::EXRAM_MASK]; mem = &Memory::m_pEXRAM[memUpdate.address & Memory::EXRAM_MASK];

View File

@ -16,7 +16,7 @@ using namespace FifoAnalyzer;
FifoRecordAnalyzer::FifoRecordAnalyzer() : FifoRecordAnalyzer::FifoRecordAnalyzer() :
m_DrawingObject(false), m_DrawingObject(false),
m_BpMem(NULL) m_BpMem(nullptr)
{ {
} }

View File

@ -19,13 +19,13 @@ FifoRecorder::FifoRecorder() :
m_WasRecording(false), m_WasRecording(false),
m_RequestedRecordingEnd(false), m_RequestedRecordingEnd(false),
m_RecordFramesRemaining(0), m_RecordFramesRemaining(0),
m_FinishedCb(NULL), m_FinishedCb(nullptr),
m_File(NULL), m_File(nullptr),
m_SkipNextData(true), m_SkipNextData(true),
m_SkipFutureData(true), m_SkipFutureData(true),
m_FrameEnded(false), m_FrameEnded(false),
m_Ram(NULL), m_Ram(nullptr),
m_ExRam(NULL) m_ExRam(nullptr)
{ {
} }

View File

@ -88,7 +88,7 @@ void PatchFunctions()
for (u32 i = 0; i < sizeof(OSPatches) / sizeof(SPatch); i++) for (u32 i = 0; i < sizeof(OSPatches) / sizeof(SPatch); i++)
{ {
Symbol *symbol = g_symbolDB.GetSymbolFromName(OSPatches[i].m_szPatchName); 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) 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++) for (size_t i = 1; i < sizeof(OSBreakPoints) / sizeof(SPatch); i++)
{ {
Symbol *symbol = g_symbolDB.GetSymbolFromName(OSPatches[i].m_szPatchName); Symbol *symbol = g_symbolDB.GetSymbolFromName(OSPatches[i].m_szPatchName);
if (symbol > 0) if (symbol)
{ {
PowerPC::breakpoints.Add(symbol->address, false); PowerPC::breakpoints.Add(symbol->address, false);
INFO_LOG(OSHLE, "Adding BP to %s %08x", OSBreakPoints[i].m_szPatchName, symbol->address); 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) u32 UnPatch(std::string patchName)
{ {
Symbol *symbol = g_symbolDB.GetSymbolFromName(patchName.c_str()); 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) for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4)
{ {

View File

@ -120,7 +120,7 @@ void ReadThreadHandler(CEXIETHERNET* self)
struct timeval timeout; struct timeval timeout;
timeout.tv_sec = 0; timeout.tv_sec = 0;
timeout.tv_usec = 50000; 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; continue;
int readBytes = read(self->fd, self->mRecvBuffer, BBA_RECV_SIZE); int readBytes = read(self->fd, self->mRecvBuffer, BBA_RECV_SIZE);

View File

@ -35,7 +35,7 @@ bool IsTAPDevice(const TCHAR *guid)
DWORD data_type; DWORD data_type;
len = sizeof(enum_name); 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) if (status == ERROR_NO_MORE_ITEMS)
break; break;
@ -53,13 +53,13 @@ bool IsTAPDevice(const TCHAR *guid)
else else
{ {
len = sizeof(component_id); 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); &data_type, (LPBYTE)component_id, &len);
if (!(status != ERROR_SUCCESS || data_type != REG_SZ)) if (!(status != ERROR_SUCCESS || data_type != REG_SZ))
{ {
len = sizeof(net_cfg_instance_id); 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); &data_type, (LPBYTE)net_cfg_instance_id, &len);
if (status == ERROR_SUCCESS && data_type == REG_SZ) if (status == ERROR_SUCCESS && data_type == REG_SZ)
@ -106,7 +106,7 @@ bool GetGUIDs(std::vector<std::basic_string<TCHAR>>& guids)
len = sizeof(enum_name); len = sizeof(enum_name);
status = RegEnumKeyEx(control_net_key, i, 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) if (status == ERROR_NO_MORE_ITEMS)
break; break;
@ -122,7 +122,7 @@ bool GetGUIDs(std::vector<std::basic_string<TCHAR>>& guids)
if (status == ERROR_SUCCESS) if (status == ERROR_SUCCESS)
{ {
len = sizeof(name_data); len = sizeof(name_data);
status = RegQueryValueEx(connection_key, name_string, NULL, status = RegQueryValueEx(connection_key, name_string, nullptr,
&name_type, (LPBYTE)name_data, &len); &name_type, (LPBYTE)name_data, &len);
if (status != ERROR_SUCCESS || name_type != REG_SZ) if (status != ERROR_SUCCESS || name_type != REG_SZ)
@ -199,7 +199,7 @@ bool CEXIETHERNET::Activate()
/* get driver version info */ /* get driver version info */
ULONG info[3]; ULONG info[3];
if (DeviceIoControl(mHAdapter, TAP_IOCTL_GET_VERSION, 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_LOG(SP1, "TAP-Win32 Driver Version %d.%d %s",
info[0], info[1], info[2] ? "(DEBUG)" : ""); info[0], info[1], info[2] ? "(DEBUG)" : "");
@ -217,7 +217,7 @@ bool CEXIETHERNET::Activate()
/* set driver media status to 'connected' */ /* set driver media status to 'connected' */
ULONG status = TRUE; ULONG status = TRUE;
if (!DeviceIoControl(mHAdapter, TAP_IOCTL_SET_MEDIA_STATUS, 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" ERROR_LOG(SP1, "WARNING: The TAP-Win32 driver rejected a"
"TAP_IOCTL_SET_MEDIA_STATUS DeviceIoControl call."); "TAP_IOCTL_SET_MEDIA_STATUS DeviceIoControl call.");
@ -283,7 +283,7 @@ bool CEXIETHERNET::RecvInit()
{ {
// Set up recv event // 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()); ERROR_LOG(SP1, "Failed to create recv event:%x", GetLastError());
return false; return false;

View File

@ -18,20 +18,20 @@
namespace namespace
{ {
static Common::Event m_StepEvent; static Common::Event m_StepEvent;
static Common::Event *m_SyncEvent = NULL; static Common::Event *m_SyncEvent = nullptr;
static std::mutex m_csCpuOccupied; static std::mutex m_csCpuOccupied;
} }
void CCPU::Init(int cpu_core) void CCPU::Init(int cpu_core)
{ {
PowerPC::Init(cpu_core); PowerPC::Init(cpu_core);
m_SyncEvent = NULL; m_SyncEvent = nullptr;
} }
void CCPU::Shutdown() void CCPU::Shutdown()
{ {
PowerPC::Shutdown(); PowerPC::Shutdown();
m_SyncEvent = NULL; m_SyncEvent = nullptr;
} }
void CCPU::Run() void CCPU::Run()
@ -68,7 +68,7 @@ reswitch:
if (m_SyncEvent) if (m_SyncEvent)
{ {
m_SyncEvent->Set(); m_SyncEvent->Set();
m_SyncEvent = NULL; m_SyncEvent = nullptr;
} }
Host_UpdateDisasmDialog(); Host_UpdateDisasmDialog();
break; break;

View File

@ -28,7 +28,7 @@ public:
static void Reset(); static void Reset();
// StepOpcode (Steps one Opcode) // StepOpcode (Steps one Opcode)
static void StepOpcode(Common::Event *event = 0); static void StepOpcode(Common::Event *event = nullptr);
// one step only // one step only
static void SingleStep(); static void SingleStep();

View File

@ -174,7 +174,7 @@ struct ARAMInfo
wii_mode = false; wii_mode = false;
size = ARAM_SIZE; size = ARAM_SIZE;
mask = ARAM_MASK; mask = ARAM_MASK;
ptr = NULL; ptr = nullptr;
} }
}; };
@ -282,12 +282,12 @@ void Shutdown()
if (!g_ARAM.wii_mode) if (!g_ARAM.wii_mode)
{ {
FreeMemoryPages(g_ARAM.ptr, g_ARAM.size); FreeMemoryPages(g_ARAM.ptr, g_ARAM.size);
g_ARAM.ptr = NULL; g_ARAM.ptr = nullptr;
} }
dsp_emulator->Shutdown(); dsp_emulator->Shutdown();
delete dsp_emulator; delete dsp_emulator;
dsp_emulator = NULL; dsp_emulator = nullptr;
} }
void RegisterMMIO(MMIO::Mapping* mmio, u32 base) void RegisterMMIO(MMIO::Mapping* mmio, u32 base)

View File

@ -21,7 +21,7 @@
DSPHLE::DSPHLE() DSPHLE::DSPHLE()
{ {
m_InitMixer = false; m_InitMixer = false;
soundStream = NULL; soundStream = nullptr;
} }
// Mailbox utility // Mailbox utility
@ -46,8 +46,8 @@ bool DSPHLE::Initialize(void *hWnd, bool bWii, bool bDSPThread)
{ {
m_hWnd = hWnd; m_hWnd = hWnd;
m_bWii = bWii; m_bWii = bWii;
m_pUCode = NULL; m_pUCode = nullptr;
m_lastUCode = NULL; m_lastUCode = nullptr;
m_bHalt = false; m_bHalt = false;
m_bAssertInt = false; m_bAssertInt = false;
@ -74,7 +74,7 @@ void DSPHLE::DSP_Update(int cycles)
{ {
// This is called OFTEN - better not do anything expensive! // This is called OFTEN - better not do anything expensive!
// ~1/6th as many cycles as the period PPC-side. // ~1/6th as many cycles as the period PPC-side.
if (m_pUCode != NULL) if (m_pUCode != nullptr)
m_pUCode->Update(cycles / 6); m_pUCode->Update(cycles / 6);
} }
@ -82,7 +82,7 @@ u32 DSPHLE::DSP_UpdateRate()
{ {
// AX HLE uses 3ms (Wii) or 5ms (GC) timing period // AX HLE uses 3ms (Wii) or 5ms (GC) timing period
int fields = VideoInterface::GetNumFields(); int fields = VideoInterface::GetNumFields();
if (m_pUCode != NULL) if (m_pUCode != nullptr)
return (SystemTimers::GetTicksPerSecond() / 1000) * m_pUCode->GetUpdateMs() / fields; return (SystemTimers::GetTicksPerSecond() / 1000) * m_pUCode->GetUpdateMs() / fields;
else else
return SystemTimers::GetTicksPerSecond() / 1000; return SystemTimers::GetTicksPerSecond() / 1000;
@ -90,7 +90,7 @@ u32 DSPHLE::DSP_UpdateRate()
void DSPHLE::SendMailToDSP(u32 _uMail) void DSPHLE::SendMailToDSP(u32 _uMail)
{ {
if (m_pUCode != NULL) { if (m_pUCode != nullptr) {
DEBUG_LOG(DSP_MAIL, "CPU writes 0x%08x", _uMail); DEBUG_LOG(DSP_MAIL, "CPU writes 0x%08x", _uMail);
m_pUCode->HandleMail(_uMail); m_pUCode->HandleMail(_uMail);
} }
@ -105,7 +105,7 @@ void DSPHLE::SetUCode(u32 _crc)
{ {
delete m_pUCode; delete m_pUCode;
m_pUCode = NULL; m_pUCode = nullptr;
m_MailHandler.Clear(); m_MailHandler.Clear();
m_pUCode = UCodeFactory(_crc, this, m_bWii); m_pUCode = UCodeFactory(_crc, this, m_bWii);
} }
@ -117,7 +117,7 @@ void DSPHLE::SwapUCode(u32 _crc)
{ {
m_MailHandler.Clear(); m_MailHandler.Clear();
if (m_lastUCode == NULL) if (m_lastUCode == nullptr)
{ {
m_lastUCode = m_pUCode; m_lastUCode = m_pUCode;
m_pUCode = UCodeFactory(_crc, this, m_bWii); m_pUCode = UCodeFactory(_crc, this, m_bWii);
@ -126,7 +126,7 @@ void DSPHLE::SwapUCode(u32 _crc)
{ {
delete m_pUCode; delete m_pUCode;
m_pUCode = m_lastUCode; m_pUCode = m_lastUCode;
m_lastUCode = NULL; m_lastUCode = nullptr;
} }
} }
@ -154,7 +154,7 @@ void DSPHLE::DoState(PointerWrap &p)
AudioCommon::PauseAndLock(false); AudioCommon::PauseAndLock(false);
soundStream->Stop(); soundStream->Stop();
delete soundStream; delete soundStream;
soundStream = NULL; soundStream = nullptr;
} }
} }

View File

@ -468,7 +468,7 @@ void CUCode_AX::ProcessPBList(u32 pb_addr)
ApplyUpdatesForMs(curr_ms, (u16*)&pb, pb.updates.num_updates, updates); ApplyUpdatesForMs(curr_ms, (u16*)&pb, pb.updates.num_updates, updates);
ProcessVoice(pb, buffers, spms, ConvertMixerControl(pb.mixer_control), ProcessVoice(pb, buffers, spms, ConvertMixerControl(pb.mixer_control),
m_coeffs_available ? m_coeffs : NULL); m_coeffs_available ? m_coeffs : nullptr);
// Forward the buffers // Forward the buffers
for (u32 i = 0; i < sizeof (buffers.ptrs) / sizeof (buffers.ptrs[0]); ++i) 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) void CUCode_AX::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr)
{ {
int* buffers[3] = { 0 }; int* buffers[3] = { nullptr };
switch (aux_id) switch (aux_id)
{ {

View File

@ -467,7 +467,7 @@ void CUCode_AXWii::ProcessPBList(u32 pb_addr)
ApplyUpdatesForMs(curr_ms, (u16*)&pb, num_updates, updates); ApplyUpdatesForMs(curr_ms, (u16*)&pb, num_updates, updates);
ProcessVoice(pb, buffers, 32, ProcessVoice(pb, buffers, 32,
ConvertMixerControl(HILO_TO_32(pb.mixer_control)), ConvertMixerControl(HILO_TO_32(pb.mixer_control)),
m_coeffs_available ? m_coeffs : NULL); m_coeffs_available ? m_coeffs : nullptr);
// Forward the buffers // Forward the buffers
for (u32 i = 0; i < sizeof (buffers.ptrs) / sizeof (buffers.ptrs[0]); ++i) 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, ProcessVoice(pb, buffers, 96,
ConvertMixerControl(HILO_TO_32(pb.mixer_control)), ConvertMixerControl(HILO_TO_32(pb.mixer_control)),
m_coeffs_available ? m_coeffs : NULL); m_coeffs_available ? m_coeffs : nullptr);
} }
WritePB(pb_addr, pb); 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); GenerateVolumeRamp(volume_ramp, m_last_aux_volumes[aux_id], volume, 96);
m_last_aux_volumes[aux_id] = volume; m_last_aux_volumes[aux_id] = volume;
int* buffers[3] = { 0 }; int* buffers[3] = { nullptr };
int* main_buffers[3] = { int* main_buffers[3] = {
m_samples_left, m_samples_left,
m_samples_right, m_samples_right,

View File

@ -99,7 +99,7 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii)
break; break;
} }
return NULL; return nullptr;
} }
bool IUCode::NeedsResumeMail() bool IUCode::NeedsResumeMail()

View File

@ -33,7 +33,7 @@
DSPLLE::DSPLLE() DSPLLE::DSPLLE()
{ {
soundStream = NULL; soundStream = nullptr;
m_InitMixer = false; m_InitMixer = false;
m_bIsRunning = false; m_bIsRunning = false;
m_cycle_count = 0; m_cycle_count = 0;
@ -95,7 +95,7 @@ void DSPLLE::DoState(PointerWrap &p)
AudioCommon::PauseAndLock(false); AudioCommon::PauseAndLock(false);
soundStream->Stop(); soundStream->Stop();
delete soundStream; delete soundStream;
soundStream = NULL; soundStream = nullptr;
} }
} }
} }

View File

@ -70,7 +70,7 @@ Symbol *DSPSymbolDB::GetSymbolFromAddr(u32 addr)
return &func.second; return &func.second;
} }
} }
return 0; return nullptr;
} }
// lower case only // lower case only

View File

@ -47,7 +47,7 @@ void Shutdown()
for (auto& channel : g_Channels) for (auto& channel : g_Channels)
{ {
delete channel; delete channel;
channel = NULL; channel = nullptr;
} }
} }
@ -102,7 +102,7 @@ IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex)
if (device) if (device)
return device; return device;
} }
return NULL; return nullptr;
} }
// Unused (?!) // Unused (?!)

View File

@ -87,7 +87,7 @@ void CEXIChannel::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
IEXIDevice* pDevice = GetDevice(m_Status.CHIP_SELECT ^ newStatus.CHIP_SELECT); IEXIDevice* pDevice = GetDevice(m_Status.CHIP_SELECT ^ newStatus.CHIP_SELECT);
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); pDevice->SetCS(m_Status.CHIP_SELECT);
CoreTiming::ScheduleEvent_Threadsafe_Immediate(updateInterrupts, 0); CoreTiming::ScheduleEvent_Threadsafe_Immediate(updateInterrupts, 0);
@ -110,7 +110,7 @@ void CEXIChannel::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
if (m_Control.TSTART) if (m_Control.TSTART)
{ {
IEXIDevice* pDevice = GetDevice(m_Status.CHIP_SELECT); IEXIDevice* pDevice = GetDevice(m_Status.CHIP_SELECT);
if (pDevice == NULL) if (pDevice == nullptr)
return; return;
if (m_Control.DMA == 0) if (m_Control.DMA == 0)
@ -216,7 +216,7 @@ IEXIDevice* CEXIChannel::GetDevice(const u8 chip_select)
case 2: return m_pDevices[1].get(); case 2: return m_pDevices[1].get();
case 4: return m_pDevices[2].get(); case 4: return m_pDevices[2].get();
} }
return NULL; return nullptr;
} }
void CEXIChannel::Update() void CEXIChannel::Update()
@ -273,5 +273,5 @@ IEXIDevice* CEXIChannel::FindDevice(TEXIDevices device_type, int customIndex)
if (device) if (device)
return device; return device;
} }
return NULL; return nullptr;
} }

View File

@ -90,7 +90,7 @@ public:
// F A C T O R Y // F A C T O R Y
IEXIDevice* EXIDevice_Create(TEXIDevices device_type, const int channel_num) IEXIDevice* EXIDevice_Create(TEXIDevices device_type, const int channel_num)
{ {
IEXIDevice* result = NULL; IEXIDevice* result = nullptr;
switch (device_type) switch (device_type)
{ {
@ -132,7 +132,7 @@ IEXIDevice* EXIDevice_Create(TEXIDevices device_type, const int channel_num)
break; break;
} }
if (result != NULL) if (result != nullptr)
result->m_deviceType = device_type; result->m_deviceType = device_type;
return result; return result;

View File

@ -40,7 +40,7 @@ public:
virtual void SetCS(int) {} virtual void SetCS(int) {}
virtual void DoState(PointerWrap&) {} virtual void DoState(PointerWrap&) {}
virtual void PauseAndLock(bool doLock, bool unpauseOnUnlock=true) {} 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 // Update
virtual void Update() {} virtual void Update() {}

View File

@ -130,7 +130,7 @@ CEXIIPL::~CEXIIPL()
} }
FreeMemoryPages(m_pIPL, ROM_SIZE); FreeMemoryPages(m_pIPL, ROM_SIZE);
m_pIPL = NULL; m_pIPL = nullptr;
// SRAM // SRAM
File::IOFile file(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strSRAM, "wb"); File::IOFile file(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strSRAM, "wb");

View File

@ -108,7 +108,7 @@ void innerFlush(FlushData* data)
if (!pFile) if (!pFile)
{ {
std::string dir; std::string dir;
SplitPath(data->filename, &dir, 0, 0); SplitPath(data->filename, &dir, nullptr, nullptr);
if (!File::IsDirectory(dir)) if (!File::IsDirectory(dir))
File::CreateFullPath(dir); File::CreateFullPath(dir);
pFile.Open(data->filename, "wb"); pFile.Open(data->filename, "wb");
@ -166,7 +166,7 @@ CEXIMemoryCard::~CEXIMemoryCard()
CoreTiming::RemoveEvent(et_this_card); CoreTiming::RemoveEvent(et_this_card);
Flush(true); Flush(true);
delete[] memory_card_content; delete[] memory_card_content;
memory_card_content = NULL; memory_card_content = nullptr;
if (flushThread.joinable()) if (flushThread.joinable())
{ {
@ -482,8 +482,8 @@ void CEXIMemoryCard::DoState(PointerWrap &p)
IEXIDevice* CEXIMemoryCard::FindDevice(TEXIDevices device_type, int customIndex) IEXIDevice* CEXIMemoryCard::FindDevice(TEXIDevices device_type, int customIndex)
{ {
if (device_type != m_deviceType) if (device_type != m_deviceType)
return NULL; return nullptr;
if (customIndex != card_index) if (customIndex != card_index)
return NULL; return nullptr;
return this; return this;
} }

View File

@ -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 //This function can be removed once more about hdr is known and we can check for a valid header
std::string fileType; std::string fileType;
SplitPath(filename, NULL, NULL, &fileType); SplitPath(filename, nullptr, nullptr, &fileType);
if (strcasecmp(fileType.c_str(), ".raw") && strcasecmp(fileType.c_str(), ".gcp")) 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()); 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); File::IOFile gci(gcih);
unsigned int offset; unsigned int offset;
std::string fileType; std::string fileType;
SplitPath(inputFile, NULL, NULL, &fileType); SplitPath(inputFile, nullptr, nullptr, &fileType);
if (!strcasecmp(fileType.c_str(), ".gci")) if (!strcasecmp(fileType.c_str(), ".gci"))
offset = GCI; offset = GCI;
@ -913,7 +913,7 @@ u32 GCMemcard::ExportGci(u8 index, const char *fileName, const std::string &dire
gci.Open(fileName, "wb"); gci.Open(fileName, "wb");
std::string fileType; std::string fileType;
SplitPath(fileName, NULL, NULL, &fileType); SplitPath(fileName, nullptr, nullptr, &fileType);
if (!strcasecmp(fileType.c_str(), ".gcs")) if (!strcasecmp(fileType.c_str(), ".gcs"))
{ {
offset = GCS; offset = GCS;

View File

@ -53,7 +53,7 @@ bool bMMU = false;
// Init() declarations // Init() declarations
// ---------------- // ----------------
// Store the MemArena here // Store the MemArena here
u8* base = NULL; u8* base = nullptr;
// The MemArena class // The MemArena class
MemArena g_arena; MemArena g_arena;
@ -121,8 +121,8 @@ bool IsInitialized()
static const MemoryView views[] = static const MemoryView views[] =
{ {
{&m_pRAM, &m_pPhysicalRAM, 0x00000000, RAM_SIZE, 0}, {&m_pRAM, &m_pPhysicalRAM, 0x00000000, RAM_SIZE, 0},
{NULL, &m_pVirtualCachedRAM, 0x80000000, RAM_SIZE, MV_MIRROR_PREVIOUS}, {nullptr, &m_pVirtualCachedRAM, 0x80000000, RAM_SIZE, MV_MIRROR_PREVIOUS},
{NULL, &m_pVirtualUncachedRAM, 0xC0000000, 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 // Don't map any memory for the EFB. We want all access to this area to go
// through the hardware access handlers. // through the hardware access handlers.
@ -134,8 +134,8 @@ static const MemoryView views[] =
{&m_pFakeVMEM, &m_pVirtualFakeVMEM, 0x7E000000, FAKEVMEM_SIZE, MV_FAKE_VMEM}, {&m_pFakeVMEM, &m_pVirtualFakeVMEM, 0x7E000000, FAKEVMEM_SIZE, MV_FAKE_VMEM},
{&m_pEXRAM, &m_pPhysicalEXRAM, 0x10000000, EXRAM_SIZE, MV_WII_ONLY}, {&m_pEXRAM, &m_pPhysicalEXRAM, 0x10000000, EXRAM_SIZE, MV_WII_ONLY},
{NULL, &m_pVirtualCachedEXRAM, 0x90000000, EXRAM_SIZE, MV_WII_ONLY | MV_MIRROR_PREVIOUS}, {nullptr, &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_pVirtualUncachedEXRAM, 0xD0000000, EXRAM_SIZE, MV_WII_ONLY | MV_MIRROR_PREVIOUS},
}; };
static const int num_views = sizeof(views) / sizeof(MemoryView); static const int num_views = sizeof(views) / sizeof(MemoryView);
@ -185,7 +185,7 @@ void Shutdown()
if (bFakeVMEM) flags |= MV_FAKE_VMEM; if (bFakeVMEM) flags |= MV_FAKE_VMEM;
MemoryMap_Shutdown(views, num_views, flags, &g_arena); MemoryMap_Shutdown(views, num_views, flags, &g_arena);
g_arena.ReleaseSpace(); g_arena.ReleaseSpace();
base = NULL; base = nullptr;
delete mmio_mapping; delete mmio_mapping;
INFO_LOG(MEMMAP, "Memory system shut down."); 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) void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength)
{ {
u8 *ptr = GetPointer(_Address); u8 *ptr = GetPointer(_Address);
if (ptr != NULL) if (ptr != nullptr)
{ {
memset(ptr,_iValue,_iLength); 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); const u8 *src = GetCachePtr() + (_CacheAddr & 0x3FFFF);
u8 *dst = GetPointer(_MemAddr); 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); 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); const u8 *src = GetPointer(_MemAddr);
u8 *dst = GetCachePtr() + (_CacheAddr & 0x3FFFF); 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); 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); ERROR_LOG(MEMMAP, "Unknown Pointer %#8x PC %#8x LR %#8x", _Address, PC, LR);
return NULL; return nullptr;
} }

View File

@ -434,7 +434,7 @@ void GenerateSIInterrupt(SIInterruptType _SIInterrupt)
void RemoveDevice(int _iDeviceNumber) void RemoveDevice(int _iDeviceNumber)
{ {
delete g_Channel[_iDeviceNumber].m_pDevice; delete g_Channel[_iDeviceNumber].m_pDevice;
g_Channel[_iDeviceNumber].m_pDevice = NULL; g_Channel[_iDeviceNumber].m_pDevice = nullptr;
} }
void AddDevice(ISIDevice* pDevice) void AddDevice(ISIDevice* pDevice)

View File

@ -117,7 +117,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
case WM_SPACE_REGS2: { case WM_SPACE_REGS2: {
const u8 region_offset = (u8)address; const u8 region_offset = (u8)address;
void *region_ptr = NULL; void *region_ptr = nullptr;
int region_size = 0; int region_size = 0;
switch(data[3]) switch(data[3])
@ -200,7 +200,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
address &= 0xFEFFFF; address &= 0xFEFFFF;
u16 size = Common::swap16(rd->size); u16 size = Common::swap16(rd->size);
u8 *const block = new u8[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); 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; address &= 0xFF00FF;
const u8 region_offset = (u8)address; const u8 region_offset = (u8)address;
void *region_ptr = NULL; void *region_ptr = nullptr;
int region_size = 0; int region_size = 0;
switch (address >> 16) switch (address >> 16)
@ -1093,7 +1093,7 @@ void Wiimote::ReadData(const wm_read_data* const rd)
address &= 0xFF00FF; address &= 0xFF00FF;
const u8 region_offset = (u8)address; const u8 region_offset = (u8)address;
void *region_ptr = NULL; void *region_ptr = nullptr;
int region_size = 0; int region_size = 0;
switch (address >> 16) switch (address >> 16)

View File

@ -257,7 +257,7 @@ Wiimote::Wiimote( const unsigned int index )
: m_index(index) : m_index(index)
, ir_sin(0) , ir_sin(0)
, ir_cos(1) , ir_cos(1)
// , m_sound_stream( NULL ) // , m_sound_stream( nullptr )
{ {
// ---- set up all the controls ---- // ---- set up all the controls ----

View File

@ -153,7 +153,7 @@ private:
void ReportMode(const wm_report_mode* const dr); void ReportMode(const wm_report_mode* const dr);
void SendAck(const u8 _reportID); 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 ReadData(const wm_read_data* const rd);
void WriteData(const wm_write_data* const wd); void WriteData(const wm_write_data* const wd);
void SendReadDataReply(ReadRequest& _request); void SendReadDataReply(ReadRequest& _request);

View File

@ -22,7 +22,7 @@ void WiimoteScanner::Update()
void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimote* & found_board) void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimote* & found_board)
{ {
found_wiimotes.clear(); found_wiimotes.clear();
found_board = NULL; found_board = nullptr;
} }
bool WiimoteScanner::IsReady() const bool WiimoteScanner::IsReady() const

View File

@ -19,7 +19,7 @@ WiimoteScanner::WiimoteScanner()
, device_sock(-1) , device_sock(-1)
{ {
// Get the id of the first bluetooth device. // Get the id of the first bluetooth device.
device_id = hci_get_route(NULL); device_id = hci_get_route(nullptr);
if (device_id < 0) if (device_id < 0)
{ {
NOTICE_LOG(WIIMOTE, "Bluetooth not found."); NOTICE_LOG(WIIMOTE, "Bluetooth not found.");
@ -57,10 +57,10 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
int const max_infos = 255; int const max_infos = 255;
inquiry_info scan_infos[max_infos] = {}; inquiry_info scan_infos[max_infos] = {};
auto* scan_infos_ptr = scan_infos; auto* scan_infos_ptr = scan_infos;
found_board = NULL; found_board = nullptr;
// Scan for bluetooth devices // 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) if (found_devices < 0)
{ {
ERROR_LOG(WIIMOTE, "Error searching for bluetooth devices."); ERROR_LOG(WIIMOTE, "Error searching for bluetooth devices.");
@ -211,7 +211,7 @@ int Wiimote::IORead(u8* buf)
FD_SET(int_sock, &fds); FD_SET(int_sock, &fds);
FD_SET(wakeup_pipe_r, &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); ERROR_LOG(WIIMOTE, "Unable to select wiimote %i input socket.", index + 1);
return -1; return -1;

View File

@ -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_BluetoothAuthenticateDevice)(HWND, HANDLE, BLUETOOTH_DEVICE_INFO*, PWCHAR, ULONG);
typedef DWORD (__stdcall *PBth_BluetoothEnumerateInstalledServices)(HANDLE, BLUETOOTH_DEVICE_INFO*, DWORD*, GUID*); typedef DWORD (__stdcall *PBth_BluetoothEnumerateInstalledServices)(HANDLE, BLUETOOTH_DEVICE_INFO*, DWORD*, GUID*);
PHidD_GetHidGuid HidD_GetHidGuid = NULL; PHidD_GetHidGuid HidD_GetHidGuid = nullptr;
PHidD_GetAttributes HidD_GetAttributes = NULL; PHidD_GetAttributes HidD_GetAttributes = nullptr;
PHidD_SetOutputReport HidD_SetOutputReport = NULL; PHidD_SetOutputReport HidD_SetOutputReport = nullptr;
PHidD_GetProductString HidD_GetProductString = NULL; PHidD_GetProductString HidD_GetProductString = nullptr;
PBth_BluetoothFindDeviceClose Bth_BluetoothFindDeviceClose = NULL; PBth_BluetoothFindDeviceClose Bth_BluetoothFindDeviceClose = nullptr;
PBth_BluetoothFindFirstDevice Bth_BluetoothFindFirstDevice = NULL; PBth_BluetoothFindFirstDevice Bth_BluetoothFindFirstDevice = nullptr;
PBth_BluetoothFindFirstRadio Bth_BluetoothFindFirstRadio = NULL; PBth_BluetoothFindFirstRadio Bth_BluetoothFindFirstRadio = nullptr;
PBth_BluetoothFindNextDevice Bth_BluetoothFindNextDevice = NULL; PBth_BluetoothFindNextDevice Bth_BluetoothFindNextDevice = nullptr;
PBth_BluetoothFindNextRadio Bth_BluetoothFindNextRadio = NULL; PBth_BluetoothFindNextRadio Bth_BluetoothFindNextRadio = nullptr;
PBth_BluetoothFindRadioClose Bth_BluetoothFindRadioClose = NULL; PBth_BluetoothFindRadioClose Bth_BluetoothFindRadioClose = nullptr;
PBth_BluetoothGetRadioInfo Bth_BluetoothGetRadioInfo = NULL; PBth_BluetoothGetRadioInfo Bth_BluetoothGetRadioInfo = nullptr;
PBth_BluetoothRemoveDevice Bth_BluetoothRemoveDevice = NULL; PBth_BluetoothRemoveDevice Bth_BluetoothRemoveDevice = nullptr;
PBth_BluetoothSetServiceState Bth_BluetoothSetServiceState = NULL; PBth_BluetoothSetServiceState Bth_BluetoothSetServiceState = nullptr;
PBth_BluetoothAuthenticateDevice Bth_BluetoothAuthenticateDevice = NULL; PBth_BluetoothAuthenticateDevice Bth_BluetoothAuthenticateDevice = nullptr;
PBth_BluetoothEnumerateInstalledServices Bth_BluetoothEnumerateInstalledServices = NULL; PBth_BluetoothEnumerateInstalledServices Bth_BluetoothEnumerateInstalledServices = nullptr;
HINSTANCE hid_lib = NULL; HINSTANCE hid_lib = nullptr;
HINSTANCE bthprops_lib = NULL; HINSTANCE bthprops_lib = nullptr;
static int initialized = 0; static int initialized = 0;
@ -201,22 +201,22 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
HidD_GetHidGuid(&device_id); HidD_GetHidGuid(&device_id);
// Get all hid devices connected // 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; SP_DEVICE_INTERFACE_DATA device_data;
device_data.cbSize = sizeof(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 // Get the size of the data block required
DWORD len; 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 = (PSP_DEVICE_INTERFACE_DETAIL_DATA)malloc(len);
detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
// Query the data for this device // 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; auto const wm = new Wiimote;
wm->devicepath = detail_data->DevicePath; wm->devicepath = detail_data->DevicePath;
@ -250,7 +250,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, size_t size, int attempts) int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, size_t size, int attempts)
{ {
OVERLAPPED hid_overlap_write = OVERLAPPED(); 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; enum win_bt_stack_t stack = MSBT_STACK_UNKNOWN;
DWORD written = 0; 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) int CheckDeviceType_Read(HANDLE &dev_handle, u8* buf, int attempts)
{ {
OVERLAPPED hid_overlap_read = OVERLAPPED(); 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; int read = 0;
for (; attempts>0; --attempts) for (; attempts>0; --attempts)
{ {
@ -318,8 +318,8 @@ void WiimoteScanner::CheckDeviceType(std::basic_string<TCHAR> &devicepath, bool
HANDLE dev_handle = CreateFile(devicepath.c_str(), HANDLE dev_handle = CreateFile(devicepath.c_str(),
GENERIC_READ | GENERIC_WRITE, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED,
NULL); nullptr);
if (dev_handle == INVALID_HANDLE_VALUE) if (dev_handle == INVALID_HANDLE_VALUE)
return; return;
// enable to only check for official nintendo wiimotes/bb's // enable to only check for official nintendo wiimotes/bb's
@ -447,7 +447,7 @@ bool WiimoteScanner::IsReady() const
HANDLE hRadio; HANDLE hRadio;
HBLUETOOTH_RADIO_FIND hFindRadio = Bth_BluetoothFindFirstRadio(&radioParam, &hRadio); HBLUETOOTH_RADIO_FIND hFindRadio = Bth_BluetoothFindFirstRadio(&radioParam, &hRadio);
if (NULL != hFindRadio) if (nullptr != hFindRadio)
{ {
Bth_BluetoothFindRadioClose(hFindRadio); Bth_BluetoothFindRadioClose(hFindRadio);
return true; return true;
@ -480,7 +480,7 @@ bool Wiimote::ConnectInternal()
dev_handle = CreateFile(devicepath.c_str(), dev_handle = CreateFile(devicepath.c_str(),
GENERIC_READ | GENERIC_WRITE, open_flags, 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) if (dev_handle == INVALID_HANDLE_VALUE)
{ {
@ -549,10 +549,10 @@ void Wiimote::InitInternal()
stack = MSBT_STACK_UNKNOWN; stack = MSBT_STACK_UNKNOWN;
hid_overlap_read = OVERLAPPED(); 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 = OVERLAPPED();
hid_overlap_write.hEvent = CreateEvent(NULL, true, false, NULL); hid_overlap_write.hEvent = CreateEvent(nullptr, true, false, nullptr);
} }
void Wiimote::TeardownInternal() 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; 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) 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) switch (stack)
{ {
@ -772,7 +772,7 @@ void ProcessWiimotes(bool new_scan, T& callback)
if (false == Bth_BluetoothFindNextDevice(hFindDevice, &btdi)) if (false == Bth_BluetoothFindNextDevice(hFindDevice, &btdi))
{ {
Bth_BluetoothFindDeviceClose(hFindDevice); Bth_BluetoothFindDeviceClose(hFindDevice);
hFindDevice = NULL; hFindDevice = nullptr;
} }
} }
} }
@ -780,7 +780,7 @@ void ProcessWiimotes(bool new_scan, T& callback)
if (false == Bth_BluetoothFindNextRadio(hFindRadio, &hRadio)) if (false == Bth_BluetoothFindNextRadio(hFindRadio, &hRadio))
{ {
Bth_BluetoothFindRadioClose(hFindRadio); 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) #if defined(AUTHENTICATE_WIIMOTES)
// Authenticate // Authenticate
auto const& radio_addr = radio_info.address.rgBytes; 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<WCHAR>(radio_addr, radio_addr + 6).data(), 6); std::vector<WCHAR>(radio_addr, radio_addr + 6).data(), 6);
if (ERROR_SUCCESS != auth_result) if (ERROR_SUCCESS != auth_result)

View File

@ -40,19 +40,19 @@
length: (NSUInteger) length length: (NSUInteger) length
{ {
IOBluetoothDevice *device = [l2capChannel device]; IOBluetoothDevice *device = [l2capChannel device];
WiimoteReal::Wiimote *wm = NULL; WiimoteReal::Wiimote *wm = nullptr;
std::lock_guard<std::recursive_mutex> lk(WiimoteReal::g_refresh_lock); std::lock_guard<std::recursive_mutex> lk(WiimoteReal::g_refresh_lock);
for (int i = 0; i < MAX_WIIMOTES; i++) for (int i = 0; i < MAX_WIIMOTES; i++)
{ {
if (WiimoteReal::g_wiimotes[i] == NULL) if (WiimoteReal::g_wiimotes[i] == nullptr)
continue; continue;
if ([device isEqual: WiimoteReal::g_wiimotes[i]->btd] == TRUE) if ([device isEqual: WiimoteReal::g_wiimotes[i]->btd] == TRUE)
wm = WiimoteReal::g_wiimotes[i]; wm = WiimoteReal::g_wiimotes[i];
} }
if (wm == NULL) { if (wm == nullptr) {
ERROR_LOG(WIIMOTE, "Received packet for unknown wiimote"); ERROR_LOG(WIIMOTE, "Received packet for unknown wiimote");
return; return;
} }
@ -79,19 +79,19 @@
- (void) l2capChannelClosed: (IOBluetoothL2CAPChannel *) l2capChannel - (void) l2capChannelClosed: (IOBluetoothL2CAPChannel *) l2capChannel
{ {
IOBluetoothDevice *device = [l2capChannel device]; IOBluetoothDevice *device = [l2capChannel device];
WiimoteReal::Wiimote *wm = NULL; WiimoteReal::Wiimote *wm = nullptr;
std::lock_guard<std::recursive_mutex> lk(WiimoteReal::g_refresh_lock); std::lock_guard<std::recursive_mutex> lk(WiimoteReal::g_refresh_lock);
for (int i = 0; i < MAX_WIIMOTES; i++) for (int i = 0; i < MAX_WIIMOTES; i++)
{ {
if (WiimoteReal::g_wiimotes[i] == NULL) if (WiimoteReal::g_wiimotes[i] == nullptr)
continue; continue;
if ([device isEqual: WiimoteReal::g_wiimotes[i]->btd] == TRUE) if ([device isEqual: WiimoteReal::g_wiimotes[i]->btd] == TRUE)
wm = WiimoteReal::g_wiimotes[i]; wm = WiimoteReal::g_wiimotes[i];
} }
if (wm == NULL) { if (wm == nullptr) {
ERROR_LOG(WIIMOTE, "Channel for unknown wiimote was closed"); ERROR_LOG(WIIMOTE, "Channel for unknown wiimote was closed");
return; return;
} }
@ -123,7 +123,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
IOBluetoothDeviceInquiry *bti; IOBluetoothDeviceInquiry *bti;
SearchBT *sbt; SearchBT *sbt;
NSEnumerator *en; NSEnumerator *en;
found_board = NULL; found_board = nullptr;
bth = [[IOBluetoothHostController alloc] init]; bth = [[IOBluetoothHostController alloc] init];
if ([bth addressAsString] == nil) if ([bth addressAsString] == nil)
@ -191,7 +191,7 @@ void Wiimote::InitInternal()
{ {
inputlen = 0; inputlen = 0;
m_connected = false; m_connected = false;
m_wiimote_thread_run_loop = NULL; m_wiimote_thread_run_loop = nullptr;
btd = nil; btd = nil;
} }
@ -200,7 +200,7 @@ void Wiimote::TeardownInternal()
if (m_wiimote_thread_run_loop) if (m_wiimote_thread_run_loop)
{ {
CFRelease(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 release];
btd = nil; btd = nil;

View File

@ -445,7 +445,7 @@ void WiimoteScanner::ThreadFunc()
while (m_run_thread) while (m_run_thread)
{ {
std::vector<Wiimote*> found_wiimotes; std::vector<Wiimote*> found_wiimotes;
Wiimote* found_board = NULL; Wiimote* found_board = nullptr;
//NOTICE_LOG(WIIMOTE, "In loop"); //NOTICE_LOG(WIIMOTE, "In loop");
@ -592,7 +592,7 @@ void Initialize(bool wait)
{ {
int timeout = 100; int timeout = 100;
std::vector<Wiimote*> found_wiimotes; std::vector<Wiimote*> found_wiimotes;
Wiimote* found_board = NULL; Wiimote* found_board = nullptr;
g_wiimote_scanner.FindWiimotes(found_wiimotes, found_board); g_wiimote_scanner.FindWiimotes(found_wiimotes, found_board);
if (SConfig::GetInstance().m_WiimoteContinuousScanning) if (SConfig::GetInstance().m_WiimoteContinuousScanning)
{ {
@ -694,7 +694,7 @@ void TryToConnectWiimote(Wiimote* wm)
{ {
if (TryToConnectWiimoteN(wm, i)) if (TryToConnectWiimoteN(wm, i))
{ {
wm = NULL; wm = nullptr;
break; break;
} }
} }
@ -712,7 +712,7 @@ void TryToConnectBalanceBoard(Wiimote* wm)
if (TryToConnectWiimoteN(wm, WIIMOTE_BALANCE_BOARD)) if (TryToConnectWiimoteN(wm, WIIMOTE_BALANCE_BOARD))
{ {
wm = NULL; wm = nullptr;
} }
g_wiimote_scanner.WantBB(0 != CalculateWantedBB()); g_wiimote_scanner.WantBB(0 != CalculateWantedBB());
@ -730,7 +730,7 @@ void DoneWithWiimote(int index)
if (wm) if (wm)
{ {
g_wiimotes[index] = NULL; g_wiimotes[index] = nullptr;
// First see if we can use this real Wiimote in another slot. // First see if we can use this real Wiimote in another slot.
TryToConnectWiimote(wm); TryToConnectWiimote(wm);
} }
@ -741,7 +741,7 @@ void DoneWithWiimote(int index)
void HandleWiimoteDisconnect(int index) void HandleWiimoteDisconnect(int index)
{ {
Wiimote* wm = NULL; Wiimote* wm = nullptr;
{ {
std::lock_guard<std::recursive_mutex> lk(g_refresh_lock); std::lock_guard<std::recursive_mutex> lk(g_refresh_lock);
@ -771,7 +771,7 @@ void Refresh()
{ {
std::unique_lock<std::recursive_mutex> lk(g_refresh_lock); std::unique_lock<std::recursive_mutex> lk(g_refresh_lock);
std::vector<Wiimote*> found_wiimotes; std::vector<Wiimote*> found_wiimotes;
Wiimote* found_board = NULL; Wiimote* found_board = nullptr;
if (0 != CalculateWantedWiimotes() || 0 != CalculateWantedBB()) if (0 != CalculateWantedWiimotes() || 0 != CalculateWantedBB())
{ {

View File

@ -82,7 +82,7 @@ int icmp_echo_rep(const u32 s, sockaddr_in *addr, const u32 timeout, const u32 d
timeval t; timeval t;
t.tv_sec = timeout / 1000; 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, num_bytes = recvfrom((SOCKET)s, (LPSTR)workspace,
IP_HDR_LEN + ICMP_HDR_LEN + data_length, IP_HDR_LEN + ICMP_HDR_LEN + data_length,

View File

@ -95,7 +95,7 @@ void Init()
for (IWII_IPC_HLE_Device*& dev : g_FdMap) for (IWII_IPC_HLE_Device*& dev : g_FdMap)
{ {
dev = NULL; dev = nullptr;
} }
u32 i = 0; u32 i = 0;
@ -139,14 +139,14 @@ void Reset(bool _bHard)
for (IWII_IPC_HLE_Device*& dev : g_FdMap) 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 // close all files and delete their resources
dev->Close(0, true); dev->Close(0, true);
delete dev; delete dev;
} }
dev = NULL; dev = nullptr;
} }
for (bool& in_use : es_inuse) for (bool& in_use : es_inuse)
@ -214,7 +214,7 @@ int getFreeDeviceId()
{ {
for (u32 i=0; i<IPC_MAX_FDS; i++) for (u32 i=0; i<IPC_MAX_FDS; i++)
{ {
if (g_FdMap[i] == NULL) if (g_FdMap[i] == nullptr)
{ {
return i; return i;
} }
@ -233,7 +233,7 @@ IWII_IPC_HLE_Device* GetDeviceByName(const std::string& _rDeviceName)
} }
} }
return NULL; return nullptr;
} }
IWII_IPC_HLE_Device* AccessDeviceByID(u32 _ID) IWII_IPC_HLE_Device* AccessDeviceByID(u32 _ID)
@ -243,14 +243,14 @@ IWII_IPC_HLE_Device* AccessDeviceByID(u32 _ID)
return g_DeviceMap[_ID]; return g_DeviceMap[_ID];
} }
return NULL; return nullptr;
} }
// This is called from ExecuteCommand() COMMAND_OPEN_DEVICE // This is called from ExecuteCommand() COMMAND_OPEN_DEVICE
IWII_IPC_HLE_Device* CreateFileIO(u32 _DeviceID, const std::string& _rDeviceName) IWII_IPC_HLE_Device* CreateFileIO(u32 _DeviceID, const std::string& _rDeviceName)
{ {
// scan device name and create the right one // scan device name and create the right one
IWII_IPC_HLE_Device* pDevice = NULL; IWII_IPC_HLE_Device* pDevice = nullptr;
INFO_LOG(WII_IPC_FILEIO, "IOP: Create FileIO %s", _rDeviceName.c_str()); INFO_LOG(WII_IPC_FILEIO, "IOP: Create FileIO %s", _rDeviceName.c_str());
pDevice = new CWII_IPC_HLE_Device_FileIO(_DeviceID, _rDeviceName); pDevice = new CWII_IPC_HLE_Device_FileIO(_DeviceID, _rDeviceName);
@ -299,7 +299,7 @@ void DoState(PointerWrap &p)
} }
else else
{ {
g_FdMap[i] = NULL; g_FdMap[i] = nullptr;
} }
} }
@ -350,7 +350,7 @@ void ExecuteCommand(u32 _Address)
ECommandType Command = static_cast<ECommandType>(Memory::Read_U32(_Address)); ECommandType Command = static_cast<ECommandType>(Memory::Read_U32(_Address));
volatile s32 DeviceID = Memory::Read_U32(_Address + 8); 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); 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 else
{ {
delete pDevice; 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 // Don't delete hardware
if (!pDevice->IsHardware()) if (!pDevice->IsHardware())
{ {
delete pDevice; delete pDevice;
pDevice = NULL; pDevice = nullptr;
} }
} }
else else

View File

@ -29,7 +29,7 @@ using namespace DVDInterface;
CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName ) CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName )
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
, m_pFileSystem(NULL) , m_pFileSystem(nullptr)
, m_ErrorStatus(0) , m_ErrorStatus(0)
, m_CoverStatus(DI_COVER_REG_NO_DISC) , m_CoverStatus(DI_COVER_REG_NO_DISC)
{} {}
@ -39,7 +39,7 @@ CWII_IPC_HLE_Device_di::~CWII_IPC_HLE_Device_di()
if (m_pFileSystem) if (m_pFileSystem)
{ {
delete 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) if (m_pFileSystem)
{ {
delete m_pFileSystem; delete m_pFileSystem;
m_pFileSystem = NULL; m_pFileSystem = nullptr;
} }
m_ErrorStatus = 0; m_ErrorStatus = 0;
if (!_bForce) if (!_bForce)
@ -159,7 +159,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
if(m_pFileSystem && !VolumeHandler::IsValid()) if(m_pFileSystem && !VolumeHandler::IsValid())
{ {
delete m_pFileSystem; delete m_pFileSystem;
m_pFileSystem = NULL; m_pFileSystem = nullptr;
m_CoverStatus |= DI_COVER_REG_NO_DISC; 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 // Don't do anything if the log is unselected
if (LogManager::GetInstance()->IsEnabled(LogTypes::FILEMON)) if (LogManager::GetInstance()->IsEnabled(LogTypes::FILEMON))
{ {
const char *pFilename = NULL; const char *pFilename = nullptr;
if (m_pFileSystem) if (m_pFileSystem)
pFilename = m_pFileSystem->GetFileName(DVDAddress); 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)", INFO_LOG(WII_IPC_DVD, "DVDLowRead: %s (0x%" PRIx64 ") - (DVDAddr: 0x%" PRIx64 ", Size: 0x%x)",
pFilename, m_pFileSystem->GetFileSize(pFilename), DVDAddress, Size); 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: case DVDLowSeek:
{ {
u64 DVDAddress = Memory::Read_U32(_BufferIn + 0x4) << 2; u64 DVDAddress = Memory::Read_U32(_BufferIn + 0x4) << 2;
const char *pFilename = NULL; const char *pFilename = nullptr;
if (m_pFileSystem) if (m_pFileSystem)
pFilename = m_pFileSystem->GetFileName(DVDAddress); pFilename = m_pFileSystem->GetFileName(DVDAddress);
if (pFilename != NULL) if (pFilename != nullptr)
{ {
INFO_LOG(WII_IPC_DVD, "DVDLowSeek: %s (0x%" PRIx64 ") - (DVDAddr: 0x%" PRIx64 ")", INFO_LOG(WII_IPC_DVD, "DVDLowSeek: %s (0x%" PRIx64 ") - (DVDAddr: 0x%" PRIx64 ")",
pFilename, m_pFileSystem->GetFileSize(pFilename), DVDAddress); pFilename, m_pFileSystem->GetFileSize(pFilename), DVDAddress);

View File

@ -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) CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
, m_pContentLoader(NULL) , m_pContentLoader(nullptr)
, m_TitleID(-1) , m_TitleID(-1)
, m_AccessIdentID(0x6000000) , m_AccessIdentID(0x6000000)
{ {
@ -190,7 +190,7 @@ bool CWII_IPC_HLE_Device_es::Close(u32 _CommandAddress, bool _bForce)
delete pair.second.m_pFile; delete pair.second.m_pFile;
} }
m_ContentAccessMap.clear(); m_ContentAccessMap.clear();
m_pContentLoader = NULL; m_pContentLoader = nullptr;
m_TitleIDs.clear(); m_TitleIDs.clear();
m_TitleID = -1; m_TitleID = -1;
m_AccessIdentID = 0x6000000; 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); const DiscIO::SNANDContent* pContent = Loader.GetContentByIndex(Index);
if (pContent == NULL) if (pContent == nullptr)
{ {
return 0xffffffff; //TODO: what is the correct error value here? 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_Position = 0;
Access.m_pContent = pContent; Access.m_pContent = pContent;
Access.m_TitleID = TitleID; Access.m_TitleID = TitleID;
Access.m_pFile = NULL; Access.m_pFile = nullptr;
if (!pContent->m_pData) if (!pContent->m_pData)
{ {
@ -393,7 +393,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
} }
SContentAccess& rContent = itr->second; 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); u8* pDest = Memory::GetPointer(Addr);

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