aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/n64
diff options
context:
space:
mode:
authorJohannes Schickel2011-02-19 21:42:34 +0100
committerJohannes Schickel2011-02-19 21:46:45 +0100
commite21d6e0d1120e917a4a019a4070ec4db5e988b9b (patch)
tree1142828b72ccf17d513c621e108d749f148fd32b /backends/platform/n64
parent32d0e4c15fb33f80db194087850466664a43516a (diff)
parentb26f30b98793c522265a3eeb48fb3b41034663c6 (diff)
downloadscummvm-rg350-e21d6e0d1120e917a4a019a4070ec4db5e988b9b.tar.gz
scummvm-rg350-e21d6e0d1120e917a4a019a4070ec4db5e988b9b.tar.bz2
scummvm-rg350-e21d6e0d1120e917a4a019a4070ec4db5e988b9b.zip
Merge branch 'osystem-palette' of https://github.com/lordhoto/scummvm into master
Conflicts: backends/platform/android/android.cpp engines/sci/graphics/screen.cpp engines/sci/graphics/transitions.cpp
Diffstat (limited to 'backends/platform/n64')
-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 e5ffc7f3bc..2daa41a9f6 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;