diff options
author | gameblabla | 2019-07-18 02:26:18 +0200 |
---|---|---|
committer | gameblabla | 2019-07-18 02:26:18 +0200 |
commit | c044e3e5d62089a53f1eacf99be9ecc1bb7cd012 (patch) | |
tree | fde7c028e56d1e6296b0894df85b355de9266958 | |
parent | 002b2f7d98f8c543cd88cb453c88b09eb5e556ad (diff) | |
download | pcsx_rearmed-c044e3e5d62089a53f1eacf99be9ecc1bb7cd012.tar.gz pcsx_rearmed-c044e3e5d62089a53f1eacf99be9ecc1bb7cd012.tar.bz2 pcsx_rearmed-c044e3e5d62089a53f1eacf99be9ecc1bb7cd012.zip |
psxbios: Add checks for strcmp & strncmp.
Yes, it's supposed to have a lot of checks like these.
Also merge some more fixes from PCSX4ALL. (upstream did not have
these as far as i know)
-rw-r--r-- | libpcsxcore/psxbios.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index df0550e..44711b5 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -541,13 +541,35 @@ void psxBios_strncat() { // 0x16 void psxBios_strcmp() { // 0x17 char *p1 = (char *)Ra0, *p2 = (char *)Ra1; - + s32 n=0; + if (a0 == 0 && a1 == 0) + { + v0 = 0; + pc0 = ra; + return; + } + else if (a0 == 0 && a1 != 0) + { + v0 = -1; + pc0 = ra; + return; + } + else if (a0 != 0 && a1 == 0) + { + v0 = 1; + pc0 = ra; + return; + } #ifdef PSXBIOS_LOG PSXBIOS_LOG("psxBios_%s: %s (%x), %s (%x)\n", biosA0n[0x17], Ra0, a0, Ra1, a1); #endif while (*p1 == *p2++) { + n++; if (*p1++ == '\0') { + v1=n-1; + a0+=n; + a1+=n; v0 = 0; pc0 = ra; return; @@ -555,6 +577,9 @@ void psxBios_strcmp() { // 0x17 } v0 = (*p1 - *--p2); + v1 = n; + a0+=n; + a1+=n; pc0 = ra; } |