aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/platform/ps2/Gs2dScreen.cpp16
-rw-r--r--backends/platform/ps2/Gs2dScreen.h4
-rw-r--r--backends/platform/ps2/systemps2.cpp4
3 files changed, 16 insertions, 8 deletions
diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index c6318e73d0..f869779573 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -408,25 +408,33 @@ void Gs2dScreen::unlockScreen() {
SignalSema(g_DmacSema);
}
-void Gs2dScreen::setPalette(const uint32 *pal, uint8 start, uint16 num) {
+void Gs2dScreen::setPalette(const uint8 *pal, uint8 start, uint16 num) {
assert(start + num <= 256);
WaitSema(g_DmacSema);
for (uint16 cnt = 0; cnt < num; cnt++) {
uint16 dest = start + cnt;
dest = (dest & 0xE7) | ((dest & 0x8) << 1) | ((dest & 0x10) >> 1); // rearrange like the GS expects it
- _clut[dest] = pal[cnt] & 0xFFFFFF;
+
+ uint32 color = pal[0] | (pal[1] << 8) | (pal[2] << 16);
+ _clut[dest] = color;
+ pal += 3;
}
_clutChanged = true;
SignalSema(g_DmacSema);
}
-void Gs2dScreen::grabPalette(uint32 *pal, uint8 start, uint16 num) {
+void Gs2dScreen::grabPalette(uint8 *pal, uint8 start, uint16 num) {
assert(start + num <= 256);
for (uint16 cnt = 0; cnt < num; cnt++) {
uint16 src = start + cnt;
src = (src & 0xE7) | ((src & 0x8) << 1) | ((src & 0x10) >> 1);
- pal[cnt] = _clut[src];
+
+ uint32 color = _clut[src];
+ pal[0] = (color >> 0) & 0xFF;
+ pal[1] = (color >> 8) & 0xFF;
+ pal[2] = (color >> 16) & 0xFF;
+ pal += 3;
}
}
diff --git a/backends/platform/ps2/Gs2dScreen.h b/backends/platform/ps2/Gs2dScreen.h
index 81f47d5f4a..358e717cbe 100644
--- a/backends/platform/ps2/Gs2dScreen.h
+++ b/backends/platform/ps2/Gs2dScreen.h
@@ -65,9 +65,9 @@ public:
void unlockScreen();
void copyScreenRect(const uint8 *buf, int pitch, int x, int y, int w, int h);
- void setPalette(const uint32 *pal, uint8 start, uint16 num);
+ void setPalette(const uint8 *pal, uint8 start, uint16 num);
void updateScreen(void);
- void grabPalette(uint32 *pal, uint8 start, uint16 num);
+ void grabPalette(uint8 *pal, uint8 start, uint16 num);
void grabScreen(Graphics::Surface *surf);
//- overlay routines
void copyOverlayRect(const uint16 *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h);
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index ab7839e18f..77de74eb5b 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -544,11 +544,11 @@ void OSystem_PS2::initSize(uint width, uint height, const Graphics::PixelFormat
}
void OSystem_PS2::setPalette(const byte *colors, uint start, uint num) {
- _screen->setPalette((const uint32*)colors, (uint8)start, (uint16)num);
+ _screen->setPalette(colors, (uint8)start, (uint16)num);
}
void OSystem_PS2::grabPalette(byte *colors, uint start, uint num) {
- _screen->grabPalette((uint32*)colors, (uint8)start, (uint16)num);
+ _screen->grabPalette(colors, (uint8)start, (uint16)num);
}
void OSystem_PS2::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {