Modified the palette setting code in the SDL and X11 setup code to use

the entire 256 entry palette returned from the TIA instead of looking
at only the even numbered entries.  This was required since the PAL
color loss code uses all 256 entries in the palette.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@58 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
bwmott 2002-03-28 05:13:13 +00:00
parent c3aa637f8a
commit 3f9a204de1
2 changed files with 15 additions and 16 deletions

View File

@ -8,12 +8,12 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-1999 by Bradford W. Mott // Copyright (c) 1995-2002 by Bradford W. Mott
// //
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: mainSDL.cxx,v 1.15 2002-03-21 22:50:36 stephena Exp $ // $Id: mainSDL.cxx,v 1.16 2002-03-28 05:13:13 bwmott Exp $
//============================================================================ //============================================================================
#include <fstream> #include <fstream>
@ -362,7 +362,7 @@ void recalculate8BitPalette()
// Map 2600 colors to the current screen // Map 2600 colors to the current screen
const uInt32* gamePalette = theConsole->mediaSource().palette(); const uInt32* gamePalette = theConsole->mediaSource().palette();
SDL_Color colors[256]; SDL_Color colors[256];
for(uInt32 i = 0; i < 256; i += 2) for(uInt32 i = 0; i < 256; ++i)
{ {
Uint8 r, g, b; Uint8 r, g, b;
@ -370,15 +370,15 @@ void recalculate8BitPalette()
g = (Uint8) ((gamePalette[i] & 0x0000ff00) >> 8); g = (Uint8) ((gamePalette[i] & 0x0000ff00) >> 8);
b = (Uint8) (gamePalette[i] & 0x000000ff); b = (Uint8) (gamePalette[i] & 0x000000ff);
colors[i].r = colors[i+1].r = r; colors[i].r = r;
colors[i].g = colors[i+1].g = g; colors[i].g = g;
colors[i].b = colors[i+1].b = b; colors[i].b = b;
} }
SDL_SetColors(screen, colors, 0, 256); SDL_SetColors(screen, colors, 0, 256);
// Now see which colors we actually got // Now see which colors we actually got
SDL_PixelFormat* format = screen->format; SDL_PixelFormat* format = screen->format;
for(uInt32 i = 0; i < 256; i += 2) for(uInt32 i = 0; i < 256; ++i)
{ {
Uint8 r, g, b; Uint8 r, g, b;
@ -386,7 +386,7 @@ void recalculate8BitPalette()
g = format->palette->colors[i].g; g = format->palette->colors[i].g;
b = format->palette->colors[i].b; b = format->palette->colors[i].b;
palette[i] = palette[i+1] = SDL_MapRGB(format, r, g, b); palette[i] = SDL_MapRGB(format, r, g, b);
} }
} }
@ -400,7 +400,7 @@ void setupPalette()
return; return;
const uInt32* gamePalette = theConsole->mediaSource().palette(); const uInt32* gamePalette = theConsole->mediaSource().palette();
for(uInt32 i = 0; i < 256; i += 2) for(uInt32 i = 0; i < 256; ++i)
{ {
Uint8 r, g, b; Uint8 r, g, b;
@ -411,16 +411,16 @@ void setupPalette()
switch(bpp) switch(bpp)
{ {
case 15: case 15:
palette[i] = palette[i+1] = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3); palette[i] = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);
break; break;
case 16: case 16:
palette[i] = palette[i+1] = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); palette[i] = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
break; break;
case 24: case 24:
case 32: case 32:
palette[i] = palette[i+1] = (r << 16) | (g << 8) | b; palette[i] = (r << 16) | (g << 8) | b;
break; break;
} }
} }

View File

@ -8,12 +8,12 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-1999 by Bradford W. Mott // Copyright (c) 1995-2002 by Bradford W. Mott
// //
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: mainX11.cxx,v 1.16 2002-03-21 22:50:36 stephena Exp $ // $Id: mainX11.cxx,v 1.17 2002-03-28 05:13:13 bwmott Exp $
//============================================================================ //============================================================================
#include <fstream> #include <fstream>
@ -285,7 +285,7 @@ bool setupDisplay()
// Allocate colors in the default colormap // Allocate colors in the default colormap
const uInt32* palette = theConsole->mediaSource().palette(); const uInt32* palette = theConsole->mediaSource().palette();
for(uInt32 t = 0; t < 256; t += 2) for(uInt32 t = 0; t < 256; ++t)
{ {
XColor color; XColor color;
@ -302,7 +302,6 @@ bool setupDisplay()
XGCValues values; XGCValues values;
values.foreground = color.pixel; values.foreground = color.pixel;
theGCTable[t] = XCreateGC(theDisplay, theWindow, GCForeground, &values); theGCTable[t] = XCreateGC(theDisplay, theWindow, GCForeground, &values);
theGCTable[t + 1] = theGCTable[t];
} }
// Set up the delete window stuff ... // Set up the delete window stuff ...