From 8c24c86a49b23086941814e3ae1d58a2993dac7a Mon Sep 17 00:00:00 2001 From: jdgleaver Date: Thu, 15 Oct 2020 14:37:46 +0100 Subject: Backports: Colour operations from Snes9x 1.60 + MIPS optimisations from PocketSNES --- source/gfx.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/gfx.c') diff --git a/source/gfx.c b/source/gfx.c index 00fb4d1..e648259 100644 --- a/source/gfx.c +++ b/source/gfx.c @@ -226,6 +226,8 @@ bool S9xInitGFX(void) GFX.PPLx2 = GFX.Pitch; S9xFixColourBrightness(); +#if defined(PSP) + /* PSP uses pre-1.60 colour operations */ if (!(GFX.X2 = (uint16_t*) malloc(sizeof(uint16_t) * 0x10000))) return false; @@ -300,6 +302,10 @@ bool S9xInitGFX(void) } } } +#else + if (!(GFX.ZERO = (uint16_t*) malloc(sizeof(uint16_t) * 0x10000))) + return false; +#endif /* Build a lookup table that if the top bit of the color value is zero * then the value is zero, otherwise its just the value. */ @@ -337,6 +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 (GFX.X2) { free(GFX.X2); @@ -347,6 +355,7 @@ void S9xDeinitGFX(void) free(GFX.ZERO_OR_X2); GFX.ZERO_OR_X2 = NULL; } +#endif if (GFX.ZERO) { free(GFX.ZERO); -- cgit v1.2.3 From 23294848d036e19ca45b8b511d343c95b9f914e6 Mon Sep 17 00:00:00 2001 From: jdgleaver Date: Thu, 15 Oct 2020 17:00:00 +0100 Subject: Add 'USE_OLD_COLOUR_OPS' flag + PSP ifdef guards --- source/gfx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/gfx.c') 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); -- cgit v1.2.3