diff options
author | gameblabla | 2019-07-18 02:13:13 +0200 |
---|---|---|
committer | gameblabla | 2019-07-18 02:14:29 +0200 |
commit | 0148ffb739a05e87ed9eaaf623c754d3d50ee2ab (patch) | |
tree | 3f139230ec42e310932b7bad75e1dd4c7a32acca /libpcsxcore/psxbios.c | |
parent | fcf7ec6c12723009e4ad683841b46d0346c73934 (diff) | |
download | pcsx_rearmed-0148ffb739a05e87ed9eaaf623c754d3d50ee2ab.tar.gz pcsx_rearmed-0148ffb739a05e87ed9eaaf623c754d3d50ee2ab.tar.bz2 pcsx_rearmed-0148ffb739a05e87ed9eaaf623c754d3d50ee2ab.zip |
psxbios: Add checks for bcopy
Nocash documentation say that function refuses to copy any data
if dst is NULL or len greater than 0x7FFFFFFF.
(In any cases, return value is always dst)
Diffstat (limited to 'libpcsxcore/psxbios.c')
-rw-r--r-- | libpcsxcore/psxbios.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index 67a01e5..4019234 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -739,15 +739,20 @@ void psxBios_tolower() { // 0x26 void psxBios_bcopy() { // 0x27 char *p1 = (char *)Ra1, *p2 = (char *)Ra0; + v0 = a0; + if (a0 == 0 || a2 > 0x7FFFFFFF) + { + pc0 = ra; + return; + } while ((s32)a2-- > 0) *p1++ = *p2++; - + a2 = 0; pc0 = ra; } void psxBios_bzero() { // 0x28 char *p = (char *)Ra0; while ((s32)a1-- > 0) *p++ = '\0'; - pc0 = ra; } |