mirror of https://github.com/PCSX2/pcsx2.git
SPU2: s/NULL/nullptr/, s/SPU-2/SPU2/
This commit is contained in:
parent
5cf2147754
commit
f58d9e3f39
|
@ -20,7 +20,7 @@ int crazy_debug = 0;
|
||||||
|
|
||||||
char s[4096];
|
char s[4096];
|
||||||
|
|
||||||
FILE* spu2Log = NULL;
|
FILE* spu2Log = nullptr;
|
||||||
|
|
||||||
void FileLog(const char* fmt, ...)
|
void FileLog(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
|
|
||||||
extern u8 callirq;
|
extern u8 callirq;
|
||||||
|
|
||||||
static FILE* DMA4LogFile = NULL;
|
static FILE* DMA4LogFile = nullptr;
|
||||||
static FILE* DMA7LogFile = NULL;
|
static FILE* DMA7LogFile = nullptr;
|
||||||
static FILE* ADMA4LogFile = NULL;
|
static FILE* ADMA4LogFile = nullptr;
|
||||||
static FILE* ADMA7LogFile = NULL;
|
static FILE* ADMA7LogFile = nullptr;
|
||||||
static FILE* ADMAOutLogFile = NULL;
|
static FILE* ADMAOutLogFile = nullptr;
|
||||||
|
|
||||||
static FILE* REGWRTLogFile[2] = {0, 0};
|
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);
|
LogAutoDMA(Index ? ADMA7LogFile : ADMA4LogFile);
|
||||||
|
|
||||||
// HACKFIX!! DMAPtr can be invalid after a savestate load, so the savestate just forces it
|
// 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).
|
// addressing, but new PCSX2s have dynamic memory addressing).
|
||||||
|
|
||||||
if (mode)
|
if (mode)
|
||||||
{
|
{
|
||||||
if (DMAPtr != NULL)
|
if (DMAPtr != nullptr)
|
||||||
//memcpy((ADMATempBuffer+(spos<<1)),DMAPtr+InputDataProgress,0x400);
|
//memcpy((ADMATempBuffer+(spos<<1)),DMAPtr+InputDataProgress,0x400);
|
||||||
memcpy(GetMemPtr(0x2000 + (Index << 10) + spos), DMAPtr + InputDataProgress, 0x400);
|
memcpy(GetMemPtr(0x2000 + (Index << 10) + spos), DMAPtr + InputDataProgress, 0x400);
|
||||||
MADR += 0x400;
|
MADR += 0x400;
|
||||||
|
@ -115,14 +115,14 @@ void V_Core::AutoDMAReadBuffer(int mode) //mode: 0= split stereo; 1 = do not spl
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (DMAPtr != NULL)
|
if (DMAPtr != nullptr)
|
||||||
//memcpy((ADMATempBuffer+spos),DMAPtr+InputDataProgress,0x200);
|
//memcpy((ADMATempBuffer+spos),DMAPtr+InputDataProgress,0x200);
|
||||||
memcpy(GetMemPtr(0x2000 + (Index << 10) + spos), DMAPtr + InputDataProgress, 0x200);
|
memcpy(GetMemPtr(0x2000 + (Index << 10) + spos), DMAPtr + InputDataProgress, 0x200);
|
||||||
MADR += 0x200;
|
MADR += 0x200;
|
||||||
InputDataLeft -= 0x100;
|
InputDataLeft -= 0x100;
|
||||||
InputDataProgress += 0x100;
|
InputDataProgress += 0x100;
|
||||||
|
|
||||||
if (DMAPtr != NULL)
|
if (DMAPtr != nullptr)
|
||||||
//memcpy((ADMATempBuffer+spos+0x200),DMAPtr+InputDataProgress,0x200);
|
//memcpy((ADMATempBuffer+spos+0x200),DMAPtr+InputDataProgress,0x200);
|
||||||
memcpy(GetMemPtr(0x2200 + (Index << 10) + spos), DMAPtr + InputDataProgress, 0x200);
|
memcpy(GetMemPtr(0x2200 + (Index << 10) + spos), DMAPtr + InputDataProgress, 0x200);
|
||||||
MADR += 0x200;
|
MADR += 0x200;
|
||||||
|
@ -138,7 +138,7 @@ void V_Core::StartADMAWrite(u16* pMem, u32 sz)
|
||||||
int size = (sz) & (~511);
|
int size = (sz) & (~511);
|
||||||
|
|
||||||
if (MsgAutoDMA())
|
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);
|
GetDmaIndexChar(), size << 1, TSA, DMABits, AutoDMACtrl, (~Regs.ATTR) & 0x7fff);
|
||||||
|
|
||||||
InputDataProgress = 0;
|
InputDataProgress = 0;
|
||||||
|
@ -245,7 +245,7 @@ void V_Core::PlainDMAWrite(u16* pMem, u32 size)
|
||||||
cacheLine++;
|
cacheLine++;
|
||||||
} while (cacheLine != &cacheEnd);
|
} 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 );
|
// TSA, buff1end, flagTSA, flagTDA, clearLen );
|
||||||
|
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ void V_Core::DoDMAwrite(u16* pMem, u32 size)
|
||||||
{
|
{
|
||||||
if (TSA > 0xfffff)
|
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
|
else
|
||||||
{
|
{
|
||||||
if (MsgDMA())
|
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,
|
GetDmaIndexChar(), size << 1, TSA, DMABits, AutoDMACtrl, (~Regs.ATTR) & 0x7fff,
|
||||||
Cores[0].IRQEnable, Cores[0].IRQA);
|
Cores[0].IRQEnable, Cores[0].IRQA);
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ protected:
|
||||||
void _InternalCallback()
|
void _InternalCallback()
|
||||||
{
|
{
|
||||||
snd_pcm_sframes_t avail;
|
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);
|
avail = snd_pcm_avail_update(handle);
|
||||||
while (avail >= (int)period_time)
|
while (avail >= (int)period_time)
|
||||||
|
@ -64,16 +64,16 @@ protected:
|
||||||
// entry point for our C++ified object state. :)
|
// entry point for our C++ified object state. :)
|
||||||
static void ExternalCallback(snd_async_handler_t* pcm_call)
|
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);
|
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) );
|
//pxAssume( data->handle == snd_async_handler_get_pcm(pcm_call) );
|
||||||
|
|
||||||
// Not sure if we just need an assert, or something like this:
|
// Not sure if we just need an assert, or something like this:
|
||||||
if (data->handle != snd_async_handler_get_pcm(pcm_call))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,15 +83,15 @@ protected:
|
||||||
public:
|
public:
|
||||||
s32 Init()
|
s32 Init()
|
||||||
{
|
{
|
||||||
//fprintf(stderr,"* SPU-2: Initing Alsa\n");
|
//fprintf(stderr,"* SPU2: Initing Alsa\n");
|
||||||
snd_pcm_hw_params_t* hwparams;
|
snd_pcm_hw_params_t* hwparams;
|
||||||
snd_pcm_sw_params_t* swparams;
|
snd_pcm_sw_params_t* swparams;
|
||||||
snd_pcm_status_t* status;
|
snd_pcm_status_t* status;
|
||||||
int pchannels = 2;
|
int pchannels = 2;
|
||||||
snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
|
snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
|
||||||
|
|
||||||
handle = NULL;
|
handle = nullptr;
|
||||||
pcm_callback = NULL;
|
pcm_callback = nullptr;
|
||||||
pspeed = SAMPLE_RATE;
|
pspeed = SAMPLE_RATE;
|
||||||
|
|
||||||
// buffer time and period time are in microseconds...
|
// buffer time and period time are in microseconds...
|
||||||
|
@ -183,10 +183,10 @@ public:
|
||||||
|
|
||||||
// Bind our asynchronous callback magic:
|
// Bind our asynchronous callback magic:
|
||||||
|
|
||||||
if (handle == NULL)
|
if (handle == nullptr)
|
||||||
fprintf(stderr, "No handle.");
|
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.
|
// The external handler never seems to get called after this.
|
||||||
snd_async_add_pcm_handler(&pcm_callback, handle, ExternalCallback, this);
|
snd_async_add_pcm_handler(&pcm_callback, handle, ExternalCallback, this);
|
||||||
err = snd_pcm_start(handle);
|
err = snd_pcm_start(handle);
|
||||||
|
@ -204,13 +204,13 @@ public:
|
||||||
|
|
||||||
void Close()
|
void Close()
|
||||||
{
|
{
|
||||||
//fprintf(stderr,"* SPU-2: Closing Alsa\n");
|
//fprintf(stderr,"* SPU2: Closing Alsa\n");
|
||||||
if (handle == NULL)
|
if (handle == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
snd_pcm_drop(handle);
|
snd_pcm_drop(handle);
|
||||||
snd_pcm_close(handle);
|
snd_pcm_close(handle);
|
||||||
handle = NULL;
|
handle = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Configure(uptr parent)
|
virtual void Configure(uptr parent)
|
||||||
|
@ -226,9 +226,9 @@ public:
|
||||||
|
|
||||||
int GetEmptySampleCount()
|
int GetEmptySampleCount()
|
||||||
{
|
{
|
||||||
if (handle == NULL)
|
if (handle == nullptr)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Handle is NULL!\n");
|
fprintf(stderr, "Handle is nullptr!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,8 +171,8 @@ void ReadSettings()
|
||||||
|
|
||||||
if (mods[OutputModule] == nullptr)
|
if (mods[OutputModule] == nullptr)
|
||||||
{
|
{
|
||||||
fwprintf(stderr, L"* SPU-2: Unknown output module '%s' specified in configuration file.\n", temp.wc_str());
|
fwprintf(stderr, L"* SPU2: Unknown output module '%s' specified in configuration file.\n", temp.wc_str());
|
||||||
fprintf(stderr, "* SPU-2: Defaulting to SDL (%S).\n", SDLOut->GetIdent());
|
fprintf(stderr, "* SPU2: Defaulting to SDL (%S).\n", SDLOut->GetIdent());
|
||||||
OutputModule = FindOutputModuleById(SDLOut->GetIdent());
|
OutputModule = FindOutputModuleById(SDLOut->GetIdent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ bool _CoresDump = false;
|
||||||
bool _MemDump = false;
|
bool _MemDump = false;
|
||||||
bool _RegDump = 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.
|
// the configured crap in the ini file.
|
||||||
static bool LogLocationSetByPcsx2 = false;
|
static bool LogLocationSetByPcsx2 = false;
|
||||||
|
|
||||||
|
@ -53,9 +53,9 @@ wxString RegDumpFileName;
|
||||||
|
|
||||||
void CfgSetLogDir(const char* dir)
|
void CfgSetLogDir(const char* dir)
|
||||||
{
|
{
|
||||||
LogsFolder = (dir == NULL) ? wxString(L"logs") : fromUTF8(dir);
|
LogsFolder = (dir == nullptr) ? wxString(L"logs") : fromUTF8(dir);
|
||||||
DumpsFolder = (dir == NULL) ? wxString(L"logs") : fromUTF8(dir);
|
DumpsFolder = (dir == nullptr) ? wxString(L"logs") : fromUTF8(dir);
|
||||||
LogLocationSetByPcsx2 = (dir != NULL);
|
LogLocationSetByPcsx2 = (dir != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* OpenBinaryLog(const wxString& logfile)
|
FILE* OpenBinaryLog(const wxString& logfile)
|
||||||
|
|
|
@ -82,7 +82,7 @@ static void __forceinline XA_decode_block(s16* buffer, const s16* block, s32& pr
|
||||||
const s32 shift = (header & 0xF) + 16;
|
const s32 shift = (header & 0xF) + 16;
|
||||||
const int id = header >> 4 & 0xF;
|
const int id = header >> 4 & 0xF;
|
||||||
if (id > 4 && MsgToConsole())
|
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 pred1 = tbl_XA_Factor[id][0];
|
||||||
const s32 pred2 = tbl_XA_Factor[id][1];
|
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
|
// 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
|
// multiple times. Cache chunks are decoded when the mixer requests the blocks, and
|
||||||
// invalided when DMA transfers and memory writes are performed.
|
// 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_hits = 0;
|
||||||
int g_counter_cache_misses = 0;
|
int g_counter_cache_misses = 0;
|
||||||
|
@ -169,7 +169,7 @@ static __forceinline s32 GetNextDataBuffered(V_Core& thiscore, uint voiceidx)
|
||||||
if (IsDevBuild)
|
if (IsDevBuild)
|
||||||
{
|
{
|
||||||
if (MsgVoiceOff())
|
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.Prev1 = vc.SBuffer[27];
|
||||||
vc.Prev2 = vc.SBuffer[26];
|
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)
|
if (IsDevBuild)
|
||||||
g_counter_cache_hits++;
|
g_counter_cache_hits++;
|
||||||
|
@ -339,7 +339,7 @@ static __forceinline void CalculateADSR(V_Core& thiscore, uint voiceidx)
|
||||||
if (IsDevBuild)
|
if (IsDevBuild)
|
||||||
{
|
{
|
||||||
if (MsgVoiceOff())
|
if (MsgVoiceOff())
|
||||||
ConLog("* SPU-2: Voice Off by ADSR: %d \n", voiceidx);
|
ConLog("* SPU2: Voice Off by ADSR: %d \n", voiceidx);
|
||||||
}
|
}
|
||||||
vc.Stop();
|
vc.Stop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,27 +144,27 @@ void SPU2writeLog(const char* action, u32 rmem, u16 value)
|
||||||
break;
|
break;
|
||||||
case 0x7c4:
|
case 0x7c4:
|
||||||
if (Spdif.Unknown1 != value)
|
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);
|
RegLog(2, "SPDIF_UNKNOWN1", rmem, -1, value);
|
||||||
break;
|
break;
|
||||||
case SPDIF_MODE:
|
case SPDIF_MODE:
|
||||||
if (Spdif.Mode != value)
|
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);
|
RegLog(2, "SPDIF_MODE", rmem, -1, value);
|
||||||
break;
|
break;
|
||||||
case SPDIF_MEDIA:
|
case SPDIF_MEDIA:
|
||||||
if (Spdif.Media != value)
|
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);
|
RegLog(2, "SPDIF_MEDIA", rmem, -1, value);
|
||||||
break;
|
break;
|
||||||
case 0x7ca:
|
case 0x7ca:
|
||||||
if (Spdif.Unknown2 != value)
|
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);
|
RegLog(2, "SPDIF_UNKNOWN2", rmem, -1, value);
|
||||||
break;
|
break;
|
||||||
case SPDIF_PROTECT:
|
case SPDIF_PROTECT:
|
||||||
if (Spdif.Protection != value)
|
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);
|
RegLog(2, "SPDIF_PROTECT", rmem, -1, value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -241,11 +241,11 @@ void SPU2writeLog(const char* action, u32 rmem, u16 value)
|
||||||
RegLog(2, "TSAL", rmem, core, value);
|
RegLog(2, "TSAL", rmem, core, value);
|
||||||
break;
|
break;
|
||||||
case REG_S_ENDX:
|
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);
|
RegLog(2, "ENDX0", rmem, core, value);
|
||||||
break;
|
break;
|
||||||
case (REG_S_ENDX + 2):
|
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);
|
RegLog(2, "ENDX1", rmem, core, value);
|
||||||
break;
|
break;
|
||||||
case REG_P_MVOLL:
|
case REG_P_MVOLL:
|
||||||
|
@ -256,7 +256,7 @@ void SPU2writeLog(const char* action, u32 rmem, u16 value)
|
||||||
break;
|
break;
|
||||||
case REG_S_ADMAS:
|
case REG_S_ADMAS:
|
||||||
RegLog(3, "ADMAS", rmem, core, value);
|
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;
|
break;
|
||||||
case REG_P_STATX:
|
case REG_P_STATX:
|
||||||
RegLog(3, "STATX", rmem, core, value);
|
RegLog(3, "STATX", rmem, core, value);
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
PVCP(c, v, NextA)
|
PVCP(c, v, NextA)
|
||||||
|
|
||||||
#define PRAW(a) \
|
#define PRAW(a) \
|
||||||
((u16*)NULL)
|
((u16*)nullptr)
|
||||||
|
|
||||||
#define PREVB_REG(c, n) \
|
#define PREVB_REG(c, n) \
|
||||||
PCORE(c, Revb.n) + 1, \
|
PCORE(c, Revb.n) + 1, \
|
||||||
|
@ -77,8 +77,8 @@ u16 const* const regtable_original[0x401] =
|
||||||
PCORE(0, IRQA) + 1,
|
PCORE(0, IRQA) + 1,
|
||||||
PCORE(0, IRQA),
|
PCORE(0, IRQA),
|
||||||
|
|
||||||
NULL, NULL,
|
nullptr, nullptr,
|
||||||
NULL, NULL,
|
nullptr, nullptr,
|
||||||
|
|
||||||
PCORE(0, TSA) + 1,
|
PCORE(0, TSA) + 1,
|
||||||
PCORE(0, TSA),
|
PCORE(0, TSA),
|
||||||
|
@ -180,8 +180,8 @@ u16 const* const regtable_original[0x401] =
|
||||||
PCORE(1, IRQA) + 1,
|
PCORE(1, IRQA) + 1,
|
||||||
PCORE(1, IRQA),
|
PCORE(1, IRQA),
|
||||||
|
|
||||||
NULL, NULL,
|
nullptr, nullptr,
|
||||||
NULL, NULL,
|
nullptr, nullptr,
|
||||||
|
|
||||||
PCORE(1, TSA) + 1,
|
PCORE(1, TSA) + 1,
|
||||||
PCORE(1, TSA),
|
PCORE(1, TSA),
|
||||||
|
@ -299,4 +299,4 @@ u16 const* const regtable_original[0x401] =
|
||||||
PRAW(0x7F0), PRAW(0x7F2), PRAW(0x7F4), PRAW(0x7F6),
|
PRAW(0x7F0), PRAW(0x7F2), PRAW(0x7F4), PRAW(0x7F6),
|
||||||
PRAW(0x7F8), PRAW(0x7FA), PRAW(0x7FC), PRAW(0x7FE),
|
PRAW(0x7F8), PRAW(0x7FA), PRAW(0x7FC), PRAW(0x7FE),
|
||||||
|
|
||||||
NULL};
|
nullptr};
|
||||||
|
|
|
@ -94,13 +94,13 @@ SndOutModule* mods[] =
|
||||||
SDLOut,
|
SDLOut,
|
||||||
AlsaOut,
|
AlsaOut,
|
||||||
#endif
|
#endif
|
||||||
NULL // signals the end of our list
|
nullptr // signals the end of our list
|
||||||
};
|
};
|
||||||
|
|
||||||
int FindOutputModuleById(const wchar_t* omodid)
|
int FindOutputModuleById(const wchar_t* omodid)
|
||||||
{
|
{
|
||||||
int modcnt = 0;
|
int modcnt = 0;
|
||||||
while (mods[modcnt] != NULL)
|
while (mods[modcnt] != nullptr)
|
||||||
{
|
{
|
||||||
if (wcscmp(mods[modcnt]->GetIdent(), omodid) == 0)
|
if (wcscmp(mods[modcnt]->GetIdent(), omodid) == 0)
|
||||||
break;
|
break;
|
||||||
|
@ -115,8 +115,8 @@ __aligned(4) volatile s32 SndBuffer::m_rpos;
|
||||||
__aligned(4) volatile s32 SndBuffer::m_wpos;
|
__aligned(4) volatile s32 SndBuffer::m_wpos;
|
||||||
|
|
||||||
bool SndBuffer::m_underrun_freeze;
|
bool SndBuffer::m_underrun_freeze;
|
||||||
StereoOut32* SndBuffer::sndTempBuffer = NULL;
|
StereoOut32* SndBuffer::sndTempBuffer = nullptr;
|
||||||
StereoOut16* SndBuffer::sndTempBuffer16 = NULL;
|
StereoOut16* SndBuffer::sndTempBuffer16 = nullptr;
|
||||||
int SndBuffer::sndTempProgress = 0;
|
int SndBuffer::sndTempProgress = 0;
|
||||||
|
|
||||||
int GetAlignedBufferSize(int comp)
|
int GetAlignedBufferSize(int comp)
|
||||||
|
@ -375,7 +375,7 @@ void SndBuffer::_WriteSamples(StereoOut32* bData, int nSamples)
|
||||||
|
|
||||||
void SndBuffer::Init()
|
void SndBuffer::Init()
|
||||||
{
|
{
|
||||||
if (mods[OutputModule] == NULL)
|
if (mods[OutputModule] == nullptr)
|
||||||
{
|
{
|
||||||
_InitFail();
|
_InitFail();
|
||||||
return;
|
return;
|
||||||
|
@ -512,7 +512,7 @@ void SndBuffer::Write(const StereoOut32& Sample)
|
||||||
|
|
||||||
s32 SndBuffer::Test()
|
s32 SndBuffer::Test()
|
||||||
{
|
{
|
||||||
if (mods[OutputModule] == NULL)
|
if (mods[OutputModule] == nullptr)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return mods[OutputModule]->Test();
|
return mods[OutputModule]->Test();
|
||||||
|
|
|
@ -121,8 +121,8 @@ public:
|
||||||
m_UseHardware = false;
|
m_UseHardware = false;
|
||||||
m_WasapiExclusiveMode = false;
|
m_WasapiExclusiveMode = false;
|
||||||
started = false;
|
started = false;
|
||||||
stream = NULL;
|
stream = nullptr;
|
||||||
ActualPaCallback = NULL;
|
ActualPaCallback = nullptr;
|
||||||
m_ApiId = -1;
|
m_ApiId = -1;
|
||||||
m_SuggestedLatencyMS = 20;
|
m_SuggestedLatencyMS = 20;
|
||||||
actualUsedChannels = 0;
|
actualUsedChannels = 0;
|
||||||
|
@ -134,21 +134,21 @@ public:
|
||||||
s32 Init()
|
s32 Init()
|
||||||
{
|
{
|
||||||
started = false;
|
started = false;
|
||||||
stream = NULL;
|
stream = nullptr;
|
||||||
|
|
||||||
ReadSettings();
|
ReadSettings();
|
||||||
|
|
||||||
PaError err = Pa_Initialize();
|
PaError err = Pa_Initialize();
|
||||||
if (err != paNoError)
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
started = true;
|
started = true;
|
||||||
|
|
||||||
int deviceIndex = -1;
|
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++)
|
for (int i = 0, j = 0; i < Pa_GetDeviceCount(); i++)
|
||||||
{
|
{
|
||||||
const PaDeviceInfo* info = Pa_GetDeviceInfo(i);
|
const PaDeviceInfo* info = Pa_GetDeviceInfo(i);
|
||||||
|
@ -188,7 +188,7 @@ public:
|
||||||
|
|
||||||
if (deviceIndex >= 0)
|
if (deviceIndex >= 0)
|
||||||
{
|
{
|
||||||
void* infoPtr = NULL;
|
void* infoPtr = nullptr;
|
||||||
|
|
||||||
const PaDeviceInfo* devinfo = Pa_GetDeviceInfo(deviceIndex);
|
const PaDeviceInfo* devinfo = Pa_GetDeviceInfo(deviceIndex);
|
||||||
|
|
||||||
|
@ -289,12 +289,12 @@ public:
|
||||||
infoPtr};
|
infoPtr};
|
||||||
|
|
||||||
err = Pa_OpenStream(&stream,
|
err = Pa_OpenStream(&stream,
|
||||||
NULL, &outParams, SampleRate,
|
nullptr, &outParams, SampleRate,
|
||||||
SndOutPacketSize,
|
SndOutPacketSize,
|
||||||
paNoFlag,
|
paNoFlag,
|
||||||
PaCallback,
|
PaCallback,
|
||||||
|
|
||||||
NULL);
|
nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -302,11 +302,11 @@ public:
|
||||||
0, actualUsedChannels, paInt32, 48000,
|
0, actualUsedChannels, paInt32, 48000,
|
||||||
SndOutPacketSize,
|
SndOutPacketSize,
|
||||||
PaCallback,
|
PaCallback,
|
||||||
NULL);
|
nullptr);
|
||||||
}
|
}
|
||||||
if (err != paNoError)
|
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();
|
Pa_Terminate();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -314,9 +314,9 @@ public:
|
||||||
err = Pa_StartStream(stream);
|
err = Pa_StartStream(stream);
|
||||||
if (err != paNoError)
|
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);
|
Pa_CloseStream(stream);
|
||||||
stream = NULL;
|
stream = nullptr;
|
||||||
Pa_Terminate();
|
Pa_Terminate();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -335,20 +335,20 @@ public:
|
||||||
{
|
{
|
||||||
err = Pa_StopStream(stream);
|
err = Pa_StopStream(stream);
|
||||||
if (err != paNoError)
|
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);
|
err = Pa_CloseStream(stream);
|
||||||
if (err != paNoError)
|
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.
|
// Seems to do more harm than good.
|
||||||
//PaError err = Pa_Terminate();
|
//PaError err = Pa_Terminate();
|
||||||
//if( err != paNoError )
|
//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;
|
started = false;
|
||||||
}
|
}
|
||||||
|
@ -550,7 +550,7 @@ public:
|
||||||
PaError err = Pa_Initialize(); // Initialization can be done multiple times, PA keeps a counter
|
PaError err = Pa_Initialize(); // Initialization can be done multiple times, PA keeps a counter
|
||||||
if (err != paNoError)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
// keep portaudio initialized until the dialog closes
|
// keep portaudio initialized until the dialog closes
|
||||||
|
|
|
@ -89,7 +89,7 @@ struct SDLAudioMod : public SndOutModule
|
||||||
// Mandatory otherwise, init will be redone in SDL_OpenAudio
|
// Mandatory otherwise, init will be redone in SDL_OpenAudio
|
||||||
if (SDL_Init(SDL_INIT_AUDIO) < 0)
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,15 +101,15 @@ struct SDLAudioMod : public SndOutModule
|
||||||
// Reopen the audio
|
// Reopen the audio
|
||||||
if (SDL_AudioInit(m_api.c_str()) < 0)
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,11 +118,11 @@ struct SDLAudioMod : public SndOutModule
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This is so ugly. It is hilariously ugly. I didn't use a vector to save reallocs. */
|
/* 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]);
|
buffer = std::unique_ptr<StereoOut_SDL[]>(new StereoOut_SDL[spec.samples]);
|
||||||
if (samples != 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.
|
// Samples must always be a multiple of packet size.
|
||||||
assert(spec.samples % SndOutPacketSize == 0);
|
assert(spec.samples % SndOutPacketSize == 0);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
//Uncomment the next line to use the old time stretcher
|
//Uncomment the next line to use the old time stretcher
|
||||||
//#define SPU2X_USE_OLD_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
|
// data prediction amount, used to "commit" data that hasn't
|
||||||
// finished timestretch processing.
|
// finished timestretch processing.
|
||||||
|
@ -380,7 +380,7 @@ void SndBuffer::UpdateTempoChangeSoundTouch()
|
||||||
|
|
||||||
pSoundTouch->setTempo(eTempo = (float)newTempo);
|
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" : "",
|
//(relation < 0.0) ? "Normalize" : "",
|
||||||
(int)(tempoChange * 100.0 * 0.03),
|
(int)(tempoChange * 100.0 * 0.03),
|
||||||
(int)(emergencyAdj * 100.0),
|
(int)(emergencyAdj * 100.0),
|
||||||
|
@ -541,7 +541,7 @@ void SndBuffer::soundtouchInit()
|
||||||
// reset timestretch management vars, and delay updates a bit:
|
// reset timestretch management vars, and delay updates a bit:
|
||||||
void SndBuffer::soundtouchClearContents()
|
void SndBuffer::soundtouchClearContents()
|
||||||
{
|
{
|
||||||
if (pSoundTouch == NULL)
|
if (pSoundTouch == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pSoundTouch->clear();
|
pSoundTouch->clear();
|
||||||
|
|
|
@ -42,7 +42,7 @@ WavOutFile::WavOutFile(const char* fileName, int sampleRate, int bits, int chann
|
||||||
{
|
{
|
||||||
bytesWritten = 0;
|
bytesWritten = 0;
|
||||||
fptr = fopen(fileName, "wb");
|
fptr = fopen(fileName, "wb");
|
||||||
if (fptr == NULL)
|
if (fptr == nullptr)
|
||||||
{
|
{
|
||||||
string msg = "Error : Unable to open file \"";
|
string msg = "Error : Unable to open file \"";
|
||||||
msg += fileName;
|
msg += fileName;
|
||||||
|
|
|
@ -67,8 +67,8 @@ namespace WaveDump
|
||||||
}
|
}
|
||||||
catch (std::runtime_error& ex)
|
catch (std::runtime_error& ex)
|
||||||
{
|
{
|
||||||
printf("SPU-2 > %s.\n\tWave Log for this core source disabled.", ex.what());
|
printf("SPU2 > %s.\n\tWave Log for this core source disabled.", ex.what());
|
||||||
m_CoreWav[cidx][srcidx] = NULL;
|
m_CoreWav[cidx][srcidx] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ namespace WaveDump
|
||||||
{
|
{
|
||||||
if (!IsDevBuild)
|
if (!IsDevBuild)
|
||||||
return;
|
return;
|
||||||
if (m_CoreWav[coreidx][src] != NULL)
|
if (m_CoreWav[coreidx][src] != nullptr)
|
||||||
m_CoreWav[coreidx][src]->write((s16*)&sample, 2);
|
m_CoreWav[coreidx][src]->write((s16*)&sample, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ using namespace Threading;
|
||||||
|
|
||||||
bool WavRecordEnabled = false;
|
bool WavRecordEnabled = false;
|
||||||
|
|
||||||
static WavOutFile* m_wavrecord = NULL;
|
static WavOutFile* m_wavrecord = nullptr;
|
||||||
static Mutex WavRecordMutex;
|
static Mutex WavRecordMutex;
|
||||||
|
|
||||||
void RecordStart(std::wstring* filename)
|
void RecordStart(std::wstring* filename)
|
||||||
|
@ -130,8 +130,8 @@ void RecordStart(std::wstring* filename)
|
||||||
}
|
}
|
||||||
catch (std::runtime_error&)
|
catch (std::runtime_error&)
|
||||||
{
|
{
|
||||||
m_wavrecord = NULL; // not needed, but what the heck. :)
|
m_wavrecord = nullptr; // not needed, but what the heck. :)
|
||||||
SysMessage("SPU-2 couldn't open file for recording: %s.\nRecording to wavfile disabled.", "audio_recording.wav");
|
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)
|
void RecordWrite(const StereoOut16& sample)
|
||||||
{
|
{
|
||||||
ScopedLock lock(WavRecordMutex);
|
ScopedLock lock(WavRecordMutex);
|
||||||
if (m_wavrecord == NULL)
|
if (m_wavrecord == nullptr)
|
||||||
return;
|
return;
|
||||||
m_wavrecord->write((s16*)&sample, 2);
|
m_wavrecord->write((s16*)&sample, 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ void SysMessage(const char* fmt, ...)
|
||||||
va_end(list);
|
va_end(list);
|
||||||
swprintf_s(wtmp, L"%S", tmp);
|
swprintf_s(wtmp, L"%S", tmp);
|
||||||
MessageBox((!!gsWindowHandle) ? (HWND)gsWindowHandle : GetActiveWindow(), wtmp,
|
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, ...)
|
void SysMessage(const wchar_t* fmt, ...)
|
||||||
|
@ -43,7 +43,7 @@ void SysMessage(const wchar_t* fmt, ...)
|
||||||
wtmp.PrintfV(fmt, list);
|
wtmp.PrintfV(fmt, list);
|
||||||
va_end(list);
|
va_end(list);
|
||||||
MessageBox((!!gsWindowHandle) ? (HWND)gsWindowHandle : GetActiveWindow(), wtmp,
|
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)
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -150,11 +150,11 @@ void ReadSettings()
|
||||||
|
|
||||||
Clampify(SndOutLatencyMS, LATENCY_MIN, LATENCY_MAX);
|
Clampify(SndOutLatencyMS, LATENCY_MIN, LATENCY_MAX);
|
||||||
|
|
||||||
if (mods[OutputModule] == NULL)
|
if (mods[OutputModule] == nullptr)
|
||||||
{
|
{
|
||||||
// Unsupported or legacy module.
|
// Unsupported or legacy module.
|
||||||
fwprintf(stderr, L"* SPU-2: Unknown output module '%s' specified in configuration file.\n", omodid);
|
fwprintf(stderr, L"* SPU2: Unknown output module '%s' specified in configuration file.\n", omodid);
|
||||||
fprintf(stderr, "* SPU-2: Defaulting to DirectSound (%S).\n", DSoundOut->GetIdent());
|
fprintf(stderr, "* SPU2: Defaulting to DirectSound (%S).\n", DSoundOut->GetIdent());
|
||||||
OutputModule = FindOutputModuleById(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);
|
SendDialogMsg(hWnd, IDC_OUTPUT, CB_RESETCONTENT, 0, 0);
|
||||||
|
|
||||||
int modidx = 0;
|
int modidx = 0;
|
||||||
while (mods[modidx] != NULL)
|
while (mods[modidx] != nullptr)
|
||||||
{
|
{
|
||||||
swprintf_s(temp, 72, L"%d - %s", modidx, mods[modidx]->GetLongName());
|
swprintf_s(temp, 72, L"%d - %s", modidx, mods[modidx]->GetLongName());
|
||||||
SendDialogMsg(hWnd, IDC_OUTPUT, CB_ADDSTRING, 0, (LPARAM)temp);
|
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:
|
case IDC_OUTCONF:
|
||||||
{
|
{
|
||||||
const int module = (int)SendMessage(GetDlgItem(hWnd, IDC_OUTPUT), CB_GETCURSEL, 0, 0);
|
const int module = (int)SendMessage(GetDlgItem(hWnd, IDC_OUTPUT), CB_GETCURSEL, 0, 0);
|
||||||
if (mods[module] == NULL)
|
if (mods[module] == nullptr)
|
||||||
break;
|
break;
|
||||||
mods[module]->Configure((uptr)hWnd);
|
mods[module]->Configure((uptr)hWnd);
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ void configure()
|
||||||
{
|
{
|
||||||
INT_PTR ret;
|
INT_PTR ret;
|
||||||
ReadSettings();
|
ReadSettings();
|
||||||
ret = DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_CONFIG), GetActiveWindow(), (DLGPROC)ConfigProc, 1);
|
ret = DialogBoxParam(nullptr, MAKEINTRESOURCE(IDD_CONFIG), GetActiveWindow(), (DLGPROC)ConfigProc, 1);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
MessageBox(GetActiveWindow(), L"Error Opening the config dialog.", L"OMG ERROR!", MB_OK | MB_SETFOREGROUND);
|
MessageBox(GetActiveWindow(), L"Error Opening the config dialog.", L"OMG ERROR!", MB_OK | MB_SETFOREGROUND);
|
||||||
|
|
|
@ -38,7 +38,7 @@ bool _RegDump = false;
|
||||||
|
|
||||||
bool _visual_debug_enabled = 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.
|
// the configured crap in the ini file.
|
||||||
static bool LogLocationSetByPcsx2 = false;
|
static bool LogLocationSetByPcsx2 = false;
|
||||||
|
|
||||||
|
@ -58,9 +58,9 @@ wxString RegDumpFileName;
|
||||||
|
|
||||||
void CfgSetLogDir(const char* dir)
|
void CfgSetLogDir(const char* dir)
|
||||||
{
|
{
|
||||||
LogsFolder = (dir == NULL) ? wxString(L"logs") : wxString(dir, wxConvFile);
|
LogsFolder = (dir == nullptr) ? wxString(L"logs") : wxString(dir, wxConvFile);
|
||||||
DumpsFolder = (dir == NULL) ? wxString(L"logs") : wxString(dir, wxConvFile);
|
DumpsFolder = (dir == nullptr) ? wxString(L"logs") : wxString(dir, wxConvFile);
|
||||||
LogLocationSetByPcsx2 = (dir != NULL);
|
LogLocationSetByPcsx2 = (dir != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* OpenBinaryLog(const wxString& logfile)
|
FILE* OpenBinaryLog(const wxString& logfile)
|
||||||
|
@ -263,7 +263,7 @@ namespace DebugConfig
|
||||||
|
|
||||||
void OpenDialog()
|
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)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
MessageBox(GetActiveWindow(), L"Error Opening the debug configuration dialog.", L"OMG ERROR!", MB_OK | MB_SETFOREGROUND);
|
MessageBox(GetActiveWindow(), L"Error Opening the debug configuration dialog.", L"OMG ERROR!", MB_OK | MB_SETFOREGROUND);
|
||||||
|
|
|
@ -128,7 +128,7 @@ BOOL CALLBACK SoundtouchCfg::DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
|
||||||
void SoundtouchCfg::OpenDialog(HWND hWnd)
|
void SoundtouchCfg::OpenDialog(HWND hWnd)
|
||||||
{
|
{
|
||||||
INT_PTR ret;
|
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)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
MessageBox(GetActiveWindow(), L"Error Opening the Soundtouch advanced dialog.", L"OMG ERROR!", MB_OK | MB_SETFOREGROUND);
|
MessageBox(GetActiveWindow(), L"Error Opening the Soundtouch advanced dialog.", L"OMG ERROR!", MB_OK | MB_SETFOREGROUND);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "Dialogs.h"
|
#include "Dialogs.h"
|
||||||
|
|
||||||
bool debugDialogOpen = false;
|
bool debugDialogOpen = false;
|
||||||
HWND hDebugDialog = NULL;
|
HWND hDebugDialog = nullptr;
|
||||||
|
|
||||||
#ifdef PCSX2_DEVBUILD
|
#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;
|
int lCount = 0;
|
||||||
void UpdateDebugDialog()
|
void UpdateDebugDialog()
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
|
||||||
IDD_CONFIG DIALOGEX 0, 0, 310, 260
|
IDD_CONFIG DIALOGEX 0, 0, 310, 260
|
||||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
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
|
FONT 8, "MS Shell Dlg", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
PUSHBUTTON "OK",IDOK,101,238,50,14,NOT WS_TABSTOP
|
PUSHBUTTON "OK",IDOK,101,238,50,14,NOT WS_TABSTOP
|
||||||
|
@ -62,7 +62,7 @@ END
|
||||||
|
|
||||||
IDD_DEBUG DIALOGEX 0, 0, 303, 473
|
IDD_DEBUG DIALOGEX 0, 0, 303, 473
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
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
|
FONT 9, "Lucida Console", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
DEFPUSHBUTTON "Close",IDOK,246,451,50,14
|
DEFPUSHBUTTON "Close",IDOK,246,451,50,14
|
||||||
|
@ -104,7 +104,7 @@ END
|
||||||
|
|
||||||
IDD_CONFIG_SOUNDTOUCH DIALOGEX 0, 0, 206, 223
|
IDD_CONFIG_SOUNDTOUCH DIALOGEX 0, 0, 206, 223
|
||||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
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
|
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
DEFPUSHBUTTON "OK",IDOK,50,201,50,14
|
DEFPUSHBUTTON "OK",IDOK,50,201,50,14
|
||||||
|
@ -127,7 +127,7 @@ END
|
||||||
|
|
||||||
IDD_CONFIG_DEBUG DIALOGEX 0, 0, 292, 239
|
IDD_CONFIG_DEBUG DIALOGEX 0, 0, 292, 239
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
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
|
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
DEFPUSHBUTTON "OK",IDOK,93,217,50,14
|
DEFPUSHBUTTON "OK",IDOK,93,217,50,14
|
||||||
|
@ -238,12 +238,12 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Comments", "SPU2 Plugin for PS2 Emulators"
|
VALUE "Comments", "SPU2 Plugin for PS2 Emulators"
|
||||||
VALUE "CompanyName", "PCSX2 Dev Team"
|
VALUE "CompanyName", "PCSX2 Dev Team"
|
||||||
VALUE "FileDescription", "SPU-2 Plugin (git build)"
|
VALUE "FileDescription", "SPU2 Plugin (git build)"
|
||||||
VALUE "FileVersion", "2.0.GIT"
|
VALUE "FileVersion", "2.0.GIT"
|
||||||
VALUE "InternalName", "SPU-2"
|
VALUE "InternalName", "SPU2"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2011"
|
VALUE "LegalCopyright", "Copyright (C) 2011"
|
||||||
VALUE "OriginalFilename", "SPU-2-2.0.dll"
|
VALUE "OriginalFilename", "SPU2-2.0.dll"
|
||||||
VALUE "ProductName", "SPU-2"
|
VALUE "ProductName", "SPU2"
|
||||||
VALUE "ProductVersion", "2.0.GIT"
|
VALUE "ProductVersion", "2.0.GIT"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
|
@ -85,7 +85,7 @@ private:
|
||||||
if (FAILED(buffer->Lock(poffset, BufferSizeBytes, (LPVOID*)&p1, &s1, &p2, &s2, 0)))
|
if (FAILED(buffer->Lock(poffset, BufferSizeBytes, (LPVOID*)&p1, &s1, &p2, &s2, 0)))
|
||||||
{
|
{
|
||||||
assert(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;
|
continue;
|
||||||
}
|
}
|
||||||
oldp1 = p1;
|
oldp1 = p1;
|
||||||
|
@ -104,7 +104,7 @@ private:
|
||||||
public:
|
public:
|
||||||
s32 Init()
|
s32 Init()
|
||||||
{
|
{
|
||||||
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize DSound
|
// Initialize DSound
|
||||||
|
@ -117,13 +117,13 @@ public:
|
||||||
throw std::runtime_error("screw it");
|
throw std::runtime_error("screw it");
|
||||||
|
|
||||||
if ((FAILED(IIDFromString(m_Device, &cGuid))) ||
|
if ((FAILED(IIDFromString(m_Device, &cGuid))) ||
|
||||||
FAILED(DirectSoundCreate8(&cGuid, &dsound, NULL)))
|
FAILED(DirectSoundCreate8(&cGuid, &dsound, nullptr)))
|
||||||
throw std::runtime_error("try again?");
|
throw std::runtime_error("try again?");
|
||||||
}
|
}
|
||||||
catch (std::runtime_error&)
|
catch (std::runtime_error&)
|
||||||
{
|
{
|
||||||
// if the GUID failed, just open up the default dsound driver:
|
// 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!");
|
throw std::runtime_error("DirectSound failed to initialize!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ public:
|
||||||
|
|
||||||
throw std::runtime_error("DirectSound Error: Buffer could not be created.");
|
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.");
|
throw std::runtime_error("DirectSound Error: Interface could not be queried.");
|
||||||
|
|
||||||
buffer_->Release();
|
buffer_->Release();
|
||||||
|
@ -189,7 +189,7 @@ public:
|
||||||
|
|
||||||
for (uint i = 0; i < m_NumBuffers; i++)
|
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].dwOffset = (wfx.nBlockAlign + BufferSizeBytes * (i + 1)) % desc.dwBufferBytes;
|
||||||
not[i].hEventNotify = buffer_events[i];
|
not[i].hEventNotify = buffer_events[i];
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ public:
|
||||||
// Start Thread
|
// Start Thread
|
||||||
myLastWrite = 0;
|
myLastWrite = 0;
|
||||||
dsound_running = true;
|
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);
|
SetThreadPriority(thread, THREAD_PRIORITY_ABOVE_NORMAL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -219,7 +219,7 @@ public:
|
||||||
void Close()
|
void Close()
|
||||||
{
|
{
|
||||||
// Stop Thread
|
// Stop Thread
|
||||||
fprintf(stderr, "* SPU-2: Waiting for DSound thread to finish...");
|
fprintf(stderr, "* SPU2: Waiting for DSound thread to finish...");
|
||||||
dsound_running = false;
|
dsound_running = false;
|
||||||
|
|
||||||
WaitForSingleObject(thread, INFINITE);
|
WaitForSingleObject(thread, INFINITE);
|
||||||
|
@ -230,15 +230,15 @@ public:
|
||||||
//
|
//
|
||||||
// Clean up
|
// Clean up
|
||||||
//
|
//
|
||||||
if (buffer != NULL)
|
if (buffer != nullptr)
|
||||||
{
|
{
|
||||||
buffer->Stop();
|
buffer->Stop();
|
||||||
|
|
||||||
for (u32 i = 0; i < m_NumBuffers; i++)
|
for (u32 i = 0; i < m_NumBuffers; i++)
|
||||||
{
|
{
|
||||||
if (buffer_events[i] != NULL)
|
if (buffer_events[i] != nullptr)
|
||||||
CloseHandle(buffer_events[i]);
|
CloseHandle(buffer_events[i]);
|
||||||
buffer_events[i] = NULL;
|
buffer_events[i] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
safe_release(buffer_notify);
|
safe_release(buffer_notify);
|
||||||
|
@ -285,7 +285,7 @@ private:
|
||||||
SendMessage(GetDlgItem(hWnd, IDC_DS_DEVICE), CB_RESETCONTENT, 0, 0);
|
SendMessage(GetDlgItem(hWnd, IDC_DS_DEVICE), CB_RESETCONTENT, 0, 0);
|
||||||
|
|
||||||
ndevs = 0;
|
ndevs = 0;
|
||||||
DirectSoundEnumerate(DSEnumCallback, NULL);
|
DirectSoundEnumerate(DSEnumCallback, nullptr);
|
||||||
|
|
||||||
tSel = -1;
|
tSel = -1;
|
||||||
for (int i = 0; i < ndevs; i++)
|
for (int i = 0; i < ndevs; i++)
|
||||||
|
@ -411,7 +411,7 @@ public:
|
||||||
virtual void Configure(uptr parent)
|
virtual void Configure(uptr parent)
|
||||||
{
|
{
|
||||||
INT_PTR ret;
|
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)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
MessageBox((HWND)parent, L"Error Opening the config dialog.", L"OMG ERROR!", MB_OK | MB_SETFOREGROUND);
|
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)
|
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);
|
return DS._DSEnumCallback(lpGuid, lpcstrDescription, lpcstrModule, lpContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ public:
|
||||||
// love it needs and won't suck resources idling pointlessly. Just don't try to
|
// love it needs and won't suck resources idling pointlessly. Just don't try to
|
||||||
// run it in uber-low-latency mode.
|
// run it in uber-low-latency mode.
|
||||||
waveout_running = true;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ public:
|
||||||
void Close()
|
void Close()
|
||||||
{
|
{
|
||||||
// Stop Thread
|
// Stop Thread
|
||||||
fprintf(stderr, "* SPU-2: Waiting for waveOut thread to finish...");
|
fprintf(stderr, "* SPU2: Waiting for waveOut thread to finish...");
|
||||||
waveout_running = false;
|
waveout_running = false;
|
||||||
|
|
||||||
WaitForSingleObject(thread, INFINITE);
|
WaitForSingleObject(thread, INFINITE);
|
||||||
|
@ -279,7 +279,7 @@ public:
|
||||||
virtual void Configure(uptr parent)
|
virtual void Configure(uptr parent)
|
||||||
{
|
{
|
||||||
INT_PTR ret;
|
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)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
MessageBox((HWND)parent, L"Error Opening the config dialog.", L"OMG ERROR!", MB_OK | MB_SETFOREGROUND);
|
MessageBox((HWND)parent, L"Error Opening the config dialog.", L"OMG ERROR!", MB_OK | MB_SETFOREGROUND);
|
||||||
|
|
|
@ -27,11 +27,11 @@ extern "C" {
|
||||||
typedef winampDSPHeader* (*pWinampDSPGetHeader2)();
|
typedef winampDSPHeader* (*pWinampDSPGetHeader2)();
|
||||||
}
|
}
|
||||||
|
|
||||||
HMODULE hLib = NULL;
|
HMODULE hLib = nullptr;
|
||||||
pWinampDSPGetHeader2 pGetHeader = NULL;
|
pWinampDSPGetHeader2 pGetHeader = nullptr;
|
||||||
winampDSPHeader* pHeader = NULL;
|
winampDSPHeader* pHeader = nullptr;
|
||||||
|
|
||||||
winampDSPModule* pModule = NULL;
|
winampDSPModule* pModule = nullptr;
|
||||||
|
|
||||||
HWND hTemp;
|
HWND hTemp;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ s32 DspLoadLibrary(wchar_t* fileName, int modNum)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
running = true;
|
running = true;
|
||||||
hUpdateThread = CreateThread(NULL, 0, DspUpdateThread, NULL, 0, &UpdateThreadId);
|
hUpdateThread = CreateThread(nullptr, 0, DspUpdateThread, nullptr, 0, &UpdateThreadId);
|
||||||
return (hUpdateThread == INVALID_HANDLE_VALUE);
|
return (hUpdateThread == INVALID_HANDLE_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ s32 DspLoadLibrary2(wchar_t* fileName, int modNum)
|
||||||
if (!pGetHeader)
|
if (!pGetHeader)
|
||||||
{
|
{
|
||||||
FreeLibrary(hLib);
|
FreeLibrary(hLib);
|
||||||
hLib = NULL;
|
hLib = nullptr;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,10 +83,10 @@ s32 DspLoadLibrary2(wchar_t* fileName, int modNum)
|
||||||
|
|
||||||
if (!pModule)
|
if (!pModule)
|
||||||
{
|
{
|
||||||
pGetHeader = NULL;
|
pGetHeader = nullptr;
|
||||||
pHeader = NULL;
|
pHeader = nullptr;
|
||||||
FreeLibrary(hLib);
|
FreeLibrary(hLib);
|
||||||
hLib = NULL;
|
hLib = nullptr;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ void DspCloseLibrary()
|
||||||
running = false;
|
running = false;
|
||||||
if (WaitForSingleObject(hUpdateThread, 1000) == WAIT_TIMEOUT)
|
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);
|
TerminateThread(hUpdateThread, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,10 +123,10 @@ void DspCloseLibrary2()
|
||||||
pModule->Quit(pModule);
|
pModule->Quit(pModule);
|
||||||
FreeLibrary(hLib);
|
FreeLibrary(hLib);
|
||||||
}
|
}
|
||||||
pModule = NULL;
|
pModule = nullptr;
|
||||||
pHeader = NULL;
|
pHeader = nullptr;
|
||||||
pGetHeader = NULL;
|
pGetHeader = nullptr;
|
||||||
hLib = NULL;
|
hLib = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DspProcess(s16* buffer, int samples)
|
int DspProcess(s16* buffer, int samples)
|
||||||
|
@ -158,7 +158,7 @@ DWORD WINAPI DspUpdateThread(PVOID param)
|
||||||
while (running)
|
while (running)
|
||||||
{
|
{
|
||||||
GetMessage(&msg, 0, 0, 0);
|
GetMessage(&msg, 0, 0, 0);
|
||||||
if ((msg.hwnd == NULL) && (msg.message == WM_QUIT))
|
if ((msg.hwnd == nullptr) && (msg.message == WM_QUIT))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -458,7 +458,7 @@ struct V_Core
|
||||||
// uninitialized constructor
|
// uninitialized constructor
|
||||||
V_Core()
|
V_Core()
|
||||||
: Index(-1)
|
: Index(-1)
|
||||||
, DMAPtr(NULL)
|
, DMAPtr(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
V_Core(int idx); // our badass constructor
|
V_Core(int idx); // our badass constructor
|
||||||
|
|
|
@ -183,7 +183,7 @@ Core attributes (SD_C)
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
// SPU-2 Register Table LUT
|
// SPU2 Register Table LUT
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
#define U16P(x) ((u16*)&(x))
|
#define U16P(x) ((u16*)&(x))
|
||||||
|
|
|
@ -42,7 +42,7 @@ static bool IsInitialized = false;
|
||||||
|
|
||||||
static u32 pClocks = 0;
|
static u32 pClocks = 0;
|
||||||
|
|
||||||
u32* cyclePtr = NULL;
|
u32* cyclePtr = nullptr;
|
||||||
u32 lClocks = 0;
|
u32 lClocks = 0;
|
||||||
//static bool cpu_detected = false;
|
//static bool cpu_detected = false;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ static bool CheckSSE()
|
||||||
}
|
}
|
||||||
if( !x86caps.hasStreamingSIMDExtensions || !x86caps.hasStreamingSIMD2Extensions )
|
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 false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -104,7 +104,7 @@ void SPU2setLogDir(const char* dir)
|
||||||
|
|
||||||
void SPU2readDMA4Mem(u16* pMem, u32 size) // size now in 16bit units
|
void SPU2readDMA4Mem(u16* pMem, u32 size) // size now in 16bit units
|
||||||
{
|
{
|
||||||
if (cyclePtr != NULL)
|
if (cyclePtr != nullptr)
|
||||||
TimeUpdate(*cyclePtr);
|
TimeUpdate(*cyclePtr);
|
||||||
|
|
||||||
FileLog("[%10d] SPU2 readDMA4Mem size %x\n", Cycles, size << 1);
|
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
|
void SPU2writeDMA4Mem(u16* pMem, u32 size) // size now in 16bit units
|
||||||
{
|
{
|
||||||
if (cyclePtr != NULL)
|
if (cyclePtr != nullptr)
|
||||||
TimeUpdate(*cyclePtr);
|
TimeUpdate(*cyclePtr);
|
||||||
|
|
||||||
FileLog("[%10d] SPU2 writeDMA4Mem size %x at address %x\n", Cycles, size << 1, Cores[0].TSA);
|
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)
|
void SPU2readDMA7Mem(u16* pMem, u32 size)
|
||||||
{
|
{
|
||||||
if (cyclePtr != NULL)
|
if (cyclePtr != nullptr)
|
||||||
TimeUpdate(*cyclePtr);
|
TimeUpdate(*cyclePtr);
|
||||||
|
|
||||||
FileLog("[%10d] SPU2 readDMA7Mem size %x\n", Cycles, size << 1);
|
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)
|
void SPU2writeDMA7Mem(u16* pMem, u32 size)
|
||||||
{
|
{
|
||||||
if (cyclePtr != NULL)
|
if (cyclePtr != nullptr)
|
||||||
TimeUpdate(*cyclePtr);
|
TimeUpdate(*cyclePtr);
|
||||||
|
|
||||||
FileLog("[%10d] SPU2 writeDMA7Mem size %x at address %x\n", Cycles, size << 1, Cores[1].TSA);
|
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)
|
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();
|
SPU2close();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ s32 SPU2ps1reset()
|
||||||
}
|
}
|
||||||
catch (std::exception& ex)
|
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();
|
SPU2close();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -222,11 +222,11 @@ s32 SPU2ps1reset()
|
||||||
|
|
||||||
s32 SPU2init()
|
s32 SPU2init()
|
||||||
{
|
{
|
||||||
assert(regtable[0x400] == NULL);
|
assert(regtable[0x400] == nullptr);
|
||||||
|
|
||||||
if (IsInitialized)
|
if (IsInitialized)
|
||||||
{
|
{
|
||||||
printf(" * SPU-2: Already initialized - Ignoring SPU2init signal.");
|
printf(" * SPU2: Already initialized - Ignoring SPU2init signal.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,11 +239,11 @@ s32 SPU2init()
|
||||||
if (AccessLog())
|
if (AccessLog())
|
||||||
{
|
{
|
||||||
spu2Log = OpenLog(AccessLogFileName);
|
spu2Log = OpenLog(AccessLogFileName);
|
||||||
setvbuf(spu2Log, NULL, _IONBF, 0);
|
setvbuf(spu2Log, nullptr, _IONBF, 0);
|
||||||
FileLog("SPU2init\n");
|
FileLog("SPU2init\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
srand((unsigned)time(NULL));
|
srand((unsigned)time(nullptr));
|
||||||
|
|
||||||
spu2regs = (s16*)malloc(0x010000);
|
spu2regs = (s16*)malloc(0x010000);
|
||||||
_spu2mem = (s16*)malloc(0x200000);
|
_spu2mem = (s16*)malloc(0x200000);
|
||||||
|
@ -257,13 +257,13 @@ s32 SPU2init()
|
||||||
|
|
||||||
pcm_cache_data = (PcmCacheEntry*)calloc(pcm_BlockCount, sizeof(PcmCacheEntry));
|
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;
|
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));
|
memcpy(regtable, regtable_original, sizeof(regtable));
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ s32 SPU2open(void* pDsp)
|
||||||
|
|
||||||
FileLog("[%10d] SPU2 Open\n", Cycles);
|
FileLog("[%10d] SPU2 Open\n", Cycles);
|
||||||
|
|
||||||
if (pDsp != NULL)
|
if (pDsp != nullptr)
|
||||||
gsWindowHandle = *(uptr*)pDsp;
|
gsWindowHandle = *(uptr*)pDsp;
|
||||||
else
|
else
|
||||||
gsWindowHandle = 0;
|
gsWindowHandle = 0;
|
||||||
|
@ -349,7 +349,7 @@ s32 SPU2open(void* pDsp)
|
||||||
{
|
{
|
||||||
if (debugDialogOpen == 0)
|
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);
|
ShowWindow(hDebugDialog, SW_SHOWNORMAL);
|
||||||
debugDialogOpen = 1;
|
debugDialogOpen = 1;
|
||||||
}
|
}
|
||||||
|
@ -363,7 +363,7 @@ s32 SPU2open(void* pDsp)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IsOpened = true;
|
IsOpened = true;
|
||||||
lClocks = (cyclePtr != NULL) ? *cyclePtr : 0;
|
lClocks = (cyclePtr != nullptr) ? *cyclePtr : 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -376,7 +376,7 @@ s32 SPU2open(void* pDsp)
|
||||||
}
|
}
|
||||||
catch (std::exception& ex)
|
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();
|
SPU2close();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -408,7 +408,7 @@ void SPU2shutdown()
|
||||||
IsInitialized = false;
|
IsInitialized = false;
|
||||||
SPU2_dummy_callback = false;
|
SPU2_dummy_callback = false;
|
||||||
|
|
||||||
ConLog("* SPU-2: Shutting down.\n");
|
ConLog("* SPU2: Shutting down.\n");
|
||||||
|
|
||||||
SPU2close();
|
SPU2close();
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ void SPU2async(u32 cycles)
|
||||||
{
|
{
|
||||||
DspUpdate();
|
DspUpdate();
|
||||||
|
|
||||||
if (cyclePtr != NULL)
|
if (cyclePtr != nullptr)
|
||||||
{
|
{
|
||||||
TimeUpdate(*cyclePtr);
|
TimeUpdate(*cyclePtr);
|
||||||
}
|
}
|
||||||
|
@ -540,7 +540,7 @@ u16 SPU2read(u32 rmem)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (cyclePtr != NULL)
|
if (cyclePtr != nullptr)
|
||||||
TimeUpdate(*cyclePtr);
|
TimeUpdate(*cyclePtr);
|
||||||
|
|
||||||
if (rmem >> 16 == 0x1f80)
|
if (rmem >> 16 == 0x1f80)
|
||||||
|
@ -550,7 +550,7 @@ u16 SPU2read(u32 rmem)
|
||||||
else if (mem >= 0x800)
|
else if (mem >= 0x800)
|
||||||
{
|
{
|
||||||
ret = spu2Ru16(mem);
|
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
|
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
|
// If the SPU2 isn't in in sync with the IOP, samples can end up playing at rather
|
||||||
// incorrect pitches and loop lengths.
|
// incorrect pitches and loop lengths.
|
||||||
|
|
||||||
if (cyclePtr != NULL)
|
if (cyclePtr != nullptr)
|
||||||
TimeUpdate(*cyclePtr);
|
TimeUpdate(*cyclePtr);
|
||||||
|
|
||||||
if (rmem >> 16 == 0x1f80)
|
if (rmem >> 16 == 0x1f80)
|
||||||
|
@ -601,10 +601,10 @@ int SPU2setupRecording(int start, std::wstring* filename)
|
||||||
|
|
||||||
s32 SPU2freeze(int mode, freezeData* data)
|
s32 SPU2freeze(int mode, freezeData* data)
|
||||||
{
|
{
|
||||||
pxAssume(data != NULL);
|
pxAssume(data != nullptr);
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
printf("SPU-2 savestate null pointer!\n");
|
printf("SPU2 savestate null pointer!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,9 +616,9 @@ s32 SPU2freeze(int mode, freezeData* data)
|
||||||
|
|
||||||
pxAssume(mode == FREEZE_LOAD || mode == FREEZE_SAVE);
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,10 +648,10 @@ void SPU2DoFreezeOut(void* dest)
|
||||||
if (!fP.size)
|
if (!fP.size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Console.Indent().WriteLn("Saving SPU-2");
|
Console.Indent().WriteLn("Saving SPU2");
|
||||||
|
|
||||||
if (SPU2freeze(FREEZE_SAVE, &fP) != 0)
|
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);
|
ScopedLock lock(mtx_SPU2Status);
|
||||||
|
|
||||||
freezeData fP = {0, NULL};
|
freezeData fP = {0, nullptr};
|
||||||
if (SPU2freeze(FREEZE_SIZE, &fP) != 0)
|
if (SPU2freeze(FREEZE_SIZE, &fP) != 0)
|
||||||
fP.size = 0;
|
fP.size = 0;
|
||||||
|
|
||||||
Console.Indent().WriteLn("Loading SPU-2");
|
Console.Indent().WriteLn("Loading SPU2");
|
||||||
|
|
||||||
if (!infp.IsOk() || !infp.Length())
|
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...
|
// Issue a warning to console...
|
||||||
if (fP.size != 0)
|
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;
|
return;
|
||||||
|
|
||||||
|
@ -685,5 +685,5 @@ void SPU2DoFreezeIn(pxInputStream& infp)
|
||||||
|
|
||||||
infp.Read(fP.data, fP.size);
|
infp.Read(fP.data, fP.size);
|
||||||
if (SPU2freeze(FREEZE_LOAD, &fP) != 0)
|
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");
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
namespace SPU2Savestate
|
namespace SPU2Savestate
|
||||||
{
|
{
|
||||||
// Arbitrary ID to identify SPU-2 saves.
|
// Arbitrary ID to identify SPU2 saves.
|
||||||
static const u32 SAVE_ID = 0x1227521;
|
static const u32 SAVE_ID = 0x1227521;
|
||||||
|
|
||||||
// versioning for saves.
|
// versioning for saves.
|
||||||
|
@ -34,11 +34,11 @@ namespace SPU2Savestate
|
||||||
|
|
||||||
struct SPU2Savestate::DataBlock
|
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 unkregs[0x10000]; // SPU2 raw register memory
|
||||||
u8 mem[0x200000]; // SPU2 raw sample memory
|
u8 mem[0x200000]; // SPU2 raw sample memory
|
||||||
|
|
||||||
u32 version; // SPU-2 version identifier
|
u32 version; // SPU2 version identifier
|
||||||
V_Core Cores[2];
|
V_Core Cores[2];
|
||||||
V_SPDIF Spdif;
|
V_SPDIF Spdif;
|
||||||
s16 OutPos;
|
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.");
|
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));
|
memcpy(spud.unkregs, spu2regs, sizeof(spud.unkregs));
|
||||||
if (_spu2mem != NULL)
|
if (_spu2mem != nullptr)
|
||||||
memcpy(spud.mem, _spu2mem, sizeof(spud.mem));
|
memcpy(spud.mem, _spu2mem, sizeof(spud.mem));
|
||||||
|
|
||||||
memcpy(spud.Cores, Cores, sizeof(Cores));
|
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)
|
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)
|
if (spud.spu2id == SAVE_ID)
|
||||||
fprintf(stderr, "\tSavestate version is from an older version of PCSX2.\n");
|
fprintf(stderr, "\tSavestate version is from an older version of PCSX2.\n");
|
||||||
else
|
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
|
// 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
|
// editions of PCSX2 with fixed addressing, but new PCSX2s have dynamic memory
|
||||||
// addressing).
|
// addressing).
|
||||||
|
|
||||||
Cores[0].DMAPtr = Cores[1].DMAPtr = NULL;
|
Cores[0].DMAPtr = Cores[1].DMAPtr = nullptr;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
#include "spu2.h" // needed until I figure out a nice solution for irqcallback dependencies.
|
#include "spu2.h" // needed until I figure out a nice solution for irqcallback dependencies.
|
||||||
|
|
||||||
s16* spu2regs = NULL;
|
s16* spu2regs = nullptr;
|
||||||
s16* _spu2mem = NULL;
|
s16* _spu2mem = nullptr;
|
||||||
|
|
||||||
V_CoreDebug DebugCores[2];
|
V_CoreDebug DebugCores[2];
|
||||||
V_Core Cores[2];
|
V_Core Cores[2];
|
||||||
|
@ -57,7 +57,7 @@ void SetIrqCall(int core)
|
||||||
__forceinline s16* GetMemPtr(u32 addr)
|
__forceinline s16* GetMemPtr(u32 addr)
|
||||||
{
|
{
|
||||||
#ifndef DEBUG_FAST
|
#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
|
// runs so incrediously slow in Debug mode. :P
|
||||||
pxAssume(addr < 0x100000);
|
pxAssume(addr < 0x100000);
|
||||||
#endif
|
#endif
|
||||||
|
@ -83,7 +83,7 @@ __forceinline void spu2M_Write(u32 addr, s16 value)
|
||||||
pcm_cache_data[cacheIdx].Validated = false;
|
pcm_cache_data[cacheIdx].Validated = false;
|
||||||
|
|
||||||
if (MsgToConsole() && MsgCache())
|
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;
|
*GetMemPtr(addr) = value;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ V_VolumeSlideLR V_VolumeSlideLR::Max(0x3FFF, 0x7FFFFFFF);
|
||||||
|
|
||||||
V_Core::V_Core(int coreidx)
|
V_Core::V_Core(int coreidx)
|
||||||
: Index(coreidx)
|
: Index(coreidx)
|
||||||
//LogFile_AutoDMA( NULL )
|
//LogFile_AutoDMA( nullptr )
|
||||||
{
|
{
|
||||||
/*char fname[128];
|
/*char fname[128];
|
||||||
sprintf( fname, "logs/adma%d.raw", GetDmaIndex() );
|
sprintf( fname, "logs/adma%d.raw", GetDmaIndex() );
|
||||||
|
@ -109,16 +109,16 @@ V_Core::V_Core(int coreidx)
|
||||||
V_Core::~V_Core() throw()
|
V_Core::~V_Core() throw()
|
||||||
{
|
{
|
||||||
// Can't use this yet because we dumb V_Core into savestates >_<
|
// Can't use this yet because we dumb V_Core into savestates >_<
|
||||||
/*if( LogFile_AutoDMA != NULL )
|
/*if( LogFile_AutoDMA != nullptr )
|
||||||
{
|
{
|
||||||
fclose( LogFile_AutoDMA );
|
fclose( LogFile_AutoDMA );
|
||||||
LogFile_AutoDMA = NULL;
|
LogFile_AutoDMA = nullptr;
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void V_Core::Init(int index)
|
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));
|
//memset(this, 0, sizeof(V_Core));
|
||||||
// Explicitly initializing variables instead.
|
// Explicitly initializing variables instead.
|
||||||
Mute = false;
|
Mute = false;
|
||||||
|
@ -415,7 +415,7 @@ __forceinline void TimeUpdate(u32 cClocks)
|
||||||
{
|
{
|
||||||
if (has_to_call_irq)
|
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;
|
has_to_call_irq = false;
|
||||||
if (!SPU2_dummy_callback)
|
if (!SPU2_dummy_callback)
|
||||||
spu2Irq();
|
spu2Irq();
|
||||||
|
@ -486,7 +486,7 @@ __forceinline void UpdateSpdifMode()
|
||||||
if (Spdif.Out & 0x4) // use 24/32bit PCM data streaming
|
if (Spdif.Out & 0x4) // use 24/32bit PCM data streaming
|
||||||
{
|
{
|
||||||
PlayMode = 8;
|
PlayMode = 8;
|
||||||
ConLog("* SPU-2: WARNING: Possibly CDDA mode set!\n");
|
ConLog("* SPU2: WARNING: Possibly CDDA mode set!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,12 +506,12 @@ __forceinline void UpdateSpdifMode()
|
||||||
}
|
}
|
||||||
if (OPM != PlayMode)
|
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);
|
(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.
|
// properly into the lower 16 bits of the value to provide a full spectrum of volumes.
|
||||||
static s32 GetVol32(u16 src)
|
static s32 GetVol32(u16 src)
|
||||||
{
|
{
|
||||||
|
@ -714,12 +714,12 @@ void V_Core::WriteRegPS1(u32 mem, u16 value)
|
||||||
|
|
||||||
case 0x1da4:
|
case 0x1da4:
|
||||||
IRQA = map_spu1to2(value);
|
IRQA = map_spu1to2(value);
|
||||||
//ConLog("SPU-2 Setting IRQA to %x \n", IRQA);
|
//ConLog("SPU2 Setting IRQA to %x \n", IRQA);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1da6:
|
case 0x1da6:
|
||||||
TSA = map_spu1to2(value);
|
TSA = map_spu1to2(value);
|
||||||
//ConLog("SPU-2 Setting TSA to %x \n", TSA);
|
//ConLog("SPU2 Setting TSA to %x \n", TSA);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1da8: // Spu Write to Memory
|
case 0x1da8: // Spu Write to Memory
|
||||||
|
@ -986,11 +986,11 @@ u16 V_Core::ReadRegPS1(u32 mem)
|
||||||
break;
|
break;
|
||||||
case 0x1da4:
|
case 0x1da4:
|
||||||
value = map_spu2to1(IRQA);
|
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;
|
break;
|
||||||
case 0x1da6:
|
case 0x1da6:
|
||||||
value = map_spu2to1(TSA);
|
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;
|
break;
|
||||||
case 0x1da8:
|
case 0x1da8:
|
||||||
value = DmaRead();
|
value = DmaRead();
|
||||||
|
@ -998,14 +998,14 @@ u16 V_Core::ReadRegPS1(u32 mem)
|
||||||
break;
|
break;
|
||||||
case 0x1daa:
|
case 0x1daa:
|
||||||
value = Cores[0].Regs.ATTR;
|
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;
|
break;
|
||||||
case 0x1dac: // 1F801DACh - Sound RAM Data Transfer Control (should be 0004h)
|
case 0x1dac: // 1F801DACh - Sound RAM Data Transfer Control (should be 0004h)
|
||||||
value = psxSoundDataTransferControl;
|
value = psxSoundDataTransferControl;
|
||||||
break;
|
break;
|
||||||
case 0x1dae:
|
case 0x1dae:
|
||||||
value = Cores[0].Regs.STATX;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1230,17 +1230,17 @@ static void __fastcall RegWrite_Core(u16 value)
|
||||||
if (value & 0x000E)
|
if (value & 0x000E)
|
||||||
{
|
{
|
||||||
if (MsgToConsole())
|
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 (thiscore.AttrBit0 != bit0)
|
||||||
{
|
{
|
||||||
if (MsgToConsole())
|
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)
|
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);
|
// core, ((thiscore.IRQEnable==0)?"disabled":"enabled"), Cycles, thiscore.IRQA, thiscore.EffectsStartA);
|
||||||
|
|
||||||
if (!thiscore.IRQEnable)
|
if (!thiscore.IRQEnable)
|
||||||
|
@ -1417,10 +1417,10 @@ static void __fastcall RegWrite_Core(u16 value)
|
||||||
|
|
||||||
case REG_S_ADMAS:
|
case REG_S_ADMAS:
|
||||||
if (MsgToConsole())
|
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)
|
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).
|
// hack for ps1driver which writes -1 (and never turns the adma off after psxlogo).
|
||||||
// adma isn't available in psx mode either
|
// adma isn't available in psx mode either
|
||||||
if (value == 32767)
|
if (value == 32767)
|
||||||
|
@ -1839,7 +1839,7 @@ static RegWriteHandler* const tbl_reg_writes[0x401] =
|
||||||
REGRAW(0x7F0), REGRAW(0x7F2), REGRAW(0x7F4), REGRAW(0x7F6),
|
REGRAW(0x7F0), REGRAW(0x7F2), REGRAW(0x7F4), REGRAW(0x7F6),
|
||||||
REGRAW(0x7F8), REGRAW(0x7FA), REGRAW(0x7FC), REGRAW(0x7FE),
|
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]);
|
V_Voice& thisvc(Cores[core].Voices[vc]);
|
||||||
|
|
||||||
if (MsgKeyOnOff())
|
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,
|
core, vc, thisvc.StartA,
|
||||||
(Cores[core].VoiceGates[vc].DryL) ? "+" : "-", (Cores[core].VoiceGates[vc].DryR) ? "+" : "-",
|
(Cores[core].VoiceGates[vc].DryL) ? "+" : "-", (Cores[core].VoiceGates[vc].DryR) ? "+" : "-",
|
||||||
(Cores[core].VoiceGates[vc].WetL) ? "+" : "-", (Cores[core].VoiceGates[vc].WetR) ? "+" : "-",
|
(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;
|
Cores[core].Voices[vc].ADSR.Releasing = true;
|
||||||
if (MsgKeyOnOff())
|
if (MsgKeyOnOff())
|
||||||
ConLog("* SPU-2: KeyOff: Core %d; Voice %d.\n", core, vc);
|
ConLog("* SPU2: KeyOff: Core %d; Voice %d.\n", core, vc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue