Icache emulation from PCSX Redux + Senquack changes from PCSX4ALL (#198)
[pcsx_rearmed.git] / libpcsxcore / psxmem.c
index 3caf889..171104c 100644 (file)
@@ -176,7 +176,11 @@ int psxMemInit() {
        memcpy(psxMemWLUT + 0x8000, psxMemWLUT, 0x80 * sizeof(void *));
        memcpy(psxMemWLUT + 0xa000, psxMemWLUT, 0x80 * sizeof(void *));
 
-       psxMemWLUT[0x1f00] = (u8 *)psxP;
+       // Don't allow writes to PIO Expansion region (psxP) to take effect.
+       // NOTE: Not sure if this is needed to fix any games but seems wise,
+       //       seeing as some games do read from PIO as part of copy-protection
+       //       check. (See fix in psxMemReset() regarding psxP region reads).
+       psxMemWLUT[0x1f00] = NULL;
        psxMemWLUT[0x1f80] = (u8 *)psxH;
 
        return 0;
@@ -236,7 +240,7 @@ u8 psxMemRead8(u32 mem) {
 #ifdef PSXMEM_LOG
                        PSXMEM_LOG("err lb %8.8lx\n", mem);
 #endif
-                       return 0;
+                       return 0xFF;
                }
        }
 }
@@ -261,7 +265,7 @@ u16 psxMemRead16(u32 mem) {
 #ifdef PSXMEM_LOG
                        PSXMEM_LOG("err lh %8.8lx\n", mem);
 #endif
-                       return 0;
+                       return 0xFFFF;
                }
        }
 }
@@ -286,7 +290,7 @@ u32 psxMemRead32(u32 mem) {
 #ifdef PSXMEM_LOG
                        if (writeok) { PSXMEM_LOG("err lw %8.8lx\n", mem); }
 #endif
-                       return 0;
+                       return 0xFFFFFFFF;
                }
        }
 }