X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=libpcsxcore%2Fr3000a.c;h=1e8d0b0e4eb6aea81dd698fbce212d75d4008fbd;hp=148bc267992315fafc134f8179c38a4cadb5d7f3;hb=ab948f7e6d437dddd070000f36489d7e983eb4ad;hpb=528ad661dd07067cbcd6c1beebad63fc36795759 diff --git a/libpcsxcore/r3000a.c b/libpcsxcore/r3000a.c index 148bc267..1e8d0b0e 100644 --- a/libpcsxcore/r3000a.c +++ b/libpcsxcore/r3000a.c @@ -48,8 +48,6 @@ int psxInit() { } void psxReset() { - psxCpu->Reset(); - psxMemReset(); memset(&psxRegs, 0, sizeof(psxRegs)); @@ -59,6 +57,8 @@ void psxReset() { psxRegs.CP0.r[12] = 0x10900000; // COP0 enabled | BEV = 1 | TS = 1 psxRegs.CP0.r[15] = 0x00000002; // PRevID = Revision ID, same as R3000A + psxCpu->Reset(); + psxHwReset(); psxBiosInit(); @@ -79,6 +79,15 @@ void psxShutdown() { } void psxException(u32 code, u32 bd) { + if (!Config.HLE && (((PSXMu32(psxRegs.pc) >> 24) & 0xfe) == 0x4a)) { + // "hokuto no ken" / "Crash Bandicot 2" ... + // BIOS does not allow to return to GTE instructions + // (just skips it, supposedly because it's scheduled already) + // so we step over it with the interpreter + extern void execI(); + execI(); + } + // Set the Cause psxRegs.CP0.n.Cause = code; @@ -102,11 +111,6 @@ void psxException(u32 code, u32 bd) { psxRegs.CP0.n.Status = (psxRegs.CP0.n.Status &~0x3f) | ((psxRegs.CP0.n.Status & 0xf) << 2); - if (!Config.HLE && (((PSXMu32(psxRegs.CP0.n.EPC) >> 24) & 0xfe) == 0x4a)) { - // "hokuto no ken" / "Crash Bandicot 2" ... fix - PSXMu32ref(psxRegs.CP0.n.EPC)&= SWAPu32(~0x02000000); - } - if (Config.HLE) psxBiosException(); } @@ -157,6 +161,30 @@ void psxBranchTest() { mdec0Interrupt(); } } + if (psxRegs.interrupt & (1 << PSXINT_GPUOTCDMA)) { // gpu otc + if ((psxRegs.cycle - psxRegs.intCycle[PSXINT_GPUOTCDMA].sCycle) >= psxRegs.intCycle[PSXINT_GPUOTCDMA].cycle) { + psxRegs.interrupt &= ~(1 << PSXINT_GPUOTCDMA); + gpuotcInterrupt(); + } + } + if (psxRegs.interrupt & (1 << PSXINT_CDRDMA)) { // cdrom + if ((psxRegs.cycle - psxRegs.intCycle[PSXINT_CDRDMA].sCycle) >= psxRegs.intCycle[PSXINT_CDRDMA].cycle) { + psxRegs.interrupt &= ~(1 << PSXINT_CDRDMA); + cdrDmaInterrupt(); + } + } + if (psxRegs.interrupt & (1 << PSXINT_CDRPLAY)) { // cdr play timing + if ((psxRegs.cycle - psxRegs.intCycle[PSXINT_CDRPLAY].sCycle) >= psxRegs.intCycle[PSXINT_CDRPLAY].cycle) { + psxRegs.interrupt &= ~(1 << PSXINT_CDRPLAY); + cdrPlayInterrupt(); + } + } + if (psxRegs.interrupt & (1 << PSXINT_CDRLID)) { // cdr lid states + if ((psxRegs.cycle - psxRegs.intCycle[PSXINT_CDRLID].sCycle) >= psxRegs.intCycle[PSXINT_CDRLID].cycle) { + psxRegs.interrupt &= ~(1 << PSXINT_CDRLID); + cdrLidSeekInterrupt(); + } + } } if (psxHu32(0x1070) & psxHu32(0x1074)) {