SPU2: s/NULL/nullptr/, s/SPU-2/SPU2/

This commit is contained in:
GovanifY 2020-09-26 12:46:13 +02:00 committed by refractionpcsx2
parent 5cf2147754
commit f58d9e3f39
28 changed files with 221 additions and 221 deletions

View File

@ -20,7 +20,7 @@ int crazy_debug = 0;
char s[4096];
FILE* spu2Log = NULL;
FILE* spu2Log = nullptr;
void FileLog(const char* fmt, ...)
{

View File

@ -21,11 +21,11 @@
extern u8 callirq;
static FILE* DMA4LogFile = NULL;
static FILE* DMA7LogFile = NULL;
static FILE* ADMA4LogFile = NULL;
static FILE* ADMA7LogFile = NULL;
static FILE* ADMAOutLogFile = NULL;
static FILE* DMA4LogFile = nullptr;
static FILE* DMA7LogFile = nullptr;
static FILE* ADMA4LogFile = nullptr;
static FILE* ADMA7LogFile = nullptr;
static FILE* ADMAOutLogFile = nullptr;
static FILE* REGWRTLogFile[2] = {0, 0};
@ -101,12 +101,12 @@ void V_Core::AutoDMAReadBuffer(int mode) //mode: 0= split stereo; 1 = do not spl
LogAutoDMA(Index ? ADMA7LogFile : ADMA4LogFile);
// HACKFIX!! DMAPtr can be invalid after a savestate load, so the savestate just forces it
// to NULL and we ignore it here. (used to work in old VM editions of PCSX2 with fixed
// to nullptr and we ignore it here. (used to work in old VM editions of PCSX2 with fixed
// addressing, but new PCSX2s have dynamic memory addressing).
if (mode)
{
if (DMAPtr != NULL)
if (DMAPtr != nullptr)
//memcpy((ADMATempBuffer+(spos<<1)),DMAPtr+InputDataProgress,0x400);
memcpy(GetMemPtr(0x2000 + (Index << 10) + spos), DMAPtr + InputDataProgress, 0x400);
MADR += 0x400;
@ -115,14 +115,14 @@ void V_Core::AutoDMAReadBuffer(int mode) //mode: 0= split stereo; 1 = do not spl
}
else
{
if (DMAPtr != NULL)
if (DMAPtr != nullptr)
//memcpy((ADMATempBuffer+spos),DMAPtr+InputDataProgress,0x200);
memcpy(GetMemPtr(0x2000 + (Index << 10) + spos), DMAPtr + InputDataProgress, 0x200);
MADR += 0x200;
InputDataLeft -= 0x100;
InputDataProgress += 0x100;
if (DMAPtr != NULL)
if (DMAPtr != nullptr)
//memcpy((ADMATempBuffer+spos+0x200),DMAPtr+InputDataProgress,0x200);
memcpy(GetMemPtr(0x2200 + (Index << 10) + spos), DMAPtr + InputDataProgress, 0x200);
MADR += 0x200;
@ -138,7 +138,7 @@ void V_Core::StartADMAWrite(u16* pMem, u32 sz)
int size = (sz) & (~511);
if (MsgAutoDMA())
ConLog("* SPU-2: DMA%c AutoDMA Transfer of %d bytes to %x (%02x %x %04x).\n",
ConLog("* SPU2: DMA%c AutoDMA Transfer of %d bytes to %x (%02x %x %04x).\n",
GetDmaIndexChar(), size << 1, TSA, DMABits, AutoDMACtrl, (~Regs.ATTR) & 0x7fff);
InputDataProgress = 0;
@ -245,7 +245,7 @@ void V_Core::PlainDMAWrite(u16* pMem, u32 size)
cacheLine++;
} while (cacheLine != &cacheEnd);
//ConLog( "* SPU-2: Cache Clear Range! TSA=0x%x, TDA=0x%x (low8=0x%x, high8=0x%x, len=0x%x)\n",
//ConLog( "* SPU2: Cache Clear Range! TSA=0x%x, TDA=0x%x (low8=0x%x, high8=0x%x, len=0x%x)\n",
// TSA, buff1end, flagTSA, flagTDA, clearLen );
@ -426,7 +426,7 @@ void V_Core::DoDMAwrite(u16* pMem, u32 size)
{
if (TSA > 0xfffff)
{
ConLog("* SPU-2: Transfer Start Address out of bounds. TSA is %x\n", TSA);
ConLog("* SPU2: Transfer Start Address out of bounds. TSA is %x\n", TSA);
}
}
@ -442,7 +442,7 @@ void V_Core::DoDMAwrite(u16* pMem, u32 size)
else
{
if (MsgDMA())
ConLog("* SPU-2: DMA%c Transfer of %d bytes to %x (%02x %x %04x). IRQE = %d IRQA = %x \n",
ConLog("* SPU2: DMA%c Transfer of %d bytes to %x (%02x %x %04x). IRQE = %d IRQA = %x \n",
GetDmaIndexChar(), size << 1, TSA, DMABits, AutoDMACtrl, (~Regs.ATTR) & 0x7fff,
Cores[0].IRQEnable, Cores[0].IRQA);

View File

@ -44,7 +44,7 @@ protected:
void _InternalCallback()
{
snd_pcm_sframes_t avail;
fprintf(stderr, "* SPU-2:Iz in your internal callback.\n");
fprintf(stderr, "* SPU2:Iz in your internal callback.\n");
avail = snd_pcm_avail_update(handle);
while (avail >= (int)period_time)
@ -64,16 +64,16 @@ protected:
// entry point for our C++ified object state. :)
static void ExternalCallback(snd_async_handler_t* pcm_call)
{
fprintf(stderr, "* SPU-2:Iz in your external callback.\n");
fprintf(stderr, "* SPU2:Iz in your external callback.\n");
AlsaMod* data = (AlsaMod*)snd_async_handler_get_callback_private(pcm_call);
pxAssume(data != NULL);
pxAssume(data != nullptr);
//pxAssume( data->handle == snd_async_handler_get_pcm(pcm_call) );
// Not sure if we just need an assert, or something like this:
if (data->handle != snd_async_handler_get_pcm(pcm_call))
{
fprintf(stderr, "* SPU-2: Failed to handle sound.\n");
fprintf(stderr, "* SPU2: Failed to handle sound.\n");
return;
}
@ -83,15 +83,15 @@ protected:
public:
s32 Init()
{
//fprintf(stderr,"* SPU-2: Initing Alsa\n");
//fprintf(stderr,"* SPU2: Initing Alsa\n");
snd_pcm_hw_params_t* hwparams;
snd_pcm_sw_params_t* swparams;
snd_pcm_status_t* status;
int pchannels = 2;
snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
handle = NULL;
pcm_callback = NULL;
handle = nullptr;
pcm_callback = nullptr;
pspeed = SAMPLE_RATE;
// buffer time and period time are in microseconds...
@ -183,10 +183,10 @@ public:
// Bind our asynchronous callback magic:
if (handle == NULL)
if (handle == nullptr)
fprintf(stderr, "No handle.");
//fprintf(stderr,"* SPU-2:Iz setting your internal callback.\n");
//fprintf(stderr,"* SPU2:Iz setting your internal callback.\n");
// The external handler never seems to get called after this.
snd_async_add_pcm_handler(&pcm_callback, handle, ExternalCallback, this);
err = snd_pcm_start(handle);
@ -204,13 +204,13 @@ public:
void Close()
{
//fprintf(stderr,"* SPU-2: Closing Alsa\n");
if (handle == NULL)
//fprintf(stderr,"* SPU2: Closing Alsa\n");
if (handle == nullptr)
return;
snd_pcm_drop(handle);
snd_pcm_close(handle);
handle = NULL;
handle = nullptr;
}
virtual void Configure(uptr parent)
@ -226,9 +226,9 @@ public:
int GetEmptySampleCount()
{
if (handle == NULL)
if (handle == nullptr)
{
fprintf(stderr, "Handle is NULL!\n");
fprintf(stderr, "Handle is nullptr!\n");
return 0;
}

View File

@ -171,8 +171,8 @@ void ReadSettings()
if (mods[OutputModule] == nullptr)
{
fwprintf(stderr, L"* SPU-2: Unknown output module '%s' specified in configuration file.\n", temp.wc_str());
fprintf(stderr, "* SPU-2: Defaulting to SDL (%S).\n", SDLOut->GetIdent());
fwprintf(stderr, L"* SPU2: Unknown output module '%s' specified in configuration file.\n", temp.wc_str());
fprintf(stderr, "* SPU2: Defaulting to SDL (%S).\n", SDLOut->GetIdent());
OutputModule = FindOutputModuleById(SDLOut->GetIdent());
}

View File

@ -35,7 +35,7 @@ bool _CoresDump = false;
bool _MemDump = false;
bool _RegDump = false;
// this is set true if PCSX2 invokes the SetLogDir callback, which tells SPU-2 to use that over
// this is set true if PCSX2 invokes the SetLogDir callback, which tells SPU2 to use that over
// the configured crap in the ini file.
static bool LogLocationSetByPcsx2 = false;
@ -53,9 +53,9 @@ wxString RegDumpFileName;
void CfgSetLogDir(const char* dir)
{
LogsFolder = (dir == NULL) ? wxString(L"logs") : fromUTF8(dir);
DumpsFolder = (dir == NULL) ? wxString(L"logs") : fromUTF8(dir);
LogLocationSetByPcsx2 = (dir != NULL);
LogsFolder = (dir == nullptr) ? wxString(L"logs") : fromUTF8(dir);
DumpsFolder = (dir == nullptr) ? wxString(L"logs") : fromUTF8(dir);
LogLocationSetByPcsx2 = (dir != nullptr);
}
FILE* OpenBinaryLog(const wxString& logfile)

View File

@ -82,7 +82,7 @@ static void __forceinline XA_decode_block(s16* buffer, const s16* block, s32& pr
const s32 shift = (header & 0xF) + 16;
const int id = header >> 4 & 0xF;
if (id > 4 && MsgToConsole())
ConLog("* SPU-2: Unknown ADPCM coefficients table id %d\n", id);
ConLog("* SPU2: Unknown ADPCM coefficients table id %d\n", id);
const s32 pred1 = tbl_XA_Factor[id][0];
const s32 pred2 = tbl_XA_Factor[id][1];
@ -133,7 +133,7 @@ static void __forceinline IncrementNextA(V_Core& thiscore, uint voiceidx)
// decoded pcm data, used to cache the decoded data so that it needn't be decoded
// multiple times. Cache chunks are decoded when the mixer requests the blocks, and
// invalided when DMA transfers and memory writes are performed.
PcmCacheEntry* pcm_cache_data = NULL;
PcmCacheEntry* pcm_cache_data = nullptr;
int g_counter_cache_hits = 0;
int g_counter_cache_misses = 0;
@ -169,7 +169,7 @@ static __forceinline s32 GetNextDataBuffered(V_Core& thiscore, uint voiceidx)
if (IsDevBuild)
{
if (MsgVoiceOff())
ConLog("* SPU-2: Voice Off by EndPoint: %d \n", voiceidx);
ConLog("* SPU2: Voice Off by EndPoint: %d \n", voiceidx);
}
}
}
@ -206,7 +206,7 @@ static __forceinline s32 GetNextDataBuffered(V_Core& thiscore, uint voiceidx)
vc.Prev1 = vc.SBuffer[27];
vc.Prev2 = vc.SBuffer[26];
//ConLog( "* SPU-2: Cache Hit! NextA=0x%x, cacheIdx=0x%x\n", vc.NextA, cacheIdx );
//ConLog( "* SPU2: Cache Hit! NextA=0x%x, cacheIdx=0x%x\n", vc.NextA, cacheIdx );
if (IsDevBuild)
g_counter_cache_hits++;
@ -339,7 +339,7 @@ static __forceinline void CalculateADSR(V_Core& thiscore, uint voiceidx)
if (IsDevBuild)
{
if (MsgVoiceOff())
ConLog("* SPU-2: Voice Off by ADSR: %d \n", voiceidx);
ConLog("* SPU2: Voice Off by ADSR: %d \n", voiceidx);
}
vc.Stop();
}

View File

@ -144,27 +144,27 @@ void SPU2writeLog(const char* action, u32 rmem, u16 value)
break;
case 0x7c4:
if (Spdif.Unknown1 != value)
ConLog("* SPU-2: SPDIF Unknown Register 1 set to %04x\n", value);
ConLog("* SPU2: SPDIF Unknown Register 1 set to %04x\n", value);
RegLog(2, "SPDIF_UNKNOWN1", rmem, -1, value);
break;
case SPDIF_MODE:
if (Spdif.Mode != value)
ConLog("* SPU-2: SPDIF Mode set to %04x\n", value);
ConLog("* SPU2: SPDIF Mode set to %04x\n", value);
RegLog(2, "SPDIF_MODE", rmem, -1, value);
break;
case SPDIF_MEDIA:
if (Spdif.Media != value)
ConLog("* SPU-2: SPDIF Media set to %04x\n", value);
ConLog("* SPU2: SPDIF Media set to %04x\n", value);
RegLog(2, "SPDIF_MEDIA", rmem, -1, value);
break;
case 0x7ca:
if (Spdif.Unknown2 != value)
ConLog("* SPU-2: SPDIF Unknown Register 2 set to %04x\n", value);
ConLog("* SPU2: SPDIF Unknown Register 2 set to %04x\n", value);
RegLog(2, "SPDIF_UNKNOWN2", rmem, -1, value);
break;
case SPDIF_PROTECT:
if (Spdif.Protection != value)
ConLog("* SPU-2: SPDIF Copy set to %04x\n", value);
ConLog("* SPU2: SPDIF Copy set to %04x\n", value);
RegLog(2, "SPDIF_PROTECT", rmem, -1, value);
break;
}
@ -241,11 +241,11 @@ void SPU2writeLog(const char* action, u32 rmem, u16 value)
RegLog(2, "TSAL", rmem, core, value);
break;
case REG_S_ENDX:
//ConLog("* SPU-2: Core %d ENDX cleared!\n",core);
//ConLog("* SPU2: Core %d ENDX cleared!\n",core);
RegLog(2, "ENDX0", rmem, core, value);
break;
case (REG_S_ENDX + 2):
//ConLog("* SPU-2: Core %d ENDX cleared!\n",core);
//ConLog("* SPU2: Core %d ENDX cleared!\n",core);
RegLog(2, "ENDX1", rmem, core, value);
break;
case REG_P_MVOLL:
@ -256,7 +256,7 @@ void SPU2writeLog(const char* action, u32 rmem, u16 value)
break;
case REG_S_ADMAS:
RegLog(3, "ADMAS", rmem, core, value);
//ConLog("* SPU-2: Core %d AutoDMAControl set to %d\n",core,value);
//ConLog("* SPU2: Core %d AutoDMAControl set to %d\n",core,value);
break;
case REG_P_STATX:
RegLog(3, "STATX", rmem, core, value);

View File

@ -42,7 +42,7 @@
PVCP(c, v, NextA)
#define PRAW(a) \
((u16*)NULL)
((u16*)nullptr)
#define PREVB_REG(c, n) \
PCORE(c, Revb.n) + 1, \
@ -77,8 +77,8 @@ u16 const* const regtable_original[0x401] =
PCORE(0, IRQA) + 1,
PCORE(0, IRQA),
NULL, NULL,
NULL, NULL,
nullptr, nullptr,
nullptr, nullptr,
PCORE(0, TSA) + 1,
PCORE(0, TSA),
@ -180,8 +180,8 @@ u16 const* const regtable_original[0x401] =
PCORE(1, IRQA) + 1,
PCORE(1, IRQA),
NULL, NULL,
NULL, NULL,
nullptr, nullptr,
nullptr, nullptr,
PCORE(1, TSA) + 1,
PCORE(1, TSA),
@ -299,4 +299,4 @@ u16 const* const regtable_original[0x401] =
PRAW(0x7F0), PRAW(0x7F2), PRAW(0x7F4), PRAW(0x7F6),
PRAW(0x7F8), PRAW(0x7FA), PRAW(0x7FC), PRAW(0x7FE),
NULL};
nullptr};

View File

@ -94,13 +94,13 @@ SndOutModule* mods[] =
SDLOut,
AlsaOut,
#endif
NULL // signals the end of our list
nullptr // signals the end of our list
};
int FindOutputModuleById(const wchar_t* omodid)
{
int modcnt = 0;
while (mods[modcnt] != NULL)
while (mods[modcnt] != nullptr)
{
if (wcscmp(mods[modcnt]->GetIdent(), omodid) == 0)
break;
@ -115,8 +115,8 @@ __aligned(4) volatile s32 SndBuffer::m_rpos;
__aligned(4) volatile s32 SndBuffer::m_wpos;
bool SndBuffer::m_underrun_freeze;
StereoOut32* SndBuffer::sndTempBuffer = NULL;
StereoOut16* SndBuffer::sndTempBuffer16 = NULL;
StereoOut32* SndBuffer::sndTempBuffer = nullptr;
StereoOut16* SndBuffer::sndTempBuffer16 = nullptr;
int SndBuffer::sndTempProgress = 0;
int GetAlignedBufferSize(int comp)
@ -375,7 +375,7 @@ void SndBuffer::_WriteSamples(StereoOut32* bData, int nSamples)
void SndBuffer::Init()
{
if (mods[OutputModule] == NULL)
if (mods[OutputModule] == nullptr)
{
_InitFail();
return;
@ -512,7 +512,7 @@ void SndBuffer::Write(const StereoOut32& Sample)
s32 SndBuffer::Test()
{
if (mods[OutputModule] == NULL)
if (mods[OutputModule] == nullptr)
return -1;
return mods[OutputModule]->Test();

View File

@ -121,8 +121,8 @@ public:
m_UseHardware = false;
m_WasapiExclusiveMode = false;
started = false;
stream = NULL;
ActualPaCallback = NULL;
stream = nullptr;
ActualPaCallback = nullptr;
m_ApiId = -1;
m_SuggestedLatencyMS = 20;
actualUsedChannels = 0;
@ -134,21 +134,21 @@ public:
s32 Init()
{
started = false;
stream = NULL;
stream = nullptr;
ReadSettings();
PaError err = Pa_Initialize();
if (err != paNoError)
{
fprintf(stderr, "* SPU-2: PortAudio error: %s\n", Pa_GetErrorText(err));
fprintf(stderr, "* SPU2: PortAudio error: %s\n", Pa_GetErrorText(err));
return -1;
}
started = true;
int deviceIndex = -1;
fprintf(stderr, "* SPU-2: Enumerating PortAudio devices:\n");
fprintf(stderr, "* SPU2: Enumerating PortAudio devices:\n");
for (int i = 0, j = 0; i < Pa_GetDeviceCount(); i++)
{
const PaDeviceInfo* info = Pa_GetDeviceInfo(i);
@ -188,7 +188,7 @@ public:
if (deviceIndex >= 0)
{
void* infoPtr = NULL;
void* infoPtr = nullptr;
const PaDeviceInfo* devinfo = Pa_GetDeviceInfo(deviceIndex);
@ -289,12 +289,12 @@ public:
infoPtr};
err = Pa_OpenStream(&stream,
NULL, &outParams, SampleRate,
nullptr, &outParams, SampleRate,
SndOutPacketSize,
paNoFlag,
PaCallback,
NULL);
nullptr);
}
else
{
@ -302,11 +302,11 @@ public:
0, actualUsedChannels, paInt32, 48000,
SndOutPacketSize,
PaCallback,
NULL);
nullptr);
}
if (err != paNoError)
{
fprintf(stderr, "* SPU-2: PortAudio error: %s\n", Pa_GetErrorText(err));
fprintf(stderr, "* SPU2: PortAudio error: %s\n", Pa_GetErrorText(err));
Pa_Terminate();
return -1;
}
@ -314,9 +314,9 @@ public:
err = Pa_StartStream(stream);
if (err != paNoError)
{
fprintf(stderr, "* SPU-2: PortAudio error: %s\n", Pa_GetErrorText(err));
fprintf(stderr, "* SPU2: PortAudio error: %s\n", Pa_GetErrorText(err));
Pa_CloseStream(stream);
stream = NULL;
stream = nullptr;
Pa_Terminate();
return -1;
}
@ -335,20 +335,20 @@ public:
{
err = Pa_StopStream(stream);
if (err != paNoError)
fprintf(stderr, "* SPU-2: PortAudio error: %s\n", Pa_GetErrorText(err));
fprintf(stderr, "* SPU2: PortAudio error: %s\n", Pa_GetErrorText(err));
}
err = Pa_CloseStream(stream);
if (err != paNoError)
fprintf(stderr, "* SPU-2: PortAudio error: %s\n", Pa_GetErrorText(err));
fprintf(stderr, "* SPU2: PortAudio error: %s\n", Pa_GetErrorText(err));
stream = NULL;
stream = nullptr;
}
// Seems to do more harm than good.
//PaError err = Pa_Terminate();
//if( err != paNoError )
// fprintf(stderr,"* SPU-2: PortAudio error: %s\n", Pa_GetErrorText( err ) );
// fprintf(stderr,"* SPU2: PortAudio error: %s\n", Pa_GetErrorText( err ) );
started = false;
}
@ -550,7 +550,7 @@ public:
PaError err = Pa_Initialize(); // Initialization can be done multiple times, PA keeps a counter
if (err != paNoError)
{
fprintf(stderr, "* SPU-2: PortAudio error: %s\n", Pa_GetErrorText(err));
fprintf(stderr, "* SPU2: PortAudio error: %s\n", Pa_GetErrorText(err));
return;
}
// keep portaudio initialized until the dialog closes

View File

@ -89,7 +89,7 @@ struct SDLAudioMod : public SndOutModule
// Mandatory otherwise, init will be redone in SDL_OpenAudio
if (SDL_Init(SDL_INIT_AUDIO) < 0)
{
std::cerr << "SPU-2: SDL INIT audio error: " << SDL_GetError() << std::endl;
std::cerr << "SPU2: SDL INIT audio error: " << SDL_GetError() << std::endl;
return -1;
}
@ -101,15 +101,15 @@ struct SDLAudioMod : public SndOutModule
// Reopen the audio
if (SDL_AudioInit(m_api.c_str()) < 0)
{
std::cerr << "SPU-2: SDL audio init error: " << SDL_GetError() << std::endl;
std::cerr << "SPU2: SDL audio init error: " << SDL_GetError() << std::endl;
return -1;
}
}
#endif
if (SDL_OpenAudio(&spec, NULL) < 0)
if (SDL_OpenAudio(&spec, nullptr) < 0)
{
std::cerr << "SPU-2: SDL audio error: " << SDL_GetError() << std::endl;
std::cerr << "SPU2: SDL audio error: " << SDL_GetError() << std::endl;
return -1;
}
@ -118,11 +118,11 @@ struct SDLAudioMod : public SndOutModule
#endif
/* This is so ugly. It is hilariously ugly. I didn't use a vector to save reallocs. */
if (samples != spec.samples || buffer == NULL)
if (samples != spec.samples || buffer == nullptr)
buffer = std::unique_ptr<StereoOut_SDL[]>(new StereoOut_SDL[spec.samples]);
if (samples != spec.samples)
{
fprintf(stderr, "SPU-2: SDL failed to get desired samples (%d) got %d samples instead\n", samples, spec.samples);
fprintf(stderr, "SPU2: SDL failed to get desired samples (%d) got %d samples instead\n", samples, spec.samples);
// Samples must always be a multiple of packet size.
assert(spec.samples % SndOutPacketSize == 0);

View File

@ -22,7 +22,7 @@
//Uncomment the next line to use the old time stretcher
//#define SPU2X_USE_OLD_STRETCHER
static soundtouch::SoundTouch* pSoundTouch = NULL;
static soundtouch::SoundTouch* pSoundTouch = nullptr;
// data prediction amount, used to "commit" data that hasn't
// finished timestretch processing.
@ -380,7 +380,7 @@ void SndBuffer::UpdateTempoChangeSoundTouch()
pSoundTouch->setTempo(eTempo = (float)newTempo);
/*ConLog("* SPU-2: [Nominal %d%%] [Emergency: %d%%] (baseTempo: %d%% ) (newTempo: %d%%) (buffer: %d%%)\n",
/*ConLog("* SPU2: [Nominal %d%%] [Emergency: %d%%] (baseTempo: %d%% ) (newTempo: %d%%) (buffer: %d%%)\n",
//(relation < 0.0) ? "Normalize" : "",
(int)(tempoChange * 100.0 * 0.03),
(int)(emergencyAdj * 100.0),
@ -541,7 +541,7 @@ void SndBuffer::soundtouchInit()
// reset timestretch management vars, and delay updates a bit:
void SndBuffer::soundtouchClearContents()
{
if (pSoundTouch == NULL)
if (pSoundTouch == nullptr)
return;
pSoundTouch->clear();

View File

@ -42,7 +42,7 @@ WavOutFile::WavOutFile(const char* fileName, int sampleRate, int bits, int chann
{
bytesWritten = 0;
fptr = fopen(fileName, "wb");
if (fptr == NULL)
if (fptr == nullptr)
{
string msg = "Error : Unable to open file \"";
msg += fileName;

View File

@ -67,8 +67,8 @@ namespace WaveDump
}
catch (std::runtime_error& ex)
{
printf("SPU-2 > %s.\n\tWave Log for this core source disabled.", ex.what());
m_CoreWav[cidx][srcidx] = NULL;
printf("SPU2 > %s.\n\tWave Log for this core source disabled.", ex.what());
m_CoreWav[cidx][srcidx] = nullptr;
}
}
}
@ -91,7 +91,7 @@ namespace WaveDump
{
if (!IsDevBuild)
return;
if (m_CoreWav[coreidx][src] != NULL)
if (m_CoreWav[coreidx][src] != nullptr)
m_CoreWav[coreidx][src]->write((s16*)&sample, 2);
}
@ -107,7 +107,7 @@ using namespace Threading;
bool WavRecordEnabled = false;
static WavOutFile* m_wavrecord = NULL;
static WavOutFile* m_wavrecord = nullptr;
static Mutex WavRecordMutex;
void RecordStart(std::wstring* filename)
@ -130,8 +130,8 @@ void RecordStart(std::wstring* filename)
}
catch (std::runtime_error&)
{
m_wavrecord = NULL; // not needed, but what the heck. :)
SysMessage("SPU-2 couldn't open file for recording: %s.\nRecording to wavfile disabled.", "audio_recording.wav");
m_wavrecord = nullptr; // not needed, but what the heck. :)
SysMessage("SPU2 couldn't open file for recording: %s.\nRecording to wavfile disabled.", "audio_recording.wav");
}
}
@ -145,7 +145,7 @@ void RecordStop()
void RecordWrite(const StereoOut16& sample)
{
ScopedLock lock(WavRecordMutex);
if (m_wavrecord == NULL)
if (m_wavrecord == nullptr)
return;
m_wavrecord->write((s16*)&sample, 2);
}

View File

@ -32,7 +32,7 @@ void SysMessage(const char* fmt, ...)
va_end(list);
swprintf_s(wtmp, L"%S", tmp);
MessageBox((!!gsWindowHandle) ? (HWND)gsWindowHandle : GetActiveWindow(), wtmp,
L"SPU-2 System Message", MB_OK | MB_SETFOREGROUND);
L"SPU2 System Message", MB_OK | MB_SETFOREGROUND);
}
void SysMessage(const wchar_t* fmt, ...)
@ -43,7 +43,7 @@ void SysMessage(const wchar_t* fmt, ...)
wtmp.PrintfV(fmt, list);
va_end(list);
MessageBox((!!gsWindowHandle) ? (HWND)gsWindowHandle : GetActiveWindow(), wtmp,
L"SPU-2 System Message", MB_OK | MB_SETFOREGROUND);
L"SPU2 System Message", MB_OK | MB_SETFOREGROUND);
}
//////
@ -54,7 +54,7 @@ static wxString CfgFile(L"inis/SPU2.ini");
void CfgSetSettingsDir(const char* dir)
{
CfgFile = Path::Combine((dir == NULL) ? wxString(L"inis") : wxString::FromUTF8(dir), L"SPU2.ini");
CfgFile = Path::Combine((dir == nullptr) ? wxString(L"inis") : wxString::FromUTF8(dir), L"SPU2.ini");
}

View File

@ -150,11 +150,11 @@ void ReadSettings()
Clampify(SndOutLatencyMS, LATENCY_MIN, LATENCY_MAX);
if (mods[OutputModule] == NULL)
if (mods[OutputModule] == nullptr)
{
// Unsupported or legacy module.
fwprintf(stderr, L"* SPU-2: Unknown output module '%s' specified in configuration file.\n", omodid);
fprintf(stderr, "* SPU-2: Defaulting to DirectSound (%S).\n", DSoundOut->GetIdent());
fwprintf(stderr, L"* SPU2: Unknown output module '%s' specified in configuration file.\n", omodid);
fprintf(stderr, "* SPU2: Defaulting to DirectSound (%S).\n", DSoundOut->GetIdent());
OutputModule = FindOutputModuleById(DSoundOut->GetIdent());
}
}
@ -251,7 +251,7 @@ BOOL CALLBACK ConfigProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
SendDialogMsg(hWnd, IDC_OUTPUT, CB_RESETCONTENT, 0, 0);
int modidx = 0;
while (mods[modidx] != NULL)
while (mods[modidx] != nullptr)
{
swprintf_s(temp, 72, L"%d - %s", modidx, mods[modidx]->GetLongName());
SendDialogMsg(hWnd, IDC_OUTPUT, CB_ADDSTRING, 0, (LPARAM)temp);
@ -323,7 +323,7 @@ BOOL CALLBACK ConfigProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case IDC_OUTCONF:
{
const int module = (int)SendMessage(GetDlgItem(hWnd, IDC_OUTPUT), CB_GETCURSEL, 0, 0);
if (mods[module] == NULL)
if (mods[module] == nullptr)
break;
mods[module]->Configure((uptr)hWnd);
}
@ -435,7 +435,7 @@ void configure()
{
INT_PTR ret;
ReadSettings();
ret = DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_CONFIG), GetActiveWindow(), (DLGPROC)ConfigProc, 1);
ret = DialogBoxParam(nullptr, MAKEINTRESOURCE(IDD_CONFIG), GetActiveWindow(), (DLGPROC)ConfigProc, 1);
if (ret == -1)
{
MessageBox(GetActiveWindow(), L"Error Opening the config dialog.", L"OMG ERROR!", MB_OK | MB_SETFOREGROUND);

View File

@ -38,7 +38,7 @@ bool _RegDump = false;
bool _visual_debug_enabled = false;
// this is set true if PCSX2 invokes the SetLogDir callback, which tells SPU-2 to use that over
// this is set true if PCSX2 invokes the SetLogDir callback, which tells SPU2 to use that over
// the configured crap in the ini file.
static bool LogLocationSetByPcsx2 = false;
@ -58,9 +58,9 @@ wxString RegDumpFileName;
void CfgSetLogDir(const char* dir)
{
LogsFolder = (dir == NULL) ? wxString(L"logs") : wxString(dir, wxConvFile);
DumpsFolder = (dir == NULL) ? wxString(L"logs") : wxString(dir, wxConvFile);
LogLocationSetByPcsx2 = (dir != NULL);
LogsFolder = (dir == nullptr) ? wxString(L"logs") : wxString(dir, wxConvFile);
DumpsFolder = (dir == nullptr) ? wxString(L"logs") : wxString(dir, wxConvFile);
LogLocationSetByPcsx2 = (dir != nullptr);
}
FILE* OpenBinaryLog(const wxString& logfile)
@ -263,7 +263,7 @@ namespace DebugConfig
void OpenDialog()
{
INT_PTR ret = DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_CONFIG_DEBUG), GetActiveWindow(), (DLGPROC)DialogProc, 1);
INT_PTR ret = DialogBoxParam(nullptr, MAKEINTRESOURCE(IDD_CONFIG_DEBUG), GetActiveWindow(), (DLGPROC)DialogProc, 1);
if (ret == -1)
{
MessageBox(GetActiveWindow(), L"Error Opening the debug configuration dialog.", L"OMG ERROR!", MB_OK | MB_SETFOREGROUND);

View File

@ -128,7 +128,7 @@ BOOL CALLBACK SoundtouchCfg::DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
void SoundtouchCfg::OpenDialog(HWND hWnd)
{
INT_PTR ret;
ret = DialogBox(NULL, MAKEINTRESOURCE(IDD_CONFIG_SOUNDTOUCH), hWnd, (DLGPROC)DialogProc);
ret = DialogBox(nullptr, MAKEINTRESOURCE(IDD_CONFIG_SOUNDTOUCH), hWnd, (DLGPROC)DialogProc);
if (ret == -1)
{
MessageBox(GetActiveWindow(), L"Error Opening the Soundtouch advanced dialog.", L"OMG ERROR!", MB_OK | MB_SETFOREGROUND);

View File

@ -18,7 +18,7 @@
#include "Dialogs.h"
bool debugDialogOpen = false;
HWND hDebugDialog = NULL;
HWND hDebugDialog = nullptr;
#ifdef PCSX2_DEVBUILD
@ -45,7 +45,7 @@ BOOL DrawRectangle(HDC dc, int left, int top, int width, int height)
}
HFONT hf = NULL;
HFONT hf = nullptr;
int lCount = 0;
void UpdateDebugDialog()
{

View File

@ -25,7 +25,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
IDD_CONFIG DIALOGEX 0, 0, 310, 260
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "SPU-2 Settings"
CAPTION "SPU2 Settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x0
BEGIN
PUSHBUTTON "OK",IDOK,101,238,50,14,NOT WS_TABSTOP
@ -62,7 +62,7 @@ END
IDD_DEBUG DIALOGEX 0, 0, 303, 473
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "SPU-2 Debug"
CAPTION "SPU2 Debug"
FONT 9, "Lucida Console", 400, 0, 0x0
BEGIN
DEFPUSHBUTTON "Close",IDOK,246,451,50,14
@ -104,7 +104,7 @@ END
IDD_CONFIG_SOUNDTOUCH DIALOGEX 0, 0, 206, 223
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Soundtouch Advanced Configuration - SPU-2"
CAPTION "Soundtouch Advanced Configuration - SPU2"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,50,201,50,14
@ -127,7 +127,7 @@ END
IDD_CONFIG_DEBUG DIALOGEX 0, 0, 292, 239
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "SPU-2 Debugging Options"
CAPTION "SPU2 Debugging Options"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,93,217,50,14
@ -238,12 +238,12 @@ BEGIN
BEGIN
VALUE "Comments", "SPU2 Plugin for PS2 Emulators"
VALUE "CompanyName", "PCSX2 Dev Team"
VALUE "FileDescription", "SPU-2 Plugin (git build)"
VALUE "FileDescription", "SPU2 Plugin (git build)"
VALUE "FileVersion", "2.0.GIT"
VALUE "InternalName", "SPU-2"
VALUE "InternalName", "SPU2"
VALUE "LegalCopyright", "Copyright (C) 2011"
VALUE "OriginalFilename", "SPU-2-2.0.dll"
VALUE "ProductName", "SPU-2"
VALUE "OriginalFilename", "SPU2-2.0.dll"
VALUE "ProductName", "SPU2"
VALUE "ProductVersion", "2.0.GIT"
END
END

View File

@ -85,7 +85,7 @@ private:
if (FAILED(buffer->Lock(poffset, BufferSizeBytes, (LPVOID*)&p1, &s1, &p2, &s2, 0)))
{
assert(0);
fputs("* SPU-2: Directsound Warning > Buffer lock failure. You may need to increase\n\tyour configured DSound buffer count.\n", stderr);
fputs("* SPU2: Directsound Warning > Buffer lock failure. You may need to increase\n\tyour configured DSound buffer count.\n", stderr);
continue;
}
oldp1 = p1;
@ -104,7 +104,7 @@ private:
public:
s32 Init()
{
CoInitializeEx(NULL, COINIT_MULTITHREADED);
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
//
// Initialize DSound
@ -117,13 +117,13 @@ public:
throw std::runtime_error("screw it");
if ((FAILED(IIDFromString(m_Device, &cGuid))) ||
FAILED(DirectSoundCreate8(&cGuid, &dsound, NULL)))
FAILED(DirectSoundCreate8(&cGuid, &dsound, nullptr)))
throw std::runtime_error("try again?");
}
catch (std::runtime_error&)
{
// if the GUID failed, just open up the default dsound driver:
if (FAILED(DirectSoundCreate8(NULL, &dsound, NULL)))
if (FAILED(DirectSoundCreate8(nullptr, &dsound, nullptr)))
throw std::runtime_error("DirectSound failed to initialize!");
}
@ -179,7 +179,7 @@ public:
throw std::runtime_error("DirectSound Error: Buffer could not be created.");
}
if (FAILED(buffer_->QueryInterface(IID_IDirectSoundBuffer8, (void**)&buffer)) || buffer == NULL)
if (FAILED(buffer_->QueryInterface(IID_IDirectSoundBuffer8, (void**)&buffer)) || buffer == nullptr)
throw std::runtime_error("DirectSound Error: Interface could not be queried.");
buffer_->Release();
@ -189,7 +189,7 @@ public:
for (uint i = 0; i < m_NumBuffers; i++)
{
buffer_events[i] = CreateEvent(NULL, FALSE, FALSE, NULL);
buffer_events[i] = CreateEvent(nullptr, FALSE, FALSE, nullptr);
not[i].dwOffset = (wfx.nBlockAlign + BufferSizeBytes * (i + 1)) % desc.dwBufferBytes;
not[i].hEventNotify = buffer_events[i];
}
@ -210,7 +210,7 @@ public:
// Start Thread
myLastWrite = 0;
dsound_running = true;
thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)RThread<StereoOut16>, this, 0, &tid);
thread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)RThread<StereoOut16>, this, 0, &tid);
SetThreadPriority(thread, THREAD_PRIORITY_ABOVE_NORMAL);
return 0;
@ -219,7 +219,7 @@ public:
void Close()
{
// Stop Thread
fprintf(stderr, "* SPU-2: Waiting for DSound thread to finish...");
fprintf(stderr, "* SPU2: Waiting for DSound thread to finish...");
dsound_running = false;
WaitForSingleObject(thread, INFINITE);
@ -230,15 +230,15 @@ public:
//
// Clean up
//
if (buffer != NULL)
if (buffer != nullptr)
{
buffer->Stop();
for (u32 i = 0; i < m_NumBuffers; i++)
{
if (buffer_events[i] != NULL)
if (buffer_events[i] != nullptr)
CloseHandle(buffer_events[i]);
buffer_events[i] = NULL;
buffer_events[i] = nullptr;
}
safe_release(buffer_notify);
@ -285,7 +285,7 @@ private:
SendMessage(GetDlgItem(hWnd, IDC_DS_DEVICE), CB_RESETCONTENT, 0, 0);
ndevs = 0;
DirectSoundEnumerate(DSEnumCallback, NULL);
DirectSoundEnumerate(DSEnumCallback, nullptr);
tSel = -1;
for (int i = 0; i < ndevs; i++)
@ -411,7 +411,7 @@ public:
virtual void Configure(uptr parent)
{
INT_PTR ret;
ret = DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_DSOUND), (HWND)parent, (DLGPROC)ConfigProc, 1);
ret = DialogBoxParam(nullptr, MAKEINTRESOURCE(IDD_DSOUND), (HWND)parent, (DLGPROC)ConfigProc, 1);
if (ret == -1)
{
MessageBox((HWND)parent, L"Error Opening the config dialog.", L"OMG ERROR!", MB_OK | MB_SETFOREGROUND);
@ -480,7 +480,7 @@ BOOL CALLBACK DSound::ConfigProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa
BOOL CALLBACK DSound::DSEnumCallback(LPGUID lpGuid, LPCTSTR lpcstrDescription, LPCTSTR lpcstrModule, LPVOID lpContext)
{
pxAssume(DSoundOut != NULL);
pxAssume(DSoundOut != nullptr);
return DS._DSEnumCallback(lpGuid, lpcstrDescription, lpcstrModule, lpContext);
}

View File

@ -172,7 +172,7 @@ public:
// love it needs and won't suck resources idling pointlessly. Just don't try to
// run it in uber-low-latency mode.
waveout_running = true;
thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)RThread<StereoOut16>, this, 0, &tid);
thread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)RThread<StereoOut16>, this, 0, &tid);
return 0;
}
@ -180,7 +180,7 @@ public:
void Close()
{
// Stop Thread
fprintf(stderr, "* SPU-2: Waiting for waveOut thread to finish...");
fprintf(stderr, "* SPU2: Waiting for waveOut thread to finish...");
waveout_running = false;
WaitForSingleObject(thread, INFINITE);
@ -279,7 +279,7 @@ public:
virtual void Configure(uptr parent)
{
INT_PTR ret;
ret = DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_WAVEOUT), (HWND)parent, (DLGPROC)ConfigProc, 1);
ret = DialogBoxParam(nullptr, MAKEINTRESOURCE(IDD_WAVEOUT), (HWND)parent, (DLGPROC)ConfigProc, 1);
if (ret == -1)
{
MessageBox((HWND)parent, L"Error Opening the config dialog.", L"OMG ERROR!", MB_OK | MB_SETFOREGROUND);

View File

@ -27,11 +27,11 @@ extern "C" {
typedef winampDSPHeader* (*pWinampDSPGetHeader2)();
}
HMODULE hLib = NULL;
pWinampDSPGetHeader2 pGetHeader = NULL;
winampDSPHeader* pHeader = NULL;
HMODULE hLib = nullptr;
pWinampDSPGetHeader2 pGetHeader = nullptr;
winampDSPHeader* pHeader = nullptr;
winampDSPModule* pModule = NULL;
winampDSPModule* pModule = nullptr;
HWND hTemp;
@ -52,7 +52,7 @@ s32 DspLoadLibrary(wchar_t* fileName, int modNum)
return -1;
running = true;
hUpdateThread = CreateThread(NULL, 0, DspUpdateThread, NULL, 0, &UpdateThreadId);
hUpdateThread = CreateThread(nullptr, 0, DspUpdateThread, nullptr, 0, &UpdateThreadId);
return (hUpdateThread == INVALID_HANDLE_VALUE);
}
@ -73,7 +73,7 @@ s32 DspLoadLibrary2(wchar_t* fileName, int modNum)
if (!pGetHeader)
{
FreeLibrary(hLib);
hLib = NULL;
hLib = nullptr;
return 1;
}
@ -83,10 +83,10 @@ s32 DspLoadLibrary2(wchar_t* fileName, int modNum)
if (!pModule)
{
pGetHeader = NULL;
pHeader = NULL;
pGetHeader = nullptr;
pHeader = nullptr;
FreeLibrary(hLib);
hLib = NULL;
hLib = nullptr;
return -1;
}
@ -107,7 +107,7 @@ void DspCloseLibrary()
running = false;
if (WaitForSingleObject(hUpdateThread, 1000) == WAIT_TIMEOUT)
{
ConLog("SPU-2: WARNING: DSP Thread did not close itself in time. Assuming hung. Terminating.\n");
ConLog("SPU2: WARNING: DSP Thread did not close itself in time. Assuming hung. Terminating.\n");
TerminateThread(hUpdateThread, 1);
}
}
@ -123,10 +123,10 @@ void DspCloseLibrary2()
pModule->Quit(pModule);
FreeLibrary(hLib);
}
pModule = NULL;
pHeader = NULL;
pGetHeader = NULL;
hLib = NULL;
pModule = nullptr;
pHeader = nullptr;
pGetHeader = nullptr;
hLib = nullptr;
}
int DspProcess(s16* buffer, int samples)
@ -158,7 +158,7 @@ DWORD WINAPI DspUpdateThread(PVOID param)
while (running)
{
GetMessage(&msg, 0, 0, 0);
if ((msg.hwnd == NULL) && (msg.message == WM_QUIT))
if ((msg.hwnd == nullptr) && (msg.message == WM_QUIT))
{
break;
}

View File

@ -458,7 +458,7 @@ struct V_Core
// uninitialized constructor
V_Core()
: Index(-1)
, DMAPtr(NULL)
, DMAPtr(nullptr)
{
}
V_Core(int idx); // our badass constructor

View File

@ -183,7 +183,7 @@ Core attributes (SD_C)
// --------------------------------------------------------------------------------------
// SPU-2 Register Table LUT
// SPU2 Register Table LUT
// --------------------------------------------------------------------------------------
#define U16P(x) ((u16*)&(x))

View File

@ -42,7 +42,7 @@ static bool IsInitialized = false;
static u32 pClocks = 0;
u32* cyclePtr = NULL;
u32* cyclePtr = nullptr;
u32 lClocks = 0;
//static bool cpu_detected = false;
@ -58,7 +58,7 @@ static bool CheckSSE()
}
if( !x86caps.hasStreamingSIMDExtensions || !x86caps.hasStreamingSIMD2Extensions )
{
SysMessage( "Your CPU does not support SSE2 instructions.\nThe SPU-2 plugin requires SSE2 to run." );
SysMessage( "Your CPU does not support SSE2 instructions.\nThe SPU2 plugin requires SSE2 to run." );
return false;
}
return true;
@ -104,7 +104,7 @@ void SPU2setLogDir(const char* dir)
void SPU2readDMA4Mem(u16* pMem, u32 size) // size now in 16bit units
{
if (cyclePtr != NULL)
if (cyclePtr != nullptr)
TimeUpdate(*cyclePtr);
FileLog("[%10d] SPU2 readDMA4Mem size %x\n", Cycles, size << 1);
@ -113,7 +113,7 @@ void SPU2readDMA4Mem(u16* pMem, u32 size) // size now in 16bit units
void SPU2writeDMA4Mem(u16* pMem, u32 size) // size now in 16bit units
{
if (cyclePtr != NULL)
if (cyclePtr != nullptr)
TimeUpdate(*cyclePtr);
FileLog("[%10d] SPU2 writeDMA4Mem size %x at address %x\n", Cycles, size << 1, Cores[0].TSA);
@ -140,7 +140,7 @@ void SPU2interruptDMA7()
void SPU2readDMA7Mem(u16* pMem, u32 size)
{
if (cyclePtr != NULL)
if (cyclePtr != nullptr)
TimeUpdate(*cyclePtr);
FileLog("[%10d] SPU2 readDMA7Mem size %x\n", Cycles, size << 1);
@ -149,7 +149,7 @@ void SPU2readDMA7Mem(u16* pMem, u32 size)
void SPU2writeDMA7Mem(u16* pMem, u32 size)
{
if (cyclePtr != NULL)
if (cyclePtr != nullptr)
TimeUpdate(*cyclePtr);
FileLog("[%10d] SPU2 writeDMA7Mem size %x at address %x\n", Cycles, size << 1, Cores[1].TSA);
@ -173,7 +173,7 @@ s32 SPU2reset()
}
catch (std::exception& ex)
{
fprintf(stderr, "SPU-2 Error: Could not initialize device, or something.\nReason: %s", ex.what());
fprintf(stderr, "SPU2 Error: Could not initialize device, or something.\nReason: %s", ex.what());
SPU2close();
return -1;
}
@ -204,7 +204,7 @@ s32 SPU2ps1reset()
}
catch (std::exception& ex)
{
fprintf(stderr, "SPU-2 Error: Could not initialize device, or something.\nReason: %s", ex.what());
fprintf(stderr, "SPU2 Error: Could not initialize device, or something.\nReason: %s", ex.what());
SPU2close();
return -1;
}
@ -222,11 +222,11 @@ s32 SPU2ps1reset()
s32 SPU2init()
{
assert(regtable[0x400] == NULL);
assert(regtable[0x400] == nullptr);
if (IsInitialized)
{
printf(" * SPU-2: Already initialized - Ignoring SPU2init signal.");
printf(" * SPU2: Already initialized - Ignoring SPU2init signal.");
return 0;
}
@ -239,11 +239,11 @@ s32 SPU2init()
if (AccessLog())
{
spu2Log = OpenLog(AccessLogFileName);
setvbuf(spu2Log, NULL, _IONBF, 0);
setvbuf(spu2Log, nullptr, _IONBF, 0);
FileLog("SPU2init\n");
}
#endif
srand((unsigned)time(NULL));
srand((unsigned)time(nullptr));
spu2regs = (s16*)malloc(0x010000);
_spu2mem = (s16*)malloc(0x200000);
@ -257,13 +257,13 @@ s32 SPU2init()
pcm_cache_data = (PcmCacheEntry*)calloc(pcm_BlockCount, sizeof(PcmCacheEntry));
if ((spu2regs == NULL) || (_spu2mem == NULL) || (pcm_cache_data == NULL))
if ((spu2regs == nullptr) || (_spu2mem == nullptr) || (pcm_cache_data == nullptr))
{
SysMessage("SPU-2: Error allocating Memory\n");
SysMessage("SPU2: Error allocating Memory\n");
return -1;
}
// Patch up a copy of regtable that directly maps "NULLs" to SPU2 memory.
// Patch up a copy of regtable that directly maps "nullptrs" to SPU2 memory.
memcpy(regtable, regtable_original, sizeof(regtable));
@ -338,7 +338,7 @@ s32 SPU2open(void* pDsp)
FileLog("[%10d] SPU2 Open\n", Cycles);
if (pDsp != NULL)
if (pDsp != nullptr)
gsWindowHandle = *(uptr*)pDsp;
else
gsWindowHandle = 0;
@ -349,7 +349,7 @@ s32 SPU2open(void* pDsp)
{
if (debugDialogOpen == 0)
{
hDebugDialog = CreateDialogParam(NULL, MAKEINTRESOURCE(IDD_DEBUG), 0, DebugProc, 0);
hDebugDialog = CreateDialogParam(nullptr, MAKEINTRESOURCE(IDD_DEBUG), 0, DebugProc, 0);
ShowWindow(hDebugDialog, SW_SHOWNORMAL);
debugDialogOpen = 1;
}
@ -363,7 +363,7 @@ s32 SPU2open(void* pDsp)
#endif
IsOpened = true;
lClocks = (cyclePtr != NULL) ? *cyclePtr : 0;
lClocks = (cyclePtr != nullptr) ? *cyclePtr : 0;
try
{
@ -376,7 +376,7 @@ s32 SPU2open(void* pDsp)
}
catch (std::exception& ex)
{
fprintf(stderr, "SPU-2 Error: Could not initialize device, or something.\nReason: %s", ex.what());
fprintf(stderr, "SPU2 Error: Could not initialize device, or something.\nReason: %s", ex.what());
SPU2close();
return -1;
}
@ -408,7 +408,7 @@ void SPU2shutdown()
IsInitialized = false;
SPU2_dummy_callback = false;
ConLog("* SPU-2: Shutting down.\n");
ConLog("* SPU2: Shutting down.\n");
SPU2close();
@ -458,7 +458,7 @@ void SPU2async(u32 cycles)
{
DspUpdate();
if (cyclePtr != NULL)
if (cyclePtr != nullptr)
{
TimeUpdate(*cyclePtr);
}
@ -540,7 +540,7 @@ u16 SPU2read(u32 rmem)
}
else
{
if (cyclePtr != NULL)
if (cyclePtr != nullptr)
TimeUpdate(*cyclePtr);
if (rmem >> 16 == 0x1f80)
@ -550,7 +550,7 @@ u16 SPU2read(u32 rmem)
else if (mem >= 0x800)
{
ret = spu2Ru16(mem);
ConLog("* SPU-2: Read from reg>=0x800: %x value %x\n", mem, ret);
ConLog("* SPU2: Read from reg>=0x800: %x value %x\n", mem, ret);
}
else
{
@ -574,7 +574,7 @@ void SPU2write(u32 rmem, u16 value)
// If the SPU2 isn't in in sync with the IOP, samples can end up playing at rather
// incorrect pitches and loop lengths.
if (cyclePtr != NULL)
if (cyclePtr != nullptr)
TimeUpdate(*cyclePtr);
if (rmem >> 16 == 0x1f80)
@ -601,10 +601,10 @@ int SPU2setupRecording(int start, std::wstring* filename)
s32 SPU2freeze(int mode, freezeData* data)
{
pxAssume(data != NULL);
pxAssume(data != nullptr);
if (!data)
{
printf("SPU-2 savestate null pointer!\n");
printf("SPU2 savestate null pointer!\n");
return -1;
}
@ -616,9 +616,9 @@ s32 SPU2freeze(int mode, freezeData* data)
pxAssume(mode == FREEZE_LOAD || mode == FREEZE_SAVE);
if (data->data == NULL)
if (data->data == nullptr)
{
printf("SPU-2 savestate null pointer!\n");
printf("SPU2 savestate null pointer!\n");
return -1;
}
@ -648,10 +648,10 @@ void SPU2DoFreezeOut(void* dest)
if (!fP.size)
return;
Console.Indent().WriteLn("Saving SPU-2");
Console.Indent().WriteLn("Saving SPU2");
if (SPU2freeze(FREEZE_SAVE, &fP) != 0)
throw std::runtime_error(" * SPU-2: Error saving state!\n");
throw std::runtime_error(" * SPU2: Error saving state!\n");
}
@ -659,18 +659,18 @@ void SPU2DoFreezeIn(pxInputStream& infp)
{
ScopedLock lock(mtx_SPU2Status);
freezeData fP = {0, NULL};
freezeData fP = {0, nullptr};
if (SPU2freeze(FREEZE_SIZE, &fP) != 0)
fP.size = 0;
Console.Indent().WriteLn("Loading SPU-2");
Console.Indent().WriteLn("Loading SPU2");
if (!infp.IsOk() || !infp.Length())
{
// no state data to read, but SPU-2 expects some state data?
// no state data to read, but SPU2 expects some state data?
// Issue a warning to console...
if (fP.size != 0)
Console.Indent().Warning("Warning: No data for SPU-2 found. Status may be unpredictable.");
Console.Indent().Warning("Warning: No data for SPU2 found. Status may be unpredictable.");
return;
@ -685,5 +685,5 @@ void SPU2DoFreezeIn(pxInputStream& infp)
infp.Read(fP.data, fP.size);
if (SPU2freeze(FREEZE_LOAD, &fP) != 0)
throw std::runtime_error(" * SPU-2: Error loading state!\n");
throw std::runtime_error(" * SPU2: Error loading state!\n");
}

View File

@ -19,7 +19,7 @@
namespace SPU2Savestate
{
// Arbitrary ID to identify SPU-2 saves.
// Arbitrary ID to identify SPU2 saves.
static const u32 SAVE_ID = 0x1227521;
// versioning for saves.
@ -34,11 +34,11 @@ namespace SPU2Savestate
struct SPU2Savestate::DataBlock
{
u32 spu2id; // SPU-2 state identifier lets ZeroGS/PeopsSPU2 know this isn't their state)
u32 spu2id; // SPU2 state identifier lets ZeroGS/PeopsSPU2 know this isn't their state)
u8 unkregs[0x10000]; // SPU2 raw register memory
u8 mem[0x200000]; // SPU2 raw sample memory
u32 version; // SPU-2 version identifier
u32 version; // SPU2 version identifier
V_Core Cores[2];
V_SPDIF Spdif;
s16 OutPos;
@ -55,9 +55,9 @@ s32 __fastcall SPU2Savestate::FreezeIt(DataBlock& spud)
pxAssertMsg(spu2regs && _spu2mem, "Looks like PCSX2 is trying to savestate while components are shut down. That's a no-no! It shouldn't crash, but the savestate will probably be corrupted.");
if (spu2regs != NULL)
if (spu2regs != nullptr)
memcpy(spud.unkregs, spu2regs, sizeof(spud.unkregs));
if (_spu2mem != NULL)
if (_spu2mem != nullptr)
memcpy(spud.mem, _spu2mem, sizeof(spud.mem));
memcpy(spud.Cores, Cores, sizeof(Cores));
@ -81,7 +81,7 @@ s32 __fastcall SPU2Savestate::ThawIt(DataBlock& spud)
{
if (spud.spu2id != SAVE_ID || spud.version < SAVE_VERSION)
{
fprintf(stderr, "\n*** SPU-2 Warning:\n");
fprintf(stderr, "\n*** SPU2 Warning:\n");
if (spud.spu2id == SAVE_ID)
fprintf(stderr, "\tSavestate version is from an older version of PCSX2.\n");
else
@ -135,12 +135,12 @@ s32 __fastcall SPU2Savestate::ThawIt(DataBlock& spud)
}
}
// HACKFIX!! DMAPtr can be invalid after a savestate load, so force it to NULL and
// HACKFIX!! DMAPtr can be invalid after a savestate load, so force it to nullptr and
// ignore it on any pending ADMA writes. (the DMAPtr concept used to work in old VM
// editions of PCSX2 with fixed addressing, but new PCSX2s have dynamic memory
// addressing).
Cores[0].DMAPtr = Cores[1].DMAPtr = NULL;
Cores[0].DMAPtr = Cores[1].DMAPtr = nullptr;
}
return 0;
}

View File

@ -27,8 +27,8 @@
#include "spu2.h" // needed until I figure out a nice solution for irqcallback dependencies.
s16* spu2regs = NULL;
s16* _spu2mem = NULL;
s16* spu2regs = nullptr;
s16* _spu2mem = nullptr;
V_CoreDebug DebugCores[2];
V_Core Cores[2];
@ -57,7 +57,7 @@ void SetIrqCall(int core)
__forceinline s16* GetMemPtr(u32 addr)
{
#ifndef DEBUG_FAST
// In case you're wondering, this assert is the reason SPU-2
// In case you're wondering, this assert is the reason SPU2
// runs so incrediously slow in Debug mode. :P
pxAssume(addr < 0x100000);
#endif
@ -83,7 +83,7 @@ __forceinline void spu2M_Write(u32 addr, s16 value)
pcm_cache_data[cacheIdx].Validated = false;
if (MsgToConsole() && MsgCache())
ConLog("* SPU-2: PcmCache Block Clear at 0x%x (cacheIdx=0x%x)\n", addr, cacheIdx);
ConLog("* SPU2: PcmCache Block Clear at 0x%x (cacheIdx=0x%x)\n", addr, cacheIdx);
}
*GetMemPtr(addr) = value;
}
@ -99,7 +99,7 @@ V_VolumeSlideLR V_VolumeSlideLR::Max(0x3FFF, 0x7FFFFFFF);
V_Core::V_Core(int coreidx)
: Index(coreidx)
//LogFile_AutoDMA( NULL )
//LogFile_AutoDMA( nullptr )
{
/*char fname[128];
sprintf( fname, "logs/adma%d.raw", GetDmaIndex() );
@ -109,16 +109,16 @@ V_Core::V_Core(int coreidx)
V_Core::~V_Core() throw()
{
// Can't use this yet because we dumb V_Core into savestates >_<
/*if( LogFile_AutoDMA != NULL )
/*if( LogFile_AutoDMA != nullptr )
{
fclose( LogFile_AutoDMA );
LogFile_AutoDMA = NULL;
LogFile_AutoDMA = nullptr;
}*/
}
void V_Core::Init(int index)
{
ConLog("* SPU-2: Init SPU2 core %d \n", index);
ConLog("* SPU2: Init SPU2 core %d \n", index);
//memset(this, 0, sizeof(V_Core));
// Explicitly initializing variables instead.
Mute = false;
@ -415,7 +415,7 @@ __forceinline void TimeUpdate(u32 cClocks)
{
if (has_to_call_irq)
{
//ConLog("* SPU-2: Irq Called (%04x) at cycle %d.\n", Spdif.Info, Cycles);
//ConLog("* SPU2: Irq Called (%04x) at cycle %d.\n", Spdif.Info, Cycles);
has_to_call_irq = false;
if (!SPU2_dummy_callback)
spu2Irq();
@ -486,7 +486,7 @@ __forceinline void UpdateSpdifMode()
if (Spdif.Out & 0x4) // use 24/32bit PCM data streaming
{
PlayMode = 8;
ConLog("* SPU-2: WARNING: Possibly CDDA mode set!\n");
ConLog("* SPU2: WARNING: Possibly CDDA mode set!\n");
return;
}
@ -506,12 +506,12 @@ __forceinline void UpdateSpdifMode()
}
if (OPM != PlayMode)
{
ConLog("* SPU-2: Play Mode Set to %s (%d).\n",
ConLog("* SPU2: Play Mode Set to %s (%d).\n",
(PlayMode == 0) ? "Normal" : ((PlayMode == 1) ? "PCM Clone" : ((PlayMode == 2) ? "PCM Bypass" : "BitStream Bypass")), PlayMode);
}
}
// Converts an SPU2 register volume write into a 32 bit SPU-2 volume. The value is extended
// Converts an SPU2 register volume write into a 32 bit SPU2 volume. The value is extended
// properly into the lower 16 bits of the value to provide a full spectrum of volumes.
static s32 GetVol32(u16 src)
{
@ -714,12 +714,12 @@ void V_Core::WriteRegPS1(u32 mem, u16 value)
case 0x1da4:
IRQA = map_spu1to2(value);
//ConLog("SPU-2 Setting IRQA to %x \n", IRQA);
//ConLog("SPU2 Setting IRQA to %x \n", IRQA);
break;
case 0x1da6:
TSA = map_spu1to2(value);
//ConLog("SPU-2 Setting TSA to %x \n", TSA);
//ConLog("SPU2 Setting TSA to %x \n", TSA);
break;
case 0x1da8: // Spu Write to Memory
@ -986,11 +986,11 @@ u16 V_Core::ReadRegPS1(u32 mem)
break;
case 0x1da4:
value = map_spu2to1(IRQA);
//ConLog("SPU-2 IRQA read: 0x1da4 = %x , (IRQA = %x)\n", value, IRQA);
//ConLog("SPU2 IRQA read: 0x1da4 = %x , (IRQA = %x)\n", value, IRQA);
break;
case 0x1da6:
value = map_spu2to1(TSA);
//ConLog("SPU-2 TSA read: 0x1da6 = %x , (TSA = %x)\n", value, TSA);
//ConLog("SPU2 TSA read: 0x1da6 = %x , (TSA = %x)\n", value, TSA);
break;
case 0x1da8:
value = DmaRead();
@ -998,14 +998,14 @@ u16 V_Core::ReadRegPS1(u32 mem)
break;
case 0x1daa:
value = Cores[0].Regs.ATTR;
//ConLog("SPU-2 ps1 reg psxSPUCNT read return value: %x\n", value);
//ConLog("SPU2 ps1 reg psxSPUCNT read return value: %x\n", value);
break;
case 0x1dac: // 1F801DACh - Sound RAM Data Transfer Control (should be 0004h)
value = psxSoundDataTransferControl;
break;
case 0x1dae:
value = Cores[0].Regs.STATX;
//ConLog("SPU-2 ps1 reg REG_P_STATX read return value: %x\n", value);
//ConLog("SPU2 ps1 reg REG_P_STATX read return value: %x\n", value);
break;
}
@ -1230,17 +1230,17 @@ static void __fastcall RegWrite_Core(u16 value)
if (value & 0x000E)
{
if (MsgToConsole())
ConLog("* SPU-2: Core %d ATTR unknown bits SET! value=%04x\n", core, value);
ConLog("* SPU2: Core %d ATTR unknown bits SET! value=%04x\n", core, value);
}
if (thiscore.AttrBit0 != bit0)
{
if (MsgToConsole())
ConLog("* SPU-2: ATTR bit 0 set to %d\n", thiscore.AttrBit0);
ConLog("* SPU2: ATTR bit 0 set to %d\n", thiscore.AttrBit0);
}
if (thiscore.IRQEnable != irqe)
{
//ConLog("* SPU-2: Core%d IRQ %s at cycle %d. Current IRQA = %x Current EffectA = %x\n",
//ConLog("* SPU2: Core%d IRQ %s at cycle %d. Current IRQA = %x Current EffectA = %x\n",
// core, ((thiscore.IRQEnable==0)?"disabled":"enabled"), Cycles, thiscore.IRQA, thiscore.EffectsStartA);
if (!thiscore.IRQEnable)
@ -1417,10 +1417,10 @@ static void __fastcall RegWrite_Core(u16 value)
case REG_S_ADMAS:
if (MsgToConsole())
ConLog("* SPU-2: Core %d AutoDMAControl set to %d (at cycle %d)\n", core, value, Cycles);
ConLog("* SPU2: Core %d AutoDMAControl set to %d (at cycle %d)\n", core, value, Cycles);
if (psxmode)
ConLog("* SPU-2: Writing to REG_S_ADMAS while in PSX mode! value: %x", value);
ConLog("* SPU2: Writing to REG_S_ADMAS while in PSX mode! value: %x", value);
// hack for ps1driver which writes -1 (and never turns the adma off after psxlogo).
// adma isn't available in psx mode either
if (value == 32767)
@ -1839,7 +1839,7 @@ static RegWriteHandler* const tbl_reg_writes[0x401] =
REGRAW(0x7F0), REGRAW(0x7F2), REGRAW(0x7F4), REGRAW(0x7F6),
REGRAW(0x7F8), REGRAW(0x7FA), REGRAW(0x7FC), REGRAW(0x7FE),
NULL // should be at 0x400! (we assert check it on startup)
nullptr // should be at 0x400! (we assert check it on startup)
};
@ -1873,7 +1873,7 @@ void StartVoices(int core, u32 value)
V_Voice& thisvc(Cores[core].Voices[vc]);
if (MsgKeyOnOff())
ConLog("* SPU-2: KeyOn: C%dV%02d: SSA: %8x; M: %s%s%s%s; H: %04x; P: %04x V: %04x/%04x; ADSR: %04x%04x\n",
ConLog("* SPU2: KeyOn: C%dV%02d: SSA: %8x; M: %s%s%s%s; H: %04x; P: %04x V: %04x/%04x; ADSR: %04x%04x\n",
core, vc, thisvc.StartA,
(Cores[core].VoiceGates[vc].DryL) ? "+" : "-", (Cores[core].VoiceGates[vc].DryR) ? "+" : "-",
(Cores[core].VoiceGates[vc].WetL) ? "+" : "-", (Cores[core].VoiceGates[vc].WetR) ? "+" : "-",
@ -1896,6 +1896,6 @@ void StopVoices(int core, u32 value)
Cores[core].Voices[vc].ADSR.Releasing = true;
if (MsgKeyOnOff())
ConLog("* SPU-2: KeyOff: Core %d; Voice %d.\n", core, vc);
ConLog("* SPU2: KeyOff: Core %d; Voice %d.\n", core, vc);
}
}