easier logging of unhandled stuff
authornotaz <notasas@gmail.com>
Thu, 8 Sep 2022 17:09:04 +0000 (20:09 +0300)
committernotaz <notasas@gmail.com>
Thu, 8 Sep 2022 21:21:17 +0000 (00:21 +0300)
libpcsxcore/cdrom.c
libpcsxcore/mdec.c
libpcsxcore/psxdma.c
libpcsxcore/psxhw.c
libpcsxcore/system.h
plugins/dfsound/externals.h
plugins/dfsound/registers.c

index ebbad97..0307192 100644 (file)
@@ -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;
        }
 
index 4b93ffa..ca42458 100644 (file)
@@ -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;
        }
 
index df02b00..8a2b9a9 100644 (file)
@@ -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);
index 7b2401b..b7540df 100644 (file)
@@ -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
index cd1814c..254be08 100644 (file)
@@ -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
index 3dea188..5157412 100644 (file)
@@ -24,6 +24,9 @@
 // generic defines\r
 /////////////////////////////////////////////////////////\r
 \r
+//#define log_unhandled printf\r
+#define log_unhandled(...)\r
+\r
 #ifdef __GNUC__\r
 #define noinline __attribute__((noinline))\r
 #define unlikely(x) __builtin_expect((x), 0)\r
index 6b62247..e75f708 100644 (file)
@@ -161,6 +161,17 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val,
       break;\r
     //-------------------------------------------------//\r
 \r
+    case H_SPUmvolL:\r
+    case H_SPUmvolR:\r
+      if (val & 0x8000)\r
+        log_unhandled("w master sweep: %08lx %04x\n", reg, val);\r
+      break;\r
+\r
+    case 0x0dac:\r
+     if (val != 4)\r
+       log_unhandled("1f801dac %04x\n", val);\r
+     break;\r
+\r
 /*\r
     case H_ExtLeft:\r
      //auxprintf("EL %d\n",val);\r
@@ -335,6 +346,10 @@ unsigned short CALLBACK SPUreadRegister(unsigned long reg)
     //case H_SPUIsOn2:\r
     // return IsSoundOn(16,24);\r
  \r
+    case H_SPUMute1:\r
+    case H_SPUMute2:\r
+     log_unhandled("r isOn: %08lx\n", reg);\r
+     break;\r
   }\r
 \r
  return spu.regArea[(r-0xc00)>>1];\r
@@ -431,6 +446,7 @@ static void SetVolumeL(unsigned char ch,short vol)     // LEFT VOLUME
  if(vol&0x8000)                                        // sweep?\r
   {\r
    short sInc=1;                                       // -> sweep up?\r
+   log_unhandled("ch%d sweepl %04x\n", ch, vol);\r
    if(vol&0x2000) sInc=-1;                             // -> or down?\r
    if(vol&0x1000) vol^=0xffff;                         // -> mmm... phase inverted? have to investigate this\r
    vol=((vol&0x7f)+1)/2;                               // -> sweep: 0..127 -> 0..64\r
@@ -457,6 +473,7 @@ static void SetVolumeR(unsigned char ch,short vol)     // RIGHT VOLUME
  if(vol&0x8000)                                        // comments... see above :)\r
   {\r
    short sInc=1;\r
+   log_unhandled("ch%d sweepr %04x\n", ch, vol);\r
    if(vol&0x2000) sInc=-1;\r
    if(vol&0x1000) vol^=0xffff;\r
    vol=((vol&0x7f)+1)/2;        \r