From: gameblabla Date: Thu, 18 Jul 2019 00:12:23 +0000 (+0200) Subject: psxbios : Add checks to index and rindex calls X-Git-Tag: r23~156^2~33 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fcf7ec6c12723009e4ad683841b46d0346c73934;p=pcsx_rearmed.git psxbios : Add checks to index and rindex calls Return 0 for index/rindex if src is 0x00. --- diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index 010a229b..67a01e5a 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -610,7 +610,13 @@ void psxBios_strlen() { // 0x1b void psxBios_index() { // 0x1c char *p = (char *)Ra0; - + if (a0 == 0) + { + v0 = 0; + pc0 = ra; + return; + } + do { if (*p == a1) { v0 = a0 + (p - (char *)Ra0); @@ -626,7 +632,11 @@ void psxBios_rindex() { // 0x1d char *p = (char *)Ra0; v0 = 0; - + if (a0 == 0) + { + pc0 = ra; + return; + } do { if (*p == a1) v0 = a0 + (p - (char *)Ra0);