aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTwinaphex2014-12-07 12:00:27 +0100
committerTwinaphex2014-12-07 12:00:27 +0100
commit13bb560e427a36c6900ea09061efecc2a67d53d0 (patch)
treedecc30d337005061b294f8f30371d373f74a425a
parent89329f140b3a7982dd3529ab374195b0e0b23dc8 (diff)
parent52990dd97f8a7abbe5b24d3405f3bcc3ba426e5d (diff)
downloadpcsx_rearmed-13bb560e427a36c6900ea09061efecc2a67d53d0.tar.gz
pcsx_rearmed-13bb560e427a36c6900ea09061efecc2a67d53d0.tar.bz2
pcsx_rearmed-13bb560e427a36c6900ea09061efecc2a67d53d0.zip
Merge pull request #9 from Kekun/fix-load-invalid-game
Fixes an infinite loop when loading an invalid game
-rw-r--r--libpcsxcore/misc.c6
-rw-r--r--libpcsxcore/new_dynarec/assem_arm.c14
-rw-r--r--libpcsxcore/psxmem.c4
3 files changed, 16 insertions, 8 deletions
diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c
index 874624d..a27f60f 100644
--- a/libpcsxcore/misc.c
+++ b/libpcsxcore/misc.c
@@ -109,6 +109,7 @@ void mmssdd( char *b, char *p )
int GetCdromFile(u8 *mdir, u8 *time, char *filename) {
struct iso_directory_record *dir;
+ int retval = -1;
u8 ddir[4096];
u8 *buf;
int i;
@@ -122,7 +123,7 @@ int GetCdromFile(u8 *mdir, u8 *time, char *filename) {
if (dir->length[0] == 0) {
return -1;
}
- i += dir->length[0];
+ i += (u8)dir->length[0];
if (dir->flags[0] & 0x2) { // it's a dir
if (!strnicmp((char *)&dir->name[0], filename, dir->name_len[0])) {
@@ -138,11 +139,12 @@ int GetCdromFile(u8 *mdir, u8 *time, char *filename) {
} else {
if (!strnicmp((char *)&dir->name[0], filename, strlen(filename))) {
mmssdd(dir->extent, (char *)time);
+ retval = 0;
break;
}
}
}
- return 0;
+ return retval;
}
static const unsigned int gpu_ctl_def[] = {
diff --git a/libpcsxcore/new_dynarec/assem_arm.c b/libpcsxcore/new_dynarec/assem_arm.c
index 45edd65..9ee832e 100644
--- a/libpcsxcore/new_dynarec/assem_arm.c
+++ b/libpcsxcore/new_dynarec/assem_arm.c
@@ -3999,10 +3999,16 @@ static int emit_fastpath_cmp_jump(int i,int addr,int *addr_reg_override)
type=0;
}
else if(type==MTYPE_1F80) { // scratchpad
- emit_addimm(addr,-0x1f800000,HOST_TEMPREG);
- emit_cmpimm(HOST_TEMPREG,0x1000);
- jaddr=(int)out;
- emit_jc(0);
+ if (psxH == (void *)0x1f800000) {
+ emit_addimm(addr,-0x1f800000,HOST_TEMPREG);
+ emit_cmpimm(HOST_TEMPREG,0x1000);
+ jaddr=(int)out;
+ emit_jc(0);
+ }
+ else {
+ // do usual RAM check, jump will go to the right handler
+ type=0;
+ }
}
#endif
diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c
index 2ca5dd5..7001744 100644
--- a/libpcsxcore/psxmem.c
+++ b/libpcsxcore/psxmem.c
@@ -150,11 +150,11 @@ int psxMemInit() {
}
psxP = &psxM[0x200000];
- psxH = psxMap(0x1f800000, 0x10000, 1, MAP_TAG_OTHER);
+ psxH = psxMap(0x1f800000, 0x10000, 0, MAP_TAG_OTHER);
psxR = psxMap(0x1fc00000, 0x80000, 0, MAP_TAG_OTHER);
if (psxMemRLUT == NULL || psxMemWLUT == NULL ||
- psxR == NULL || psxP == NULL || psxH != (void *)0x1f800000) {
+ psxR == NULL || psxP == NULL || psxH == NULL) {
SysMessage(_("Error allocating memory!"));
psxMemShutdown();
return -1;