diff options
author | gameblabla | 2019-07-18 02:12:23 +0200 |
---|---|---|
committer | gameblabla | 2019-07-18 02:12:23 +0200 |
commit | fcf7ec6c12723009e4ad683841b46d0346c73934 (patch) | |
tree | 924b0487f8a633b533e7d2edac7fec3c907c251c /libpcsxcore | |
parent | 857fabead1b570fcf4b1097b9549e0c54530d5e9 (diff) | |
download | pcsx_rearmed-fcf7ec6c12723009e4ad683841b46d0346c73934.tar.gz pcsx_rearmed-fcf7ec6c12723009e4ad683841b46d0346c73934.tar.bz2 pcsx_rearmed-fcf7ec6c12723009e4ad683841b46d0346c73934.zip |
psxbios : Add checks to index and rindex calls
Return 0 for index/rindex if src is 0x00.
Diffstat (limited to 'libpcsxcore')
-rw-r--r-- | libpcsxcore/psxbios.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index 010a229..67a01e5 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); |