From 7df2c03cc775292b1bcc2b2eb6486e2ae83faa87 Mon Sep 17 00:00:00 2001 From: notaz Date: Thu, 8 Sep 2022 20:09:04 +0300 Subject: [PATCH] easier logging of unhandled stuff --- libpcsxcore/cdrom.c | 6 ++++-- libpcsxcore/mdec.c | 2 +- libpcsxcore/psxdma.c | 12 +++--------- libpcsxcore/psxhw.c | 7 +++++++ libpcsxcore/system.h | 4 ++++ plugins/dfsound/externals.h | 3 +++ plugins/dfsound/registers.c | 17 +++++++++++++++++ 7 files changed, 39 insertions(+), 12 deletions(-) diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index ebbad972..03071921 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -35,7 +35,7 @@ #if 0 #define CDR_LOG_I SysPrintf #else -#define CDR_LOG_I(...) +#define CDR_LOG_I log_unhandled #endif #if 0 #define CDR_LOG_IO SysPrintf @@ -1495,6 +1495,8 @@ void psxDma3(u32 madr, u32 bcr, u32 chcr) { cdr.FifoOffset += size; psxCpu->Clear(madr, size / 4); } + if (size < cdsize) + CDR_LOG_I("cdrom: dma3 %d/%d\n", size, cdsize); CDRDMA_INT((cdsize/4) * 24); @@ -1510,7 +1512,7 @@ void psxDma3(u32 madr, u32 bcr, u32 chcr) { return; default: - CDR_LOG("psxDma3() Log: Unknown cddma %x\n", chcr); + CDR_LOG_I("psxDma3() Log: Unknown cddma %x\n", chcr); break; } diff --git a/libpcsxcore/mdec.c b/libpcsxcore/mdec.c index 4b93ffa5..ca424585 100644 --- a/libpcsxcore/mdec.c +++ b/libpcsxcore/mdec.c @@ -520,7 +520,7 @@ void psxDma0(u32 adr, u32 bcr, u32 chcr) { break; default: - // printf("mdec unknown command\n"); + log_unhandled("mdec: unknown command %08x\n", cmd); break; } diff --git a/libpcsxcore/psxdma.c b/libpcsxcore/psxdma.c index df02b00f..8a2b9a93 100644 --- a/libpcsxcore/psxdma.c +++ b/libpcsxcore/psxdma.c @@ -76,11 +76,9 @@ void psxDma4(u32 madr, u32 bcr, u32 chcr) { // SPU SPUDMA_INT(words * 4); return; -#ifdef PSXDMA_LOG default: - PSXDMA_LOG("*** DMA4 SPU - unknown *** %x addr = %x size = %x\n", chcr, madr, bcr); + log_unhandled("*** DMA4 SPU - unknown *** %x addr = %x size = %x\n", chcr, madr, bcr); break; -#endif } HW_DMA4_CHCR &= SWAP32(~0x01000000); @@ -199,11 +197,9 @@ void psxDma2(u32 madr, u32 bcr, u32 chcr) { // GPU GPUDMA_INT(size); return; -#ifdef PSXDMA_LOG default: - PSXDMA_LOG("*** DMA 2 - GPU unknown *** %lx addr = %lx size = %lx\n", chcr, madr, bcr); + log_unhandled("*** DMA 2 - GPU unknown *** %x addr = %x size = %x\n", chcr, madr, bcr); break; -#endif } HW_DMA2_CHCR &= SWAP32(~0x01000000); @@ -252,12 +248,10 @@ void psxDma6(u32 madr, u32 bcr, u32 chcr) { GPUOTCDMA_INT(16); return; } -#ifdef PSXDMA_LOG else { // Unknown option - PSXDMA_LOG("*** DMA6 OT - unknown *** %x addr = %x size = %x\n", chcr, madr, bcr); + log_unhandled("*** DMA6 OT - unknown *** %x addr = %x size = %x\n", chcr, madr, bcr); } -#endif HW_DMA6_CHCR &= SWAP32(~0x01000000); DMA_INTERRUPT(6); diff --git a/libpcsxcore/psxhw.c b/libpcsxcore/psxhw.c index 7b2401b1..b7540dfc 100644 --- a/libpcsxcore/psxhw.c +++ b/libpcsxcore/psxhw.c @@ -190,6 +190,10 @@ u16 psxHwRead16(u32 add) { //case 0x1f802030: hard = //int_2000???? //case 0x1f802040: hard =//dip switches...?? + case 0x1f801800: + case 0x1f801802: + log_unhandled("cdrom r16 %x\n", add); + // falthrough default: if (add >= 0x1f801c00 && add < 0x1f801e00) { hard = SPU_readRegister(add); @@ -348,6 +352,9 @@ u32 psxHwRead32(u32 add) { #endif return hard; + case 0x1f801800: + log_unhandled("cdrom r32 %x\n", add); + // falthrough default: hard = psxHu32(add); #ifdef PSXHW_LOG diff --git a/libpcsxcore/system.h b/libpcsxcore/system.h index cd1814c2..254be083 100644 --- a/libpcsxcore/system.h +++ b/libpcsxcore/system.h @@ -37,6 +37,10 @@ void SysRunGui(); // Returns to the Gui void SysClose(); // Close mem and plugins void SysDLog(const char *fmt, ...); // Prints debug-level logs +// log if the game does something we don't handle (well) +//#define log_unhandled printf +#define log_unhandled(...) + #ifdef __cplusplus } #endif diff --git a/plugins/dfsound/externals.h b/plugins/dfsound/externals.h index 3dea188c..51574121 100644 --- a/plugins/dfsound/externals.h +++ b/plugins/dfsound/externals.h @@ -24,6 +24,9 @@ // generic defines ///////////////////////////////////////////////////////// +//#define log_unhandled printf +#define log_unhandled(...) + #ifdef __GNUC__ #define noinline __attribute__((noinline)) #define unlikely(x) __builtin_expect((x), 0) diff --git a/plugins/dfsound/registers.c b/plugins/dfsound/registers.c index 6b62247f..e75f7086 100644 --- a/plugins/dfsound/registers.c +++ b/plugins/dfsound/registers.c @@ -161,6 +161,17 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val, break; //-------------------------------------------------// + case H_SPUmvolL: + case H_SPUmvolR: + if (val & 0x8000) + log_unhandled("w master sweep: %08lx %04x\n", reg, val); + break; + + case 0x0dac: + if (val != 4) + log_unhandled("1f801dac %04x\n", val); + break; + /* case H_ExtLeft: //auxprintf("EL %d\n",val); @@ -335,6 +346,10 @@ unsigned short CALLBACK SPUreadRegister(unsigned long reg) //case H_SPUIsOn2: // return IsSoundOn(16,24); + case H_SPUMute1: + case H_SPUMute2: + log_unhandled("r isOn: %08lx\n", reg); + break; } return spu.regArea[(r-0xc00)>>1]; @@ -431,6 +446,7 @@ static void SetVolumeL(unsigned char ch,short vol) // LEFT VOLUME if(vol&0x8000) // sweep? { short sInc=1; // -> sweep up? + log_unhandled("ch%d sweepl %04x\n", ch, vol); if(vol&0x2000) sInc=-1; // -> or down? if(vol&0x1000) vol^=0xffff; // -> mmm... phase inverted? have to investigate this vol=((vol&0x7f)+1)/2; // -> sweep: 0..127 -> 0..64 @@ -457,6 +473,7 @@ static void SetVolumeR(unsigned char ch,short vol) // RIGHT VOLUME if(vol&0x8000) // comments... see above :) { short sInc=1; + log_unhandled("ch%d sweepr %04x\n", ch, vol); if(vol&0x2000) sInc=-1; if(vol&0x1000) vol^=0xffff; vol=((vol&0x7f)+1)/2; -- 2.39.5