X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=libpcsxcore%2Fpsxhw.c;h=54e03f6420e058dc09c8a1540982e3231d258b5b;hp=9123f76ceb209b72e5b7551a2cb2e0e2b4620e2d;hb=1f77c86322bf6567909da192fdbf6c28c0596a13;hpb=ef79bbde537d6b9c745a7d86cb9df1d04c35590d diff --git a/libpcsxcore/psxhw.c b/libpcsxcore/psxhw.c index 9123f76c..54e03f64 100644 --- a/libpcsxcore/psxhw.c +++ b/libpcsxcore/psxhw.c @@ -25,6 +25,9 @@ #include "mdec.h" #include "cdrom.h" +//#undef PSXHW_LOG +//#define PSXHW_LOG printf + void psxHwReset() { if (Config.Sio) psxHu32ref(0x1070) |= SWAP32(0x80); if (Config.SpuIrq) psxHu32ref(0x1070) |= SWAP32(0x200); @@ -431,6 +434,8 @@ void psxHwWrite16(u32 add, u16 value) { PSXHW_LOG("IMASK 16bit write %x\n", value); #endif psxHu16ref(0x1074) = SWAPu16(value); + if (psxHu16ref(0x1070) & value) + new_dyna_set_event(PSXINT_NEWDRC_CHECK, 1); return; case 0x1f801100: @@ -543,6 +548,8 @@ void psxHwWrite32(u32 add, u32 value) { PSXHW_LOG("IMASK 32bit write %x\n", value); #endif psxHu32ref(0x1074) = SWAPu32(value); + if (psxHu32ref(0x1070) & value) + new_dyna_set_event(PSXINT_NEWDRC_CHECK, 1); return; #ifdef PSXHW_LOG @@ -654,8 +661,15 @@ void psxHwWrite32(u32 add, u32 value) { PSXHW_LOG("DMA ICR 32bit write %x\n", value); #endif { - u32 tmp = (~value) & SWAPu32(HW_DMA_ICR); - HW_DMA_ICR = SWAPu32(((tmp ^ value) & 0xffffff) ^ tmp); + u32 tmp = value & 0x00ff803f; + tmp |= (SWAPu32(HW_DMA_ICR) & ~value) & 0x7f000000; + if ((tmp & HW_DMA_ICR_GLOBAL_ENABLE && tmp & 0x7f000000) + || tmp & HW_DMA_ICR_BUS_ERROR) { + if (!(SWAPu32(HW_DMA_ICR) & HW_DMA_ICR_IRQ_SENT)) + psxHu32ref(0x1070) |= SWAP32(8); + tmp |= HW_DMA_ICR_IRQ_SENT; + } + HW_DMA_ICR = SWAPu32(tmp); return; } @@ -724,6 +738,13 @@ void psxHwWrite32(u32 add, u32 value) { psxRcntWtarget(2, value & 0xffff); return; default: + // Dukes of Hazard 2 - car engine noise + if (add>=0x1f801c00 && add<0x1f801e00) { + SPU_writeRegister(add, value&0xffff); + SPU_writeRegister(add + 2, value>>16); + return; + } + psxHu32ref(add) = SWAPu32(value); #ifdef PSXHW_LOG PSXHW_LOG("*Unknown 32bit write at address %x value %x\n", add, value);