X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fpsxbios.c;h=010a229b6e2c60c48ff48d1201cb930cf5b5a160;hb=857fabead1b570fcf4b1097b9549e0c54530d5e9;hp=044a19a855f14498735b3ba7d8b1924132527f65;hpb=d99f60685038ed3771d888284283fad04be3cdac;p=pcsx_rearmed.git diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index 044a19a8..010a229b 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -1610,7 +1610,6 @@ void psxBios_WaitEvent() { // 0a v0 = 0; pc0 = ra; - ResetIoCycle(); } void psxBios_TestEvent() { // 0b @@ -1668,8 +1667,20 @@ void psxBios_OpenTh() { // 0e int th; for (th=1; th<8; th++) + { if (Thread[th].status == 0) break; + } + if (th == 8) { + // Feb 2019 - Added out-of-bounds fix caught by cppcheck: + // When no free TCB is found, return 0xffffffff according to Nocash doc. +#ifdef PSXBIOS_LOG + PSXBIOS_LOG("\t%s() WARNING! No Free TCBs found!\n", __func__); +#endif + v0 = 0xffffffff; + pc0 = ra; + return; + } #ifdef PSXBIOS_LOG PSXBIOS_LOG("psxBios_%s: %x\n", biosB0n[0x0e], th); #endif @@ -1761,9 +1772,10 @@ void psxBios_StopPAD() { // 14 #ifdef PSXBIOS_LOG PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x14]); #endif - + if (pad_buf == 0){ pad_buf1 = NULL; pad_buf2 = NULL; + } pc0 = ra; } @@ -2098,15 +2110,16 @@ void psxBios_firstfile() { // 42 pfile = ffile+5; nfile = 1; if (!strncmp(pa0, "bu00", 4)) { + // firstfile() calls _card_read() internally, so deliver it's event + DeliverEvent(0x11, 0x2); bufile(1); } else if (!strncmp(pa0, "bu10", 4)) { + // firstfile() calls _card_read() internally, so deliver it's event + DeliverEvent(0x11, 0x2); bufile(2); } } - // firstfile() calls _card_read() internally, so deliver it's event - DeliverEvent(0x11, 0x2); - pc0 = ra; }