Merge pull request #561 from gameblabla/sony_armored_fix_libretro
[pcsx_rearmed.git] / libpcsxcore / psxhw.c
index 1f85278..5981ee5 100644 (file)
@@ -123,7 +123,14 @@ u16 psxHwRead16(u32 add) {
                        return hard;
                case 0x1f80105e:
                        hard = SIO1_readBaud16();
-                       return hard;\r
+                       return hard;
+#else
+               /* Fixes Armored Core misdetecting the Link cable being detected.
+                * We want to turn that thing off and force it to do local multiplayer instead.
+                * Thanks Sony for the fix, they fixed it in their PS Classic fork.
+                */
+               case 0x1f801054:
+                       return 0x80;\r
 #endif
                case 0x1f801100:
                        hard = psxRcntRcount(0);
@@ -431,7 +438,7 @@ void psxHwWrite16(u32 add, u16 value) {
 #endif
                        if (Config.Sio) psxHu16ref(0x1070) |= SWAPu16(0x80);
                        if (Config.SpuIrq) psxHu16ref(0x1070) |= SWAPu16(0x200);
-                       psxHu16ref(0x1070) &= SWAPu16((psxHu16(0x1074) & value));
+                       psxHu16ref(0x1070) &= SWAPu16(value);
                        return;
 
                case 0x1f801074:
@@ -493,7 +500,7 @@ void psxHwWrite16(u32 add, u16 value) {
 
                default:
                        if (add>=0x1f801c00 && add<0x1f801e00) {
-               SPU_writeRegister(add, value);
+                               SPU_writeRegister(add, value, psxRegs.cycle);
                                return;
                        }
 
@@ -546,7 +553,7 @@ void psxHwWrite32(u32 add, u32 value) {
 #endif
                        if (Config.Sio) psxHu32ref(0x1070) |= SWAPu32(0x80);
                        if (Config.SpuIrq) psxHu32ref(0x1070) |= SWAPu32(0x200);
-                       psxHu32ref(0x1070) &= SWAPu32((psxHu32(0x1074) & value));
+                       psxHu32ref(0x1070) &= SWAPu32(value);
                        return;
                case 0x1f801074:
 #ifdef PSXHW_LOG
@@ -747,8 +754,8 @@ void psxHwWrite32(u32 add, u32 value) {
                default:
                        // Dukes of Hazard 2 - car engine noise
                        if (add>=0x1f801c00 && add<0x1f801e00) {
-                               SPU_writeRegister(add, value&0xffff);
-                               SPU_writeRegister(add + 2, value>>16);
+                               SPU_writeRegister(add, value&0xffff, psxRegs.cycle);
+                               SPU_writeRegister(add + 2, value>>16, psxRegs.cycle);
                                return;
                        }