Merge pull request #2 from libretro/master
authormeepingsnesroms <guicrith@gmail.com>
Fri, 1 Sep 2017 18:21:48 +0000 (11:21 -0700)
committerGitHub <noreply@github.com>
Fri, 1 Sep 2017 18:21:48 +0000 (11:21 -0700)
Update from master

14 files changed:
.gitmodules [deleted file]
Makefile.libretro
frontend/libretro.c
frontend/plugin_lib.h
include/arm_features.h
jni/Application.mk
libpcsxcore/new_dynarec/arm/linkage_arm.S
libpcsxcore/new_dynarec/new_dynarec.c
plugins/dfsound/arm_utils.S
plugins/gpu_neon/psx_gpu/psx_gpu.h
plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S
plugins/gpu_neon/psx_gpu_if.c
plugins/gpulib/gpu.c
plugins/gpulib/gpu.h

diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644 (file)
index f93599e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-[submodule "libpicofe"]
-       path = frontend/libpicofe
-       url = git://notaz.gp2x.de/~notaz/libpicofe.git
-[submodule "warm"]
-       path = frontend/warm
-       url = git://notaz.gp2x.de/~notaz/warm.git
index 88a48f4..e28955b 100644 (file)
@@ -155,7 +155,7 @@ else ifeq ($(platform), ctr)
 #      CFLAGS += -DPCSX
 #      BUILTIN_GPU = unai
        USE_DYNAREC = 1
-       DRC_CACHE_BASE = 1
+       DRC_CACHE_BASE = 0
        ARCH = arm
        HAVE_NEON = 0
 
index 9a3f070..4527f86 100644 (file)
 
 #define PORTS_NUMBER 8
 
+#ifndef MIN
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
 #define ISHEXDEC ((buf[cursor]>='0') && (buf[cursor]<='9')) || ((buf[cursor]>='a') && (buf[cursor]<='f')) || ((buf[cursor]>='A') && (buf[cursor]<='F'))
 
 //hack to prevent retroarch freezing when reseting in the menu but not while running with the hot key
@@ -399,8 +403,11 @@ void pl_timing_prepare(int is_pal)
 
 void plat_trigger_vibrate(int pad, int low, int high)
 {
-    rumble.set_rumble_state(pad, RETRO_RUMBLE_STRONG, high << 8);
-    rumble.set_rumble_state(pad, RETRO_RUMBLE_WEAK, low ? 0xffff : 0x0);
+       if(in_enable_vibration)
+       {
+       rumble.set_rumble_state(pad, RETRO_RUMBLE_STRONG, high << 8);
+       rumble.set_rumble_state(pad, RETRO_RUMBLE_WEAK, low ? 0xffff : 0x0);
+    }
 }
 
 void pl_update_gun(int *xn, int *yn, int *xres, int *yres, int *in)
@@ -439,6 +446,8 @@ void retro_set_environment(retro_environment_t cb)
       { "pcsx_rearmed_pad8type", "Pad 8 Type; default|none|standard|analog|negcon" },
       { "pcsx_rearmed_multitap1", "Multitap 1; auto|disabled|enabled" },
       { "pcsx_rearmed_multitap2", "Multitap 2; auto|disabled|enabled" },
+      { "pcsx_rearmed_vibration", "Enable Vibration; enabled|disabled" },
+      { "pcsx_rearmed_dithering", "Enable Dithering; enabled|disabled" },
 #ifndef DRC_DISABLE
       { "pcsx_rearmed_drc", "Dynamic recompiler; enabled|disabled" },
 #endif
@@ -1339,6 +1348,38 @@ static void update_variables(bool in_flight)
 
    update_multitap();
 
+   var.value = NULL;
+   var.key = "pcsx_rearmed_vibration";
+
+   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value)
+   {
+      if (strcmp(var.value, "disabled") == 0)
+         in_enable_vibration = 0;
+      else if (strcmp(var.value, "enabled") == 0)
+         in_enable_vibration = 1;
+   }
+
+   var.value = NULL;
+   var.key = "pcsx_rearmed_dithering";
+
+   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value)
+   {
+      if (strcmp(var.value, "disabled") == 0) {
+         pl_rearmed_cbs.gpu_peops.iUseDither = 0;
+         pl_rearmed_cbs.gpu_peopsgl.bDrawDither = 0;
+#ifdef __ARM_NEON__
+         pl_rearmed_cbs.gpu_neon.allow_dithering = 0;
+#endif
+      }
+      else if (strcmp(var.value, "enabled") == 0) {
+         pl_rearmed_cbs.gpu_peops.iUseDither = 1;
+         pl_rearmed_cbs.gpu_peopsgl.bDrawDither = 1;
+#ifdef __ARM_NEON__
+         pl_rearmed_cbs.gpu_neon.allow_dithering = 1;
+#endif
+      }
+   }
+
 #ifdef __ARM_NEON__
    var.value = "NULL";
    var.key = "pcsx_rearmed_neon_interlace_enable";
@@ -1487,11 +1528,6 @@ static void update_variables(bool in_flight)
    }
 }
 
-static int min(int a, int b)
-{
-    return a < b ? a : b;
-}
-
 void retro_run(void)
 {
     int i;
@@ -1522,10 +1558,10 @@ void retro_run(void)
 
                if (in_type[i] == PSE_PAD_TYPE_ANALOGPAD)
                {
-                       in_analog_left[i][0] = min((input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X) / 255) + 128, 255);
-                       in_analog_left[i][1] = min((input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y) / 255) + 128, 255);
-                       in_analog_right[i][0] = min((input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) / 255) + 128, 255);
-                       in_analog_right[i][1] = min((input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) / 255) + 128, 255);
+                       in_analog_left[i][0] = MIN((input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X) / 255) + 128, 255);
+                       in_analog_left[i][1] = MIN((input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y) / 255) + 128, 255);
+                       in_analog_right[i][0] = MIN((input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) / 255) + 128, 255);
+                       in_analog_right[i][1] = MIN((input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) / 255) + 128, 255);
                }
        }
 
@@ -1599,7 +1635,7 @@ static void check_system_specs(void)
 
 void retro_init(void)
 {
-       const char *bios[] = { "scph1001", "scph5501", "scph7001" };
+       const char *bios[] = { "SCPH101", "SCPH7001", "SCPH5501", "SCPH1001" };
        const char *dir;
        char path[256];
        int i, ret;
@@ -1666,7 +1702,7 @@ void retro_init(void)
                SysPrintf("no BIOS files found.\n");
                struct retro_message msg =
                {
-                       "no BIOS found, expect bugs!",
+                       "No PlayStation BIOS file found - add for better compatibility",
                        180
                };
                environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE, (void*)&msg);
index 83b2774..92e62e9 100644 (file)
@@ -71,6 +71,7 @@ struct rearmed_cbs {
                int   allow_interlace; // 0 off, 1 on, 2 guess
                int   enhancement_enable;
                int   enhancement_no_main;
+               int   allow_dithering;
        } gpu_neon;
        struct {
                int   iUseDither;
index f35e0b7..7c82ff3 100644 (file)
@@ -73,4 +73,8 @@
 
 #endif
 
+#if defined(__MACH__) || defined(__PIC__)
+#define TEXRELS_FORBIDDEN
+#endif
+
 #endif /* __ARM_FEATURES_H__ */
index f05229c..3e882e7 100644 (file)
@@ -1 +1,2 @@
 APP_ABI := armeabi armeabi-v7a
+APP_PLATFORM := android-9
index b630142..269eb99 100644 (file)
@@ -93,7 +93,7 @@ DRC_VAR(restore_candidate, 512)
 DRC_VAR(FCR0, 4)
 DRC_VAR(FCR31, 4)
 
-#ifdef __MACH__
+#ifdef TEXRELS_FORBIDDEN
        .data
        .align 2
 ptr_jump_in:
@@ -117,21 +117,21 @@ ptr_hash_table:
 #endif
 
 .macro load_varadr reg var
-#if defined(HAVE_ARMV7) && !defined(__PIC__)
-       movw    \reg, #:lower16:\var
-       movt    \reg, #:upper16:\var
-#elif defined(HAVE_ARMV7) && defined(__MACH__)
+#if defined(HAVE_ARMV7) && defined(TEXRELS_FORBIDDEN)
        movw    \reg, #:lower16:(\var-(1678f+8))
        movt    \reg, #:upper16:(\var-(1678f+8))
 1678:
        add     \reg, pc
+#elif defined(HAVE_ARMV7) && !defined(__PIC__)
+       movw    \reg, #:lower16:\var
+       movt    \reg, #:upper16:\var
 #else
        ldr     \reg, =\var
 #endif
 .endm
 
 .macro load_varadr_ext reg var
-#if defined(HAVE_ARMV7) && defined(__MACH__) && defined(__PIC__)
+#if defined(HAVE_ARMV7) && defined(TEXRELS_FORBIDDEN)
        movw    \reg, #:lower16:(ptr_\var-(1678f+8))
        movt    \reg, #:upper16:(ptr_\var-(1678f+8))
 1678:
index d2cd270..dfa17a7 100644 (file)
@@ -7123,7 +7123,7 @@ void new_dynarec_init(void)
 #else
 #ifndef NO_WRITE_EXEC
   // not all systems allow execute in data segment by default
-  if (mprotect((void*)BASE_ADDR, 1<<TARGET_SIZE_2, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
+  if (mprotect((void *)BASE_ADDR, 1<<TARGET_SIZE_2, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
     SysPrintf("mprotect() failed: %s\n", strerror(errno));
 #endif
 #endif
index eaeca51..8ac7c30 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "arm_features.h"
 
-#ifdef __MACH__
+#ifdef TEXRELS_FORBIDDEN
 .data
 .align 2
 ptr_ChanBuf:   .word ESYM(ChanBuf)
@@ -20,14 +20,14 @@ ptr_ChanBuf:   .word ESYM(ChanBuf)
 .align 2
 
 .macro load_varadr reg var
-#if defined(HAVE_ARMV7) && !defined(__PIC__)
-       movw    \reg, #:lower16:ESYM(\var)
-       movt    \reg, #:upper16:ESYM(\var)
-#elif defined(HAVE_ARMV7) && defined(__MACH__)
+#if defined(HAVE_ARMV7) && defined(TEXRELS_FORBIDDEN)
        movw    \reg, #:lower16:(ptr_\var-(1678f+8))
        movt    \reg, #:upper16:(ptr_\var-(1678f+8))
 1678:
        ldr     \reg, [pc, \reg]
+#elif defined(HAVE_ARMV7) && !defined(__PIC__)
+       movw    \reg, #:lower16:ESYM(\var)
+       movt    \reg, #:upper16:ESYM(\var)
 #else
        ldr     \reg, =ESYM(\var)
 #endif
index 1eaa99a..1fa6b98 100644 (file)
@@ -207,6 +207,7 @@ typedef struct
   u8 texture_4bpp_cache[32][256 * 256];
   u8 texture_8bpp_even_cache[16][256 * 256];
   u8 texture_8bpp_odd_cache[16][256 * 256];
+  int use_dithering;
 } psx_gpu_struct;
 
 typedef struct __attribute__((aligned(16)))
index 110c868..7c820d2 100644 (file)
 
 .align 4
 
-#ifndef __MACH__
+#include "arm_features.h"
 
-#define function(name)                                                         \
-  .global name;                                                                \
-  .type name, %function;                                                       \
-  name:                                                                        \
+#define function(name) FUNCTION(name):
+
+#ifndef TEXRELS_FORBIDDEN
 
 #define JT_OP_REL(table_label, index_reg, temp)
 #define JT_OP(x...) x
 #define JTE(start, target) target
 
-#define EXTRA_UNSAVED_REGS
-
 #else
 
-#define function(name)                                                         \
-  .globl _##name;                                                              \
-  name:                                                                        \
-  _##name:                                                                     \
-
 #define JT_OP_REL(table_label, index_reg, temp)                                \
   adr temp, table_label;                                                       \
   ldr temp, [temp, index_reg, lsl #2];                                         \
 #define JT_OP(x...)
 #define JTE(start, target) (target - start)
 
-// r7 is preserved, but add it for EABI alignment..
-#define EXTRA_UNSAVED_REGS r7, r9,
+#endif
 
+#ifdef __MACH__
 #define flush_render_block_buffer _flush_render_block_buffer
 #define setup_sprite_untextured_simple _setup_sprite_untextured_simple
 #define update_texture_8bpp_cache _update_texture_8bpp_cache
-
 #endif
 
 @ r0: psx_gpu
index ad01761..788e3b4 100644 (file)
@@ -184,4 +184,18 @@ void renderer_set_config(const struct rearmed_cbs *cbs)
     map_enhancement_buffer();
   if (cbs->pl_set_gpu_caps)
     cbs->pl_set_gpu_caps(GPU_CAP_SUPPORTS_2X);
+  
+  egpu.use_dithering = cbs->gpu_neon.allow_dithering;
+  if(!egpu.use_dithering) {
+    egpu.dither_table[0] = dither_table_row(0, 0, 0, 0);
+    egpu.dither_table[1] = dither_table_row(0, 0, 0, 0);
+    egpu.dither_table[2] = dither_table_row(0, 0, 0, 0);
+    egpu.dither_table[3] = dither_table_row(0, 0, 0, 0);
+  } else {
+    egpu.dither_table[0] = dither_table_row(-4, 0, -3, 1);
+    egpu.dither_table[1] = dither_table_row(2, -2, 3, -1);
+    egpu.dither_table[2] = dither_table_row(-3, 1, -4, 0);
+    egpu.dither_table[3] = dither_table_row(3, -1, 2, -2); 
+  }
+
 }
index 125bd89..9fc5f43 100644 (file)
@@ -726,6 +726,7 @@ void GPUrearmedCallbacks(const struct rearmed_cbs *cbs)
   gpu.state.allow_interlace = cbs->gpu_neon.allow_interlace;
   gpu.state.enhancement_enable = cbs->gpu_neon.enhancement_enable;
 
+  gpu.useDithering = cbs->gpu_neon.allow_dithering;
   gpu.mmap = cbs->mmap;
   gpu.munmap = cbs->munmap;
 
index d11f991..7e1d18b 100644 (file)
@@ -88,6 +88,7 @@ struct psx_gpu {
     uint32_t last_flip_frame;
     uint32_t pending_fill[3];
   } frameskip;
+  int useDithering:1; /* 0 - off , 1 - on */
   uint16_t *(*get_enhancement_bufer)
     (int *x, int *y, int *w, int *h, int *vram_h);
   void *(*mmap)(unsigned int size);