From 4726dba005562cbaf69cc8e10ef7102184c4a089 Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 6 Dec 2014 18:26:16 +0200 Subject: psxmem: remove hard requirement for a mapping not all platforms have 1f800000 free not all mmap implementations use the addr hint.. --- libpcsxcore/new_dynarec/assem_arm.c | 14 ++++++++++---- libpcsxcore/psxmem.c | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) 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; -- cgit v1.2.3 From d515eaa2e43d87a2fe7d54b7f7b30174631f2d18 Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 6 Dec 2014 19:14:34 +0200 Subject: misc: don't succeed on trash input --- libpcsxcore/misc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index 874624d..905f142 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; @@ -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[] = { -- cgit v1.2.3 From 52990dd97f8a7abbe5b24d3405f3bcc3ba426e5d Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 6 Dec 2014 22:52:05 +0200 Subject: misc: length is unsigned --- libpcsxcore/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index 905f142..a27f60f 100644 --- a/libpcsxcore/misc.c +++ b/libpcsxcore/misc.c @@ -123,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])) { -- cgit v1.2.3