aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormeepingsnesroms2017-09-01 11:21:48 -0700
committerGitHub2017-09-01 11:21:48 -0700
commit6c5b8733e0b286d5a4b4d9b7899e4c17a92cd04a (patch)
tree924720c49ac10c9ab3c98e3d3e06c8f4a06bc33c
parent646a63e41c53e5c1c971a4e305d4627dcee43c5e (diff)
parent874706c9a527d43f1a737b772225c120da86c31e (diff)
downloadpcsx_rearmed-6c5b8733e0b286d5a4b4d9b7899e4c17a92cd04a.tar.gz
pcsx_rearmed-6c5b8733e0b286d5a4b4d9b7899e4c17a92cd04a.tar.bz2
pcsx_rearmed-6c5b8733e0b286d5a4b4d9b7899e4c17a92cd04a.zip
Merge pull request #2 from libretro/master
Update from master
-rw-r--r--.gitmodules6
-rw-r--r--Makefile.libretro2
-rw-r--r--frontend/libretro.c62
-rw-r--r--frontend/plugin_lib.h1
-rw-r--r--include/arm_features.h4
-rw-r--r--jni/Application.mk1
-rw-r--r--libpcsxcore/new_dynarec/arm/linkage_arm.S12
-rw-r--r--libpcsxcore/new_dynarec/new_dynarec.c2
-rw-r--r--plugins/dfsound/arm_utils.S10
-rw-r--r--plugins/gpu_neon/psx_gpu/psx_gpu.h1
-rw-r--r--plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S21
-rw-r--r--plugins/gpu_neon/psx_gpu_if.c14
-rw-r--r--plugins/gpulib/gpu.c1
-rw-r--r--plugins/gpulib/gpu.h1
14 files changed, 91 insertions, 47 deletions
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index f93599e..0000000
--- a/.gitmodules
+++ /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
diff --git a/Makefile.libretro b/Makefile.libretro
index 88a48f4..e28955b 100644
--- a/Makefile.libretro
+++ b/Makefile.libretro
@@ -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
diff --git a/frontend/libretro.c b/frontend/libretro.c
index 9a3f070..4527f86 100644
--- a/frontend/libretro.c
+++ b/frontend/libretro.c
@@ -39,6 +39,10 @@
#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);
diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h
index 83b2774..92e62e9 100644
--- a/frontend/plugin_lib.h
+++ b/frontend/plugin_lib.h
@@ -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;
diff --git a/include/arm_features.h b/include/arm_features.h
index f35e0b7..7c82ff3 100644
--- a/include/arm_features.h
+++ b/include/arm_features.h
@@ -73,4 +73,8 @@
#endif
+#if defined(__MACH__) || defined(__PIC__)
+#define TEXRELS_FORBIDDEN
+#endif
+
#endif /* __ARM_FEATURES_H__ */
diff --git a/jni/Application.mk b/jni/Application.mk
index f05229c..3e882e7 100644
--- a/jni/Application.mk
+++ b/jni/Application.mk
@@ -1 +1,2 @@
APP_ABI := armeabi armeabi-v7a
+APP_PLATFORM := android-9
diff --git a/libpcsxcore/new_dynarec/arm/linkage_arm.S b/libpcsxcore/new_dynarec/arm/linkage_arm.S
index b630142..269eb99 100644
--- a/libpcsxcore/new_dynarec/arm/linkage_arm.S
+++ b/libpcsxcore/new_dynarec/arm/linkage_arm.S
@@ -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:
diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c
index d2cd270..dfa17a7 100644
--- a/libpcsxcore/new_dynarec/new_dynarec.c
+++ b/libpcsxcore/new_dynarec/new_dynarec.c
@@ -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
diff --git a/plugins/dfsound/arm_utils.S b/plugins/dfsound/arm_utils.S
index eaeca51..8ac7c30 100644
--- a/plugins/dfsound/arm_utils.S
+++ b/plugins/dfsound/arm_utils.S
@@ -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
diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu.h b/plugins/gpu_neon/psx_gpu/psx_gpu.h
index 1eaa99a..1fa6b98 100644
--- a/plugins/gpu_neon/psx_gpu/psx_gpu.h
+++ b/plugins/gpu_neon/psx_gpu/psx_gpu.h
@@ -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)))
diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S b/plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S
index 110c868..7c820d2 100644
--- a/plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S
+++ b/plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S
@@ -194,26 +194,18 @@
.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]; \
@@ -222,13 +214,12 @@
#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
diff --git a/plugins/gpu_neon/psx_gpu_if.c b/plugins/gpu_neon/psx_gpu_if.c
index ad01761..788e3b4 100644
--- a/plugins/gpu_neon/psx_gpu_if.c
+++ b/plugins/gpu_neon/psx_gpu_if.c
@@ -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);
+ }
+
}
diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c
index 125bd89..9fc5f43 100644
--- a/plugins/gpulib/gpu.c
+++ b/plugins/gpulib/gpu.c
@@ -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;
diff --git a/plugins/gpulib/gpu.h b/plugins/gpulib/gpu.h
index d11f991..7e1d18b 100644
--- a/plugins/gpulib/gpu.h
+++ b/plugins/gpulib/gpu.h
@@ -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);