aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjdgleaver2020-10-15 17:00:00 +0100
committerjdgleaver2020-10-15 17:00:00 +0100
commit23294848d036e19ca45b8b511d343c95b9f914e6 (patch)
tree976ef8cf2b58958ad4888f97fa736916d6064386
parent8c24c86a49b23086941814e3ae1d58a2993dac7a (diff)
downloadsnes9x2005-23294848d036e19ca45b8b511d343c95b9f914e6.tar.gz
snes9x2005-23294848d036e19ca45b8b511d343c95b9f914e6.tar.bz2
snes9x2005-23294848d036e19ca45b8b511d343c95b9f914e6.zip
Add 'USE_OLD_COLOUR_OPS' flag + PSP ifdef guards
-rw-r--r--Makefile2
-rw-r--r--Makefile.common4
-rw-r--r--source/gfx.c8
-rw-r--r--source/gfx.h12
-rw-r--r--source/pixform.h4
5 files changed, 20 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index a819a14..0ff0410 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@ PERF_TEST = 0
LOAD_FROM_MEMORY_TEST = 1
USE_BLARGG_APU = 0
LAGFIX = 1
+USE_OLD_COLOUR_OPS = 0
SPACE :=
SPACE := $(SPACE) $(SPACE)
@@ -205,6 +206,7 @@ else ifeq ($(platform), psp1)
-fno-builtin -fno-exceptions -ffunction-sections
DEFS += -DPSP -D_PSP_FW_VERSION=371
STATIC_LINKING := 1
+ USE_OLD_COLOUR_OPS = 1
# Vita
else ifeq ($(platform), vita)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
diff --git a/Makefile.common b/Makefile.common
index 48256bb..adc3ef8 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -50,4 +50,8 @@ ifeq ($(LOAD_FROM_MEMORY_TEST),1)
FLAGS += -DLOAD_FROM_MEMORY_TEST
endif
+ifeq ($(USE_OLD_COLOUR_OPS),1)
+ FLAGS += -DUSE_OLD_COLOUR_OPS
+endif
+
FLAGS += $(DEFS) $(WARNINGS) $(INCFLAGS)
diff --git a/source/gfx.c b/source/gfx.c
index e648259..85b58f3 100644
--- a/source/gfx.c
+++ b/source/gfx.c
@@ -226,8 +226,8 @@ bool S9xInitGFX(void)
GFX.PPLx2 = GFX.Pitch;
S9xFixColourBrightness();
-#if defined(PSP)
- /* PSP uses pre-1.60 colour operations */
+#if defined(USE_OLD_COLOUR_OPS)
+ /* Pre-1.60 colour operations */
if (!(GFX.X2 = (uint16_t*) malloc(sizeof(uint16_t) * 0x10000)))
return false;
@@ -343,8 +343,8 @@ bool S9xInitGFX(void)
void S9xDeinitGFX(void)
{
/* Free any memory allocated in S9xInitGFX */
-#if defined(PSP)
- /* PSP uses pre-1.60 colour operations */
+#if defined(USE_OLD_COLOUR_OPS)
+ /* Pre-1.60 colour operations */
if (GFX.X2)
{
free(GFX.X2);
diff --git a/source/gfx.h b/source/gfx.h
index 096ea98..2a5c6f9 100644
--- a/source/gfx.h
+++ b/source/gfx.h
@@ -33,8 +33,8 @@ typedef struct
uint32_t Pitch;
int32_t Delta;
-#if defined(PSP)
- /* PSP uses pre-1.60 colour operations */
+#if defined(USE_OLD_COLOUR_OPS)
+ /* Pre-1.60 colour operations */
uint16_t* X2;
uint16_t* ZERO_OR_X2;
#endif
@@ -151,8 +151,8 @@ extern uint8_t mul_brightness [16][32];
static INLINE uint16_t COLOR_ADD(uint16_t C1, uint16_t C2)
{
-#if defined(PSP)
- /* PSP uses pre-1.60 colour operations */
+#if defined(USE_OLD_COLOUR_OPS)
+ /* Pre-1.60 colour operations */
if (C1 == 0)
return C2;
else if (C2 == 0)
@@ -183,8 +183,8 @@ static INLINE uint16_t COLOR_ADD(uint16_t C1, uint16_t C2)
((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1) + \
(((C1) & (C2) & RGB_LOW_BITS_MASK) | ALPHA_BITS_MASK))
-#if defined(PSP)
-/* PSP uses pre-1.60 colour operations */
+#if defined(USE_OLD_COLOUR_OPS)
+/* Pre-1.60 colour operations */
#define COLOR_SUB(C1, C2) \
(GFX.ZERO_OR_X2 [(((C1) | RGB_HI_BITS_MASKx2) - \
((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1] + \
diff --git a/source/pixform.h b/source/pixform.h
index 46587aa..57b9732 100644
--- a/source/pixform.h
+++ b/source/pixform.h
@@ -84,8 +84,10 @@
#define MAX_RED_D(F) CONCAT(MAX_RED_,F)
#define MAX_BLUE_D(F) CONCAT(MAX_BLUE_,F)
#define MAX_GREEN_D(F) CONCAT(MAX_GREEN_,F)
+#if !defined(PSP)
#define RED_SHIFT_BITS_D(F) CONCAT(RED_SHIFT_BITS_, F)
#define GREEN_SHIFT_BITS_D(F) CONCAT(GREEN_SHIFT_BITS_, F)
+#endif
#define RED_LOW_BIT_MASK_D(F) CONCAT(RED_LOW_BIT_MASK_,F)
#define BLUE_LOW_BIT_MASK_D(F) CONCAT(BLUE_LOW_BIT_MASK_,F)
#define GREEN_LOW_BIT_MASK_D(F) CONCAT(GREEN_LOW_BIT_MASK_,F)
@@ -100,8 +102,10 @@
#define MAX_RED MAX_RED_D(PIXEL_FORMAT)
#define MAX_BLUE MAX_BLUE_D(PIXEL_FORMAT)
#define MAX_GREEN MAX_GREEN_D(PIXEL_FORMAT)
+#if !defined(PSP)
#define RED_SHIFT_BITS RED_SHIFT_BITS_D(PIXEL_FORMAT)
#define GREEN_SHIFT_BITS GREEN_SHIFT_BITS_D(PIXEL_FORMAT)
+#endif
#define RED_LOW_BIT_MASK RED_LOW_BIT_MASK_D(PIXEL_FORMAT)
#define BLUE_LOW_BIT_MASK BLUE_LOW_BIT_MASK_D(PIXEL_FORMAT)
#define GREEN_LOW_BIT_MASK GREEN_LOW_BIT_MASK_D(PIXEL_FORMAT)