X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=libpcsxcore%2Fpsxbios.c;h=775fba7ed057ce0a75447d8b1cc5ced84835ebe5;hb=cd1ea24508e604743ad8d9c67199510c7498ef29;hp=fd609559b5393cb50fc590d826746f4185a00106;hpb=595a136b9285a14046cfb7e09eedabed844f5b2c;p=pcsx_rearmed.git diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index fd609559..775fba7e 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -1191,7 +1191,7 @@ void psxBios_sys_a0_4c() { // 0x4c GPU relate GPU_writeData(0x0400000); GPU_writeData(0x0200000); GPU_writeData(0x0100000); - + v0 = 0x1f801814; pc0 = ra; } @@ -1279,11 +1279,29 @@ void psxBios__card_info() { // ab #ifdef PSXBIOS_LOG PSXBIOS_LOG("psxBios_%s: %x\n", biosA0n[0xab], a0); #endif - + u32 ret; card_active_chan = a0; + switch (card_active_chan) + { + case 0x00: case 0x01: case 0x02: case 0x03: + ret = Config.Mcd1[0] ? 0x2 : 0x8; + break; + case 0x10: case 0x11: case 0x12: case 0x13: + ret = Config.Mcd2[0] ? 0x2 : 0x8; + break; + default: +#ifdef PSXBIOS_LOG + PSXBIOS_LOG("psxBios_%s: UNKNOWN PORT 0x%x\n", biosA0n[0xab], card_active_chan); +#endif + ret = 0x11; + break; + } + +// DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004 // DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004 DeliverEvent(0x81, 0x2); // 0xf4000001, 0x0004 + DeliverEvent(0x81, ret); // 0xf4000001, 0x0004 v0 = 1; pc0 = ra; } @@ -2128,7 +2146,13 @@ void psxBios__card_write() { // 0x4e #ifdef PSXBIOS_LOG PSXBIOS_LOG("psxBios_%s: %x,%x,%x\n", biosB0n[0x4e], a0, a1, a2); #endif - + /* Function also accepts sector 400h (a bug) */ + if (!(a1 <= 0x400)) + { + /* Invalid sectors */ + v0 = 0; pc0 = ra; + return; + } card_active_chan = a0; port = a0 >> 4; @@ -2155,7 +2179,13 @@ void psxBios__card_read() { // 0x4f #ifdef PSXBIOS_LOG PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x4f]); #endif - + /* Function also accepts sector 400h (a bug) */ + if (!(a1 <= 0x400)) + { + /* Invalid sectors */ + v0 = 0; pc0 = ra; + return; + } card_active_chan = a0; port = a0 >> 4; @@ -2877,8 +2907,9 @@ void psxBiosException() { #endif switch (a0) { case 1: // EnterCritical - disable irq's - psxRegs.CP0.n.Status &= ~0x404; -v0=1; // HDHOSHY experimental patch: Spongebob, Coldblood, fearEffect, Medievil2, Martian Gothic + /* Fixes Medievil 2 not loading up new game, Digimon World not booting up and possibly others */ + v0 = (psxRegs.CP0.n.Status & 0x404) == 0x404; + psxRegs.CP0.n.Status &= ~0x404; break; case 2: // ExitCritical - enable irq's