From 1d0dd4d258625ca0fde4dcb955ef96a1354770bc Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 1 May 2020 17:15:53 -0400 Subject: [PATCH] update to 1.24.2 --- psx/octoshock/docs/upstreaminfo.txt | 9 +++++++- psx/octoshock/psx/spu.cpp | 33 +++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/psx/octoshock/docs/upstreaminfo.txt b/psx/octoshock/docs/upstreaminfo.txt index 178cc097af..0a8e44f490 100644 --- a/psx/octoshock/docs/upstreaminfo.txt +++ b/psx/octoshock/docs/upstreaminfo.txt @@ -223,4 +223,11 @@ [OK] psx/spu : casts on volumes [NO] types : nothing important [NO] video/Deinterlacer : IGNORE. we may have weak deinterlacing, but so be it -[NO] tests : intrinsic macros changes, threading API changes, stream tests \ No newline at end of file +[NO] tests : intrinsic macros changes, threading API changes, stream tests + +1.24.0-UNSTABLE -> 1.24.1 +[OK] psx/spu : some basic emulation fixes +[NO] tests : thread stuff + +1.24.1 -> 1.24.2 +-nothing- \ No newline at end of file diff --git a/psx/octoshock/psx/spu.cpp b/psx/octoshock/psx/spu.cpp index 62de754082..8769fe6cf4 100644 --- a/psx/octoshock/psx/spu.cpp +++ b/psx/octoshock/psx/spu.cpp @@ -394,7 +394,7 @@ void PS_SPU::RunDecoder(SPU_Voice *voice) } else { - if(voice->LoopAddr != voice->CurAddr) + if((voice->LoopAddr ^ voice->CurAddr) & ~0x7) { PSX_DBG(PSX_DBG_FLOOD, "[SPU] Ignore: LoopAddr=0x%08x, SampLA=0x%08x\n", voice->LoopAddr, voice->CurAddr); } @@ -680,6 +680,11 @@ int32 PS_SPU::UpdateFromCDC(int32 clocks) //PSX_WARNING("[SPU] Voice %d CurPhase=%08x, pitch=%04x, CurAddr=%08x", voice_num, voice->CurPhase, voice->Pitch, voice->CurAddr); + if(voice->DecodePlayDelay) + { + voice->IgnoreSampLA = false; + } + // // Decode new samples if necessary. // @@ -767,7 +772,26 @@ int32 PS_SPU::UpdateFromCDC(int32 clocks) { if(voice->ADSR.Phase != ADSR_RELEASE) { - ReleaseEnvelope(voice); + // TODO/FIXME: + // To fix all the missing notes in "Dragon Ball GT: Final Bout" music, !voice->DecodePlayDelay instead of + // voice->DecodePlayDelay < 3 is necessary, but that would cause the length of time for which the voice off is + // effectively ignored to be too long by about half a sample(rough test measurement). That, combined with current + // CPU and DMA emulation timing inaccuracies(execution generally too fast), creates a significant risk of regressions + // in other games, so be very conservative for now. + // + // Also, voice on should be ignored during the delay as well, but comprehensive tests are needed before implementing that + // due to some effects that appear to occur repeatedly during the delay on a PS1 but are currently only emulated as + // performed when the voice on is processed(e.g. curaddr = startaddr). + // + if(voice->DecodePlayDelay < 3) + { + if(voice->DecodePlayDelay) + PSX_DBG(PSX_DBG_WARNING, "[SPU] Voice %u off maybe should be ignored, but isn't due to current emulation code limitations; dpd=%u\n", voice_num, voice->DecodePlayDelay); + + ReleaseEnvelope(voice); + } + else + PSX_DBG(PSX_DBG_WARNING, "[SPU] Voice %u off ignored.\n", voice_num); } } @@ -964,6 +988,11 @@ void PS_SPU::Write(pscpu_timestamp_t timestamp, uint32 A, uint16 V) case 0x0E: voice->LoopAddr = (V << 2) & 0x3FFFF; voice->IgnoreSampLA = true; + + if(voice->DecodePlayDelay || (VoiceOn & (1U << (voice - Voices)))) + { + PSX_WARNING("[SPU] Loop address for voice %u written during voice on delay.", (unsigned)(voice - Voices)); + } //if((voice - Voices) == 22) //{ // SPUIRQ_DBG("Manual loop address setting for voice %d: %04x", (int)(voice - Voices), V);