notaz.gp2x.de
/
pcsx_rearmed.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
857fabe
)
psxbios : Add checks to index and rindex calls
author
gameblabla
<gameblabla@openmailbox.org>
Thu, 18 Jul 2019 00:12:23 +0000
(
02:12
+0200)
committer
gameblabla
<gameblabla@openmailbox.org>
Thu, 18 Jul 2019 00:12:23 +0000
(
02:12
+0200)
Return 0 for index/rindex if src is 0x00.
libpcsxcore/psxbios.c
patch
|
blob
|
blame
|
history
diff --git
a/libpcsxcore/psxbios.c
b/libpcsxcore/psxbios.c
index
010a229
..
67a01e5
100644
(file)
--- 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);