From 7ab47906292181bc9ddaac26c20c11d7c1572321 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 26 May 2013 22:44:23 +0200 Subject: Remove #if 0 around NEON enhancement --- frontend/libretro.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/frontend/libretro.c b/frontend/libretro.c index 644db92..413098d 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -243,9 +243,7 @@ void retro_set_environment(retro_environment_t cb) { "region", "Region; Auto|NTSC|PAL" }, #ifdef __ARM_NEON__ { "neon_interlace_enable", "Enable interlacing mode(s); disabled|enabled" }, -#if 0 { "neon_enhancement_enable", "Enhanced resolution (slow); disabled|enabled" }, -#endif #endif { NULL, NULL }, }; @@ -770,7 +768,6 @@ static void update_variables(bool in_flight) pl_rearmed_cbs.gpu_neon.allow_interlace = 1; } -#if 0 var.value = NULL; var.key = "neon_enhancement_enable"; @@ -781,7 +778,6 @@ static void update_variables(bool in_flight) else if (strcmp(var.value, "enabled") == 0) pl_rearmed_cbs.gpu_neon.enhancement_enable = 1; } -#endif #endif if (in_flight) { -- cgit v1.2.3 From 354329faa304cfc2da1ef2f4ce9ef5e06c7d3489 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 27 May 2013 00:31:25 +0200 Subject: Core option: Add neon_enhancement_no_main --- frontend/libretro.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frontend/libretro.c b/frontend/libretro.c index 413098d..9be52f5 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -244,6 +244,7 @@ void retro_set_environment(retro_environment_t cb) #ifdef __ARM_NEON__ { "neon_interlace_enable", "Enable interlacing mode(s); disabled|enabled" }, { "neon_enhancement_enable", "Enhanced resolution (slow); disabled|enabled" }, + { "neon_enhancement_no_main", "Enhanced resolution speed hack; disabled|enabled" }, #endif { NULL, NULL }, }; @@ -778,6 +779,17 @@ static void update_variables(bool in_flight) else if (strcmp(var.value, "enabled") == 0) pl_rearmed_cbs.gpu_neon.enhancement_enable = 1; } + + var.value = NULL; + var.key = "neon_enhancement_no_main"; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) + { + if (strcmp(var.value, "disabled") == 0) + pl_rearmed_cbs.gpu_neon.enhancement_no_main = 0; + else if (strcmp(var.value, "enabled") == 0) + pl_rearmed_cbs.gpu_neon.enhancement_no_main = 1; + } #endif if (in_flight) { -- cgit v1.2.3 From 41294f4d869ce943b6144a1dd469105681d32ec1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 27 May 2013 12:28:34 +0200 Subject: (Blackberry Playbook) Fix Blackberry Playbook build - strcasestr is not implemented --- frontend/libretro.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/frontend/libretro.c b/frontend/libretro.c index 9be52f5..ec034c2 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -591,6 +591,33 @@ static void extract_directory(char *buf, const char *path, size_t size) } } +#ifdef __QNX__ +/* Blackberry QNX doesn't have strcasestr */ + +/* + * Find the first occurrence of find in s, ignore case. + */ +char * +strcasestr(const char *s, const char*find) +{ + char c, sc; + size_t len; + + if ((c = *find++) != 0) { + c = tolower((unsigned char)c); + len = strlen(find); + do { + do { + if ((sc = *s++) == 0) + return (NULL); + } while ((char)tolower((unsigned char)sc) != c); + } while (strncasecmp(s, find, len) != 0); + s--; + } + return ((char *)s); +} +#endif + bool retro_load_game(const struct retro_game_info *info) { size_t i; -- cgit v1.2.3 From 2e058581166a4b0dea91af3c4ae56054e5da6e75 Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 4 Jun 2013 23:46:43 +0300 Subject: cdriso: log file open errors --- libpcsxcore/cdriso.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index bfa7d76..d6672f9 100644 --- a/libpcsxcore/cdriso.c +++ b/libpcsxcore/cdriso.c @@ -34,6 +34,7 @@ #include #include #endif +#include #include unsigned int cdrIsoMultidiskCount; @@ -1222,6 +1223,8 @@ static long CALLBACK ISOopen(void) { cdHandle = fopen(GetIsoFile(), "rb"); if (cdHandle == NULL) { + SysPrintf(_("Could't open '%s' for reading: %s\n"), + GetIsoFile(), strerror(errno)); return -1; } -- cgit v1.2.3 From 74ebc05b15569d7745b9ab59f9b289f427abeeac Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 5 Jun 2013 00:51:12 +0300 Subject: libretro: search for BIOS harder --- frontend/libretro.c | 85 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 15 deletions(-) diff --git a/frontend/libretro.c b/frontend/libretro.c index ec034c2..103ee8e 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "../libpcsxcore/misc.h" #include "../libpcsxcore/psxcounters.h" @@ -861,13 +862,67 @@ void retro_run(void) vout_fb_dirty = 0; } +static bool try_use_bios(const char *path) +{ + FILE *f; + long size; + const char *name; + + f = fopen(path, "rb"); + if (f == NULL) + return false; + + fseek(f, 0, SEEK_END); + size = ftell(f); + fclose(f); + + if (size != 512 * 1024) + return false; + + name = strrchr(path, SLASH); + if (name++ == NULL) + name = path; + snprintf(Config.Bios, sizeof(Config.Bios), "%s", name); + return true; +} + +#if 1 +#include +#include + +static bool find_any_bios(const char *dirpath, char *path, size_t path_size) +{ + DIR *dir; + struct dirent *ent; + bool ret = false; + + dir = opendir(dirpath); + if (dir == NULL) + return false; + + while ((ent = readdir(dir))) { + if (strncasecmp(ent->d_name, "scph", 4) != 0) + continue; + + snprintf(path, path_size, "%s/%s", dirpath, ent->d_name); + ret = try_use_bios(path); + if (ret) + break; + } + closedir(dir); + return ret; +} +#else +#define find_any_bios(...) false +#endif + void retro_init(void) { const char *bios[] = { "scph1001", "scph5501", "scph7001" }; const char *dir; char path[256]; - FILE *f = NULL; int i, ret, level; + bool found_bios = false; ret = emu_core_preinit(); ret |= emu_core_init(); @@ -884,27 +939,27 @@ void retro_init(void) for (i = 0; i < sizeof(bios) / sizeof(bios[0]); i++) { snprintf(path, sizeof(path), "%s/%s.bin", dir, bios[i]); - f = fopen(path, "r"); - if (f != NULL) { - snprintf(Config.Bios, sizeof(Config.Bios), "%s.bin", bios[i]); + found_bios = try_use_bios(path); + if (found_bios) break; - } } + + if (!found_bios) + found_bios = find_any_bios(dir, path, sizeof(path)); } - if (f != NULL) { + if (found_bios) { SysPrintf("found BIOS file: %s\n", Config.Bios); - fclose(f); } else - { + { SysPrintf("no BIOS files found.\n"); - struct retro_message msg = - { - "no BIOS found, expect bugs!", - 180 - }; - environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE, (void*)&msg); - } + struct retro_message msg = + { + "no BIOS found, expect bugs!", + 180 + }; + environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE, (void*)&msg); + } level = 1; environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level); -- cgit v1.2.3 From 88901dd2de7982c765053ec47ef987efbc8ab89e Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 5 Jun 2013 00:58:22 +0300 Subject: psxmem: handle map failures so that it can be retried --- libpcsxcore/psxmem.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c index 4da0cf4..2ca5dd5 100644 --- a/libpcsxcore/psxmem.c +++ b/libpcsxcore/psxmem.c @@ -95,7 +95,8 @@ void psxUnmap(void *ptr, size_t size, enum psxMapTag tag) return; } - munmap(ptr, size); + if (ptr) + munmap(ptr, size); } s8 *psxM = NULL; // Kernel & User Memory (2 Meg) @@ -155,6 +156,7 @@ int psxMemInit() { if (psxMemRLUT == NULL || psxMemWLUT == NULL || psxR == NULL || psxP == NULL || psxH != (void *)0x1f800000) { SysMessage(_("Error allocating memory!")); + psxMemShutdown(); return -1; } @@ -208,12 +210,12 @@ void psxMemReset() { } void psxMemShutdown() { - psxUnmap(psxM, 0x00210000, MAP_TAG_RAM); - psxUnmap(psxH, 0x10000, MAP_TAG_OTHER); - psxUnmap(psxR, 0x80000, MAP_TAG_OTHER); + psxUnmap(psxM, 0x00210000, MAP_TAG_RAM); psxM = NULL; + psxUnmap(psxH, 0x10000, MAP_TAG_OTHER); psxH = NULL; + psxUnmap(psxR, 0x80000, MAP_TAG_OTHER); psxR = NULL; - free(psxMemRLUT); - free(psxMemWLUT); + free(psxMemRLUT); psxMemRLUT = NULL; + free(psxMemWLUT); psxMemWLUT = NULL; } static int writeok = 1; -- cgit v1.2.3 From d848b60a3da875fca0b1f2ddf8a4ae9d487d685b Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 5 Jun 2013 01:39:46 +0300 Subject: drc: add a test to catch broken platforms early --- libpcsxcore/new_dynarec/new_dynarec.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c index 8437008..d8d8991 100644 --- a/libpcsxcore/new_dynarec/new_dynarec.c +++ b/libpcsxcore/new_dynarec/new_dynarec.c @@ -21,6 +21,7 @@ #include #include //include for uint64_t #include +#include #include #include "emu_if.h" //emulator interface @@ -8005,6 +8006,28 @@ void disassemble_inst(int i) static void disassemble_inst(int i) {} #endif // DISASM +#define DRC_TEST_VAL 0x74657374 + +static int new_dynarec_test(void) +{ + int (*testfunc)(void) = (void *)out; + int ret; + emit_movimm(DRC_TEST_VAL,0); // test + emit_jmpreg(14); + literal_pool(0); +#ifdef __arm__ + __clear_cache((void *)testfunc, out); +#endif + SysPrintf("testing if we can run recompiled code..\n"); + ret = testfunc(); + if (ret == DRC_TEST_VAL) + SysPrintf("test passed.\n"); + else + SysPrintf("test failed: %08x\n", ret); + out=(u_char *)BASE_ADDR; + return ret == DRC_TEST_VAL; +} + // clear the state completely, instead of just marking // things invalid like invalidate_all_pages() does void new_dynarec_clear_full() @@ -8039,17 +8062,19 @@ void new_dynarec_clear_full() void new_dynarec_init() { - printf("Init new dynarec\n"); + SysPrintf("Init new dynarec\n"); out=(u_char *)BASE_ADDR; #if BASE_ADDR_FIXED if (mmap (out, 1<