aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorJohannes Schickel2011-02-16 00:02:48 +0100
committerJohannes Schickel2011-02-16 00:02:48 +0100
commita52b16ceb31eb1ae3b3005ab343011d0d9a25dbc (patch)
tree2c0e6199541b88313c52beab8ec71fe1361a030d /backends/platform
parentaafebe138921f3fc2c5595c7d63f95bdd0c9382b (diff)
downloadscummvm-rg350-a52b16ceb31eb1ae3b3005ab343011d0d9a25dbc.tar.gz
scummvm-rg350-a52b16ceb31eb1ae3b3005ab343011d0d9a25dbc.tar.bz2
scummvm-rg350-a52b16ceb31eb1ae3b3005ab343011d0d9a25dbc.zip
N64: Adapt to setPalette/grabPalette RGBA->RGB change.
This change is not tested, but should hopefully work fine.
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/n64/osys_n64.h2
-rw-r--r--backends/platform/n64/osys_n64_base.cpp18
2 files changed, 10 insertions, 10 deletions
diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index 5264a8a82e..47761095b0 100644
--- a/backends/platform/n64/osys_n64.h
+++ b/backends/platform/n64/osys_n64.h
@@ -93,7 +93,7 @@ protected:
uint16 *_screenPalette; // Array for palette entries (256 colors max)
#ifndef N64_EXTREME_MEMORY_SAVING
- uint32 *_screenExactPalette; // Array for palette entries, as received by setPalette(), no precision loss
+ uint8 *_screenExactPalette; // Array for palette entries, as received by setPalette(), no precision loss
#endif
uint16 _cursorPalette[256]; // Palette entries for the cursor
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index 1b9c704225..54eab0fd52 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -113,8 +113,8 @@ OSystem_N64::OSystem_N64() {
// Clear palette array
_screenPalette = (uint16*)memalign(8, 256 * sizeof(uint16));
#ifndef N64_EXTREME_MEMORY_SAVING
- _screenExactPalette = (uint32*)memalign(8, 256 * sizeof(uint32));
- memset(_screenExactPalette, 0, 256 * sizeof(uint32));
+ _screenExactPalette = (uint8*)memalign(8, 256 * 3);
+ memset(_screenExactPalette, 0, 256 * 3);
#endif
memset(_screenPalette, 0, 256 * sizeof(uint16));
memset(_cursorPalette, 0, 256 * sizeof(uint16));
@@ -350,12 +350,13 @@ int16 OSystem_N64::getWidth() {
}
void OSystem_N64::setPalette(const byte *colors, uint start, uint num) {
- for (uint i = 0; i < num; ++i) {
- _screenPalette[start + i] = colRGB888toBGR555(colors[2], colors[1], colors[0]);
#ifndef N64_EXTREME_MEMORY_SAVING
- _screenExactPalette[start + i] = *((uint32*)(colors));
+ memcpy(_screenExactPalette + start * 3, colors, num * 3);
#endif
- colors += 4;
+
+ for (uint i = 0; i < num; ++i) {
+ _screenPalette[start + i] = colRGB888toBGR555(colors[2], colors[1], colors[0]);
+ colors += 3;
}
// If cursor uses the game palette, we need to rebuild the hicolor buffer
@@ -413,10 +414,9 @@ void OSystem_N64::grabPalette(byte *colors, uint start, uint num) {
*colors++ = ((color & 0x1F) << 3);
*colors++ = (((color >> 5) & 0x1F) << 3);
*colors++ = (((color >> 10) & 0x1F) << 3);
- *colors++ = 0;
}
#else
- memcpy(colors, (uint8*)(_screenExactPalette + start), num * 4);
+ memcpy(colors, _screenExactPalette + start * 3, num * 3);
#endif
return;
@@ -425,7 +425,7 @@ void OSystem_N64::grabPalette(byte *colors, uint start, uint num) {
void OSystem_N64::setCursorPalette(const byte *colors, uint start, uint num) {
for (uint i = 0; i < num; ++i) {
_cursorPalette[start + i] = colRGB888toBGR555(colors[2], colors[1], colors[0]);
- colors += 4;
+ colors += 3;
}
_cursorPaletteDisabled = false;