From: gameblabla Date: Thu, 18 Jul 2019 00:17:35 +0000 (+0200) Subject: psxbios : Add checks to memset. X-Git-Tag: r23~156^2~29 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=commitdiff_plain;h=3f28b64fb1baeedec76a150ee40eaec0b9095d92 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). --- diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index b327632b..97c79519 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; }