diff options
author | gameblabla | 2019-07-18 02:17:35 +0200 |
---|---|---|
committer | gameblabla | 2019-07-18 02:17:35 +0200 |
commit | 3f28b64fb1baeedec76a150ee40eaec0b9095d92 (patch) | |
tree | 85b16cd7ec6c52d14359038bef860abc2572c704 /libpcsxcore | |
parent | ef1da3dc02d5c3683cca34f1f5c59ca1b2134c72 (diff) | |
download | pcsx_rearmed-3f28b64fb1baeedec76a150ee40eaec0b9095d92.tar.gz pcsx_rearmed-3f28b64fb1baeedec76a150ee40eaec0b9095d92.tar.bz2 pcsx_rearmed-3f28b64fb1baeedec76a150ee40eaec0b9095d92.zip |
psxbios : Add checks to memset.
This now can be a tricky pony and an improper memset implementation means that
you can't play Tomb Raider 4 properly.
(Trying to put in the eye of horus will just result in Lara sidestepping)
This should hopefully be fixed (and follows nocash doc).
Diffstat (limited to 'libpcsxcore')
-rw-r--r-- | libpcsxcore/psxbios.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index b327632..97c7951 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -805,8 +805,19 @@ void psxBios_memcpy() { // 0x2a void psxBios_memset() { // 0x2b char *p = (char *)Ra0; + v0 = a0; + if (a2 > 0x7FFFFFFF || a2 == 0) + { + v0 = 0; + pc0 = ra; + return; + } + if (a0 == 0) + { + pc0 = ra; + return; + } while ((s32)a2-- > 0) *p++ = (char)a1; - a2 = 0; v0 = a0; pc0 = ra; } |