summaryrefslogtreecommitdiff
path: root/src/gfx.c
diff options
context:
space:
mode:
authorjdgleaver2020-10-19 16:07:23 +0100
committerjdgleaver2020-10-19 16:07:23 +0100
commitaac31071fe29122c2a118c8ee50c7fca4e76a4f7 (patch)
tree200678a22fc96af9a40f7eb7cd735f5ca87f28aa /src/gfx.c
parent8b76b5301822d92545e8f62b07f774715b1a1e8b (diff)
downloadsnes9x2002-aac31071fe29122c2a118c8ee50c7fca4e76a4f7.tar.gz
snes9x2002-aac31071fe29122c2a118c8ee50c7fca4e76a4f7.tar.bz2
snes9x2002-aac31071fe29122c2a118c8ee50c7fca4e76a4f7.zip
Backport colour operations from Snes9x 1.60
Diffstat (limited to 'src/gfx.c')
-rw-r--r--src/gfx.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gfx.c b/src/gfx.c
index 3842d1d..fa12da8 100644
--- a/src/gfx.c
+++ b/src/gfx.c
@@ -362,6 +362,8 @@ bool8_32 S9xGraphicsInit(void)
DrawHiResClippedTilePtr = DrawHiResClippedTile16;
S9xFixColourBrightness();
+#if defined(USE_OLD_COLOUR_OPS)
+ /* Pre-1.60 colour operations */
if (!(GFX.X2 = (uint16*) malloc(sizeof(uint16) * 0x10000)))
return (FALSE);
@@ -476,6 +478,10 @@ bool8_32 S9xGraphicsInit(void)
}
}
#endif
+#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.
@@ -514,6 +520,8 @@ bool8_32 S9xGraphicsInit(void)
void S9xGraphicsDeinit(void)
{
// Free any memory allocated in S9xGraphicsInit
+#if defined(USE_OLD_COLOUR_OPS)
+ /* Pre-1.60 colour operations */
if (GFX.X2)
{
free((char*) GFX.X2);
@@ -524,6 +532,7 @@ void S9xGraphicsDeinit(void)
free((char*) GFX.ZERO_OR_X2);
GFX.ZERO_OR_X2 = NULL;
}
+#endif
if (GFX.ZERO)
{
free((char*) GFX.ZERO);