aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-02-05 18:23:03 +0100
committerStapleButter <thetotalworm@gmail.com>2017-02-05 18:23:03 +0100
commit1001df49eae7b553c8c052af9f620eeb5708cac7 (patch)
tree97e86319f9031183dbf73fdb6155c1c089534139
parente88cf1b43d554e16ca8f5ba67c7737231c935f0e (diff)
support extended palette for 256-color sprites.
-rw-r--r--GPU2D.cpp14
-rw-r--r--melonDS.depend2
2 files changed, 13 insertions, 3 deletions
diff --git a/GPU2D.cpp b/GPU2D.cpp
index e456f79..8e59c0e 100644
--- a/GPU2D.cpp
+++ b/GPU2D.cpp
@@ -824,8 +824,18 @@ void GPU2D::DrawSprite_Normal(u16* attrib, u32 width, s32 xpos, u32 ypos, u32* d
pixels += (tilenum & 0x3FFF);
pixels += ((ypos & 0x7) << 3);
- u16* pal = (u16*)&GPU::Palette[Num ? 0x600 : 0x200];
- //pal += (attrib[2] & 0xF000) >> 8;
+ u32 extpal = (DispCnt & 0x80000000);
+
+ u16* pal;
+ if (extpal)
+ {
+ pal = (u16*)(Num ? GPU::VRAM_BOBJExtPal : GPU::VRAM_AOBJExtPal);
+ pal += (attrib[2] & 0xF000) >> 4;
+ }
+ else
+ pal = (u16*)&GPU::Palette[Num ? 0x600 : 0x200];
+
+ if (!pal) pal = (u16*)&GPU::Palette[Num ? 0x600 : 0x200]; // derp
if (attrib[1] & 0x1000) // xflip. TODO: do better? oh well for now this works
{
diff --git a/melonDS.depend b/melonDS.depend
index f7fbfb0..cecb4cb 100644
--- a/melonDS.depend
+++ b/melonDS.depend
@@ -137,7 +137,7 @@
1485980863 c:\documents\sources\melonds\ndscart.h
"types.h"
-1486312231 source:c:\documents\sources\melonds\ndscart.cpp
+1486313011 source:c:\documents\sources\melonds\ndscart.cpp
<stdio.h>
<string.h>
"NDS.h"