From f7b9687d8caa0e37aa4da90ba98c7b917ec4bb7b Mon Sep 17 00:00:00 2001 From: stephena Date: Tue, 26 Dec 2006 17:06:01 +0000 Subject: [PATCH] Tweaked cart autodetection code wrt '3E' bankswitching. Since a '3E' cart is almost always a '3F' cart as well, it makes sense to only test for it when we already know the cart is probably '3F'. As well, the pattern for a '3F' cart results in a lot less false-positives than '3E'. Added '-colorloss' commandline argument and 'Ctrl-l' key shortcut. This enables or disables the PAL color-loss effect, and will default to off (similar to z26 functionality). Still TODO is add a UI entry for it. Fixed a bug in the calculation of PAL color-loss values; it wasn't actually giving grayscale data, but something with a greenish tint. Updated PAL autodetection code to run for 60 test frames instead of 20, and ignore the first 30. This helps when loading SuperCharger games, since the BIOS code always runs at NTSC rates, even if the ROM really should be PAL. For now, this means it only works when 'fastscbios' is enabled, and the BIOS runs in 30 frames or less (vs. needing 250+ frames for normal speed!). I'm strongly leaning to just making 'fastscbios' a non-editable default. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1242 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/Cart.cxx | 32 +- stella/src/emucore/Console.cxx | 689 +++++++++++----------------- stella/src/emucore/Console.hxx | 47 +- stella/src/emucore/EventHandler.cxx | 6 +- stella/src/emucore/Settings.cxx | 4 +- 5 files changed, 319 insertions(+), 459 deletions(-) diff --git a/stella/src/emucore/Cart.cxx b/stella/src/emucore/Cart.cxx index 6b0c1264a..5d37ca1e3 100644 --- a/stella/src/emucore/Cart.cxx +++ b/stella/src/emucore/Cart.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Cart.cxx,v 1.24 2006-12-26 00:39:43 stephena Exp $ +// $Id: Cart.cxx,v 1.25 2006-12-26 17:06:00 stephena Exp $ //============================================================================ #include @@ -162,10 +162,8 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size) type = "4K"; else if(isProbablyE0(image, size)) type = "E0"; - else if(isProbably3E(image, size)) - type = "3E"; else if(isProbably3F(image, size)) - type = "3F"; + type = isProbably3E(image, size) ? "3E" : "3F"; else type = "F8"; } @@ -187,10 +185,8 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size) type = "F6SC"; else if(isProbablyE7(image, size)) type = "E7"; - else if(isProbably3E(image, size)) - type = "3E"; else if(isProbably3F(image, size)) - type = "3F"; + type = isProbably3E(image, size) ? "3E" : "3F"; else type = "F6"; } @@ -198,39 +194,31 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size) { if(isProbablySC(image, size)) type = "F4SC"; - else if(isProbably3E(image, size)) - type = "3E"; else if(isProbably3F(image, size)) - type = "3F"; + type = isProbably3E(image, size) ? "3E" : "3F"; else type = "F4"; } else if(size == 65536) // 64K { // TODO - autodetect 4A50 - if(isProbably3E(image, size)) - type = "3E"; - else if(isProbably3F(image, size)) - type = "3F"; + if(isProbably3F(image, size)) + type = isProbably3E(image, size) ? "3E" : "3F"; else type = "MB"; } else if(size == 131072) // 128K { // TODO - autodetect 4A50 - if(isProbably3E(image, size)) - type = "3E"; - else if(isProbably3F(image, size)) - type = "3F"; + if(isProbably3F(image, size)) + type = isProbably3E(image, size) ? "3E" : "3F"; else type = "MC"; } else // what else can we do? { - if(isProbably3E(image, size)) - type = "3E"; - else if(isProbably3F(image, size)) - type = "3F"; + if(isProbably3F(image, size)) + type = isProbably3E(image, size) ? "3E" : "3F"; else type = "4K"; // Most common bankswitching type } diff --git a/stella/src/emucore/Console.cxx b/stella/src/emucore/Console.cxx index 13bb3f9ab..25d7205d1 100644 --- a/stella/src/emucore/Console.cxx +++ b/stella/src/emucore/Console.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Console.cxx,v 1.112 2006-12-26 02:09:29 stephena Exp $ +// $Id: Console.cxx,v 1.113 2006-12-26 17:06:01 stephena Exp $ //============================================================================ #include @@ -62,9 +62,7 @@ Console::Console(const uInt8* image, uInt32 size, const string& md5, OSystem* osystem) : myOSystem(osystem), myIsValidFlag(false), - myUserPaletteDefined(false), - ourUserNTSCPalette(NULL), - ourUserPALPalette(NULL) + myUserPaletteDefined(false) { Cartridge* cartridge = (Cartridge*) NULL; ostringstream buf; @@ -84,8 +82,10 @@ Console::Console(const uInt8* image, uInt32 size, const string& md5, // A developer can override properties from the commandline setDeveloperProperties(); - // Load user-defined palette for this ROM + // Load user-defined palette for this ROM and initialize them + // depending on PAL colour-loss effect loadUserPalette(); + setColorLossPalette(myOSystem->settings().getBool("colorloss")); // Query some info about this console buf << " Cart Name: " << myProperties.get(Cartridge_Name) << endl @@ -214,16 +214,20 @@ Console::Console(const uInt8* image, uInt32 size, const string& md5, if(myDisplayFormat == "AUTO-DETECT" || myOSystem->settings().getBool("rominfo")) { - // Run the system for 20 frames, looking for PAL frames + // Run the system for 60 frames, looking for PAL scanline patterns + // We assume the first 30 frames are garbage, and only consider + // the second 30 (useful to get past SuperCharger BIOS) + // Unfortunately, this means we have to always enable 'fastscbios', + // since otherwise the BIOS loading will take over 250 frames! int palCount = 0; - for(int i = 0; i < 20; ++i) + for(int i = 0; i < 60; ++i) { myMediaSource->update(); - if(myMediaSource->scanlines() > 290) + if(i >= 30 && myMediaSource->scanlines() > 285) ++palCount; } - myDisplayFormat = (palCount >= 10) ? "PAL" : "NTSC"; + myDisplayFormat = (palCount >= 15) ? "PAL" : "NTSC"; if(myProperties.get(Display_Format) == "AUTO-DETECT") buf << " Auto-detected display format: " << myDisplayFormat << endl; } @@ -262,9 +266,6 @@ Console::~Console() delete mySwitches; delete myControllers[0]; delete myControllers[1]; - - delete[] ourUserNTSCPalette; - delete[] ourUserPALPalette; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -298,7 +299,6 @@ void Console::toggleFormat() myDisplayFormat = "NTSC"; myProperties.set(Display_Format, myDisplayFormat); mySystem->reset(); - initializeVideo(); myOSystem->frameBuffer().showMessage("NTSC Mode"); framerate = 60; } @@ -308,6 +308,19 @@ void Console::toggleFormat() myOSystem->sound().setFrameRate(framerate); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Console::toggleColorLoss() +{ + bool colorloss = !myOSystem->settings().getBool("colorloss"); + myOSystem->settings().setBool("colorloss", colorloss); + setColorLossPalette(colorloss); + setPalette(myOSystem->settings().getString("palette")); + + string message = string("PAL color-loss ") + + (colorloss ? "enabled" : "disabled"); + myOSystem->frameBuffer().showMessage(message); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Console::togglePalette() { @@ -709,26 +722,19 @@ void Console::loadUserPalette() } // Now that we have valid data, create the user-defined palettes - ourUserNTSCPalette = new uInt32[256]; - ourUserPALPalette = new uInt32[256]; uInt8 pixbuf[3]; // Temporary buffer for one 24-bit pixel for(int i = 0; i < 128; i++) // NTSC palette { in.read((char*)pixbuf, 3); uInt32 pixel = ((int)pixbuf[0] << 16) + ((int)pixbuf[1] << 8) + (int)pixbuf[2]; - ourUserNTSCPalette[(i<<1)] = ourUserNTSCPalette[(i<<1)+1] = pixel; + ourUserNTSCPalette[(i<<1)] = pixel; } for(int i = 0; i < 128; i++) // PAL palette { in.read((char*)pixbuf, 3); - uInt32 pixel1 = ((int)pixbuf[0] << 16) + ((int)pixbuf[1] << 8) + (int)pixbuf[2]; - int r = (int)((float)pixbuf[0] * 0.2989); - int g = (int)((float)pixbuf[1] * 0.5870); - int b = (int)((float)pixbuf[2] * 0.1140); - uInt32 pixel2 = (r << 16) + (g << 8) + b; - ourUserPALPalette[(i<<1)] = pixel1; - ourUserPALPalette[(i<<1)+1] = pixel2; // calculated colour-loss effect + uInt32 pixel = ((int)pixbuf[0] << 16) + ((int)pixbuf[1] << 8) + (int)pixbuf[2]; + ourUserPALPalette[(i<<1)] = pixel; } in.close(); @@ -736,413 +742,270 @@ void Console::loadUserPalette() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt32 Console::ourNTSCPalette[256] = { - 0x000000, 0x000000, 0x4a4a4a, 0x4a4a4a, - 0x6f6f6f, 0x6f6f6f, 0x8e8e8e, 0x8e8e8e, - 0xaaaaaa, 0xaaaaaa, 0xc0c0c0, 0xc0c0c0, - 0xd6d6d6, 0xd6d6d6, 0xececec, 0xececec, - 0x484800, 0x484800, 0x69690f, 0x69690f, - 0x86861d, 0x86861d, 0xa2a22a, 0xa2a22a, - 0xbbbb35, 0xbbbb35, 0xd2d240, 0xd2d240, - 0xe8e84a, 0xe8e84a, 0xfcfc54, 0xfcfc54, - 0x7c2c00, 0x7c2c00, 0x904811, 0x904811, - 0xa26221, 0xa26221, 0xb47a30, 0xb47a30, - 0xc3903d, 0xc3903d, 0xd2a44a, 0xd2a44a, - 0xdfb755, 0xdfb755, 0xecc860, 0xecc860, - 0x901c00, 0x901c00, 0xa33915, 0xa33915, - 0xb55328, 0xb55328, 0xc66c3a, 0xc66c3a, - 0xd5824a, 0xd5824a, 0xe39759, 0xe39759, - 0xf0aa67, 0xf0aa67, 0xfcbc74, 0xfcbc74, - 0x940000, 0x940000, 0xa71a1a, 0xa71a1a, - 0xb83232, 0xb83232, 0xc84848, 0xc84848, - 0xd65c5c, 0xd65c5c, 0xe46f6f, 0xe46f6f, - 0xf08080, 0xf08080, 0xfc9090, 0xfc9090, - 0x840064, 0x840064, 0x97197a, 0x97197a, - 0xa8308f, 0xa8308f, 0xb846a2, 0xb846a2, - 0xc659b3, 0xc659b3, 0xd46cc3, 0xd46cc3, - 0xe07cd2, 0xe07cd2, 0xec8ce0, 0xec8ce0, - 0x500084, 0x500084, 0x68199a, 0x68199a, - 0x7d30ad, 0x7d30ad, 0x9246c0, 0x9246c0, - 0xa459d0, 0xa459d0, 0xb56ce0, 0xb56ce0, - 0xc57cee, 0xc57cee, 0xd48cfc, 0xd48cfc, - 0x140090, 0x140090, 0x331aa3, 0x331aa3, - 0x4e32b5, 0x4e32b5, 0x6848c6, 0x6848c6, - 0x7f5cd5, 0x7f5cd5, 0x956fe3, 0x956fe3, - 0xa980f0, 0xa980f0, 0xbc90fc, 0xbc90fc, - 0x000094, 0x000094, 0x181aa7, 0x181aa7, - 0x2d32b8, 0x2d32b8, 0x4248c8, 0x4248c8, - 0x545cd6, 0x545cd6, 0x656fe4, 0x656fe4, - 0x7580f0, 0x7580f0, 0x8490fc, 0x8490fc, - 0x001c88, 0x001c88, 0x183b9d, 0x183b9d, - 0x2d57b0, 0x2d57b0, 0x4272c2, 0x4272c2, - 0x548ad2, 0x548ad2, 0x65a0e1, 0x65a0e1, - 0x75b5ef, 0x75b5ef, 0x84c8fc, 0x84c8fc, - 0x003064, 0x003064, 0x185080, 0x185080, - 0x2d6d98, 0x2d6d98, 0x4288b0, 0x4288b0, - 0x54a0c5, 0x54a0c5, 0x65b7d9, 0x65b7d9, - 0x75cceb, 0x75cceb, 0x84e0fc, 0x84e0fc, - 0x004030, 0x004030, 0x18624e, 0x18624e, - 0x2d8169, 0x2d8169, 0x429e82, 0x429e82, - 0x54b899, 0x54b899, 0x65d1ae, 0x65d1ae, - 0x75e7c2, 0x75e7c2, 0x84fcd4, 0x84fcd4, - 0x004400, 0x004400, 0x1a661a, 0x1a661a, - 0x328432, 0x328432, 0x48a048, 0x48a048, - 0x5cba5c, 0x5cba5c, 0x6fd26f, 0x6fd26f, - 0x80e880, 0x80e880, 0x90fc90, 0x90fc90, - 0x143c00, 0x143c00, 0x355f18, 0x355f18, - 0x527e2d, 0x527e2d, 0x6e9c42, 0x6e9c42, - 0x87b754, 0x87b754, 0x9ed065, 0x9ed065, - 0xb4e775, 0xb4e775, 0xc8fc84, 0xc8fc84, - 0x303800, 0x303800, 0x505916, 0x505916, - 0x6d762b, 0x6d762b, 0x88923e, 0x88923e, - 0xa0ab4f, 0xa0ab4f, 0xb7c25f, 0xb7c25f, - 0xccd86e, 0xccd86e, 0xe0ec7c, 0xe0ec7c, - 0x482c00, 0x482c00, 0x694d14, 0x694d14, - 0x866a26, 0x866a26, 0xa28638, 0xa28638, - 0xbb9f47, 0xbb9f47, 0xd2b656, 0xd2b656, - 0xe8cc63, 0xe8cc63, 0xfce070, 0xfce070 +void Console::setColorLossPalette(bool loss) +{ + // Look at all the palettes, since we don't know which one is + // currently active + uInt32* palette[8] = { + &ourNTSCPalette[0], &ourPALPalette[0], + &ourNTSCPalette11[0], &ourPALPalette11[0], + &ourNTSCPaletteZ26[0], &ourPALPaletteZ26[0], + 0, 0 + }; + if(myUserPaletteDefined) + { + palette[6] = &ourUserNTSCPalette[0]; + palette[7] = &ourUserPALPalette[0]; + } + + for(int i = 0; i < 8; ++i) + { + if(palette[i] == 0) + continue; + + // If color-loss is enabled, fill the odd numbered palette entries + // with grays values (calculated using the standard RGB -> grayscale + // conversion formula) + for(int j = 0; j < 128; ++j) + { + uInt32 pixel = palette[i][(j<<1)]; + if(loss) + { + uInt8 r = (pixel >> 16) & 0xff; + uInt8 g = (pixel >> 8) & 0xff; + uInt8 b = (pixel >> 0) & 0xff; + uInt8 sum = (uInt8) (((float)r * 0.2989) + + ((float)g * 0.5870) + + ((float)b * 0.1140)); + pixel = (sum << 16) + (sum << 8) + sum; + } + palette[i][(j<<1)+1] = pixel; + } + } +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt32 Console::ourNTSCPalette[256] = { + 0x000000, 0, 0x4a4a4a, 0, 0x6f6f6f, 0, 0x8e8e8e, 0, + 0xaaaaaa, 0, 0xc0c0c0, 0, 0xd6d6d6, 0, 0xececec, 0, + 0x484800, 0, 0x69690f, 0, 0x86861d, 0, 0xa2a22a, 0, + 0xbbbb35, 0, 0xd2d240, 0, 0xe8e84a, 0, 0xfcfc54, 0, + 0x7c2c00, 0, 0x904811, 0, 0xa26221, 0, 0xb47a30, 0, + 0xc3903d, 0, 0xd2a44a, 0, 0xdfb755, 0, 0xecc860, 0, + 0x901c00, 0, 0xa33915, 0, 0xb55328, 0, 0xc66c3a, 0, + 0xd5824a, 0, 0xe39759, 0, 0xf0aa67, 0, 0xfcbc74, 0, + 0x940000, 0, 0xa71a1a, 0, 0xb83232, 0, 0xc84848, 0, + 0xd65c5c, 0, 0xe46f6f, 0, 0xf08080, 0, 0xfc9090, 0, + 0x840064, 0, 0x97197a, 0, 0xa8308f, 0, 0xb846a2, 0, + 0xc659b3, 0, 0xd46cc3, 0, 0xe07cd2, 0, 0xec8ce0, 0, + 0x500084, 0, 0x68199a, 0, 0x7d30ad, 0, 0x9246c0, 0, + 0xa459d0, 0, 0xb56ce0, 0, 0xc57cee, 0, 0xd48cfc, 0, + 0x140090, 0, 0x331aa3, 0, 0x4e32b5, 0, 0x6848c6, 0, + 0x7f5cd5, 0, 0x956fe3, 0, 0xa980f0, 0, 0xbc90fc, 0, + 0x000094, 0, 0x181aa7, 0, 0x2d32b8, 0, 0x4248c8, 0, + 0x545cd6, 0, 0x656fe4, 0, 0x7580f0, 0, 0x8490fc, 0, + 0x001c88, 0, 0x183b9d, 0, 0x2d57b0, 0, 0x4272c2, 0, + 0x548ad2, 0, 0x65a0e1, 0, 0x75b5ef, 0, 0x84c8fc, 0, + 0x003064, 0, 0x185080, 0, 0x2d6d98, 0, 0x4288b0, 0, + 0x54a0c5, 0, 0x65b7d9, 0, 0x75cceb, 0, 0x84e0fc, 0, + 0x004030, 0, 0x18624e, 0, 0x2d8169, 0, 0x429e82, 0, + 0x54b899, 0, 0x65d1ae, 0, 0x75e7c2, 0, 0x84fcd4, 0, + 0x004400, 0, 0x1a661a, 0, 0x328432, 0, 0x48a048, 0, + 0x5cba5c, 0, 0x6fd26f, 0, 0x80e880, 0, 0x90fc90, 0, + 0x143c00, 0, 0x355f18, 0, 0x527e2d, 0, 0x6e9c42, 0, + 0x87b754, 0, 0x9ed065, 0, 0xb4e775, 0, 0xc8fc84, 0, + 0x303800, 0, 0x505916, 0, 0x6d762b, 0, 0x88923e, 0, + 0xa0ab4f, 0, 0xb7c25f, 0, 0xccd86e, 0, 0xe0ec7c, 0, + 0x482c00, 0, 0x694d14, 0, 0x866a26, 0, 0xa28638, 0, + 0xbb9f47, 0, 0xd2b656, 0, 0xe8cc63, 0, 0xfce070, 0 }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt32 Console::ourPALPalette[256] = { - 0x000000, 0x000000, 0x2b2b2b, 0x2a2a2a, - 0x525252, 0x515151, 0x767676, 0x757575, - 0x979797, 0x969696, 0xb6b6b6, 0xb5b5b5, - 0xd2d2d2, 0xd1d1d1, 0xececec, 0xebebeb, - 0x000000, 0x000000, 0x2b2b2b, 0x2a2a2a, - 0x525252, 0x515151, 0x767676, 0x757575, - 0x979797, 0x969696, 0xb6b6b6, 0xb5b5b5, - 0xd2d2d2, 0xd1d1d1, 0xececec, 0xebebeb, - 0x805800, 0x595959, 0x96711a, 0x727272, - 0xab8732, 0x888888, 0xbe9c48, 0x9c9c9c, - 0xcfaf5c, 0xafafaf, 0xdfc06f, 0xc0c0c0, - 0xeed180, 0xd0d0d0, 0xfce090, 0xdfdfdf, - 0x445c00, 0x4a4a4a, 0x5e791a, 0x666666, - 0x769332, 0x7f7f7f, 0x8cac48, 0x979797, - 0xa0c25c, 0xacacac, 0xb3d76f, 0xc0c0c0, - 0xc4ea80, 0xd2d2d2, 0xd4fc90, 0xe3e3e3, - 0x703400, 0x404040, 0x89511a, 0x5b5b5b, - 0xa06b32, 0x747474, 0xb68448, 0x8c8c8c, - 0xc99a5c, 0xa0a0a0, 0xdcaf6f, 0xb5b5b5, - 0xecc280, 0xc7c7c7, 0xfcd490, 0xd8d8d8, - 0x006414, 0x3c3c3c, 0x1a8035, 0x585858, - 0x329852, 0x717171, 0x48b06e, 0x898989, - 0x5cc587, 0x9e9e9e, 0x6fd99e, 0xb2b2b2, - 0x80ebb4, 0xc4c4c4, 0x90fcc8, 0xd5d5d5, - 0x700014, 0x232323, 0x891a35, 0x3e3e3e, - 0xa03252, 0x565656, 0xb6486e, 0x6d6d6d, - 0xc95c87, 0x818181, 0xdc6f9e, 0x949494, - 0xec80b4, 0xa6a6a6, 0xfc90c8, 0xb6b6b6, - 0x005c5c, 0x404040, 0x1a7676, 0x5a5a5a, - 0x328e8e, 0x727272, 0x48a4a4, 0x888888, - 0x5cb8b8, 0x9c9c9c, 0x6fcbcb, 0xafafaf, - 0x80dcdc, 0xc0c0c0, 0x90ecec, 0xd0d0d0, - 0x70005c, 0x2b2b2b, 0x841a74, 0x434343, - 0x963289, 0x595959, 0xa8489e, 0x6e6e6e, - 0xb75cb0, 0x808080, 0xc66fc1, 0x929292, - 0xd380d1, 0xa2a2a2, 0xe090e0, 0xb1b1b1, - 0x003c70, 0x2f2f2f, 0x195a89, 0x4b4b4b, - 0x2f75a0, 0x646464, 0x448eb6, 0x7c7c7c, - 0x57a5c9, 0x919191, 0x68badc, 0xa5a5a5, - 0x79ceec, 0xb7b7b7, 0x88e0fc, 0xc8c8c8, - 0x580070, 0x272727, 0x6e1a89, 0x3f3f3f, - 0x8332a0, 0x565656, 0x9648b6, 0x6b6b6b, - 0xa75cc9, 0x7e7e7e, 0xb76fdc, 0x909090, - 0xc680ec, 0xa1a1a1, 0xd490fc, 0xb0b0b0, - 0x002070, 0x1f1f1f, 0x193f89, 0x3c3c3c, - 0x2f5aa0, 0x555555, 0x4474b6, 0x6d6d6d, - 0x578bc9, 0x828282, 0x68a1dc, 0x969696, - 0x79b5ec, 0xa9a9a9, 0x88c8fc, 0xbababa, - 0x340080, 0x1e1e1e, 0x4a1a96, 0x363636, - 0x5f32ab, 0x4d4d4d, 0x7248be, 0x616161, - 0x835ccf, 0x747474, 0x936fdf, 0x868686, - 0xa280ee, 0x969696, 0xb090fc, 0xa5a5a5, - 0x000088, 0x0f0f0f, 0x1a1a9d, 0x282828, - 0x3232b0, 0x404040, 0x4848c2, 0x555555, - 0x5c5cd2, 0x696969, 0x6f6fe1, 0x7b7b7b, - 0x8080ef, 0x8c8c8c, 0x9090fc, 0x9c9c9c, - 0x000000, 0x000000, 0x2b2b2b, 0x2a2a2a, - 0x525252, 0x515151, 0x767676, 0x757575, - 0x979797, 0x969696, 0xb6b6b6, 0xb5b5b5, - 0xd2d2d2, 0xd1d1d1, 0xececec, 0xebebeb, - 0x000000, 0x000000, 0x2b2b2b, 0x2a2a2a, - 0x525252, 0x515151, 0x767676, 0x757575, - 0x979797, 0x969696, 0xb6b6b6, 0xb5b5b5, - 0xd2d2d2, 0xd1d1d1, 0xececec, 0xebebeb +uInt32 Console::ourPALPalette[256] = { + 0x000000, 0, 0x2b2b2b, 0, 0x525252, 0, 0x767676, 0, + 0x979797, 0, 0xb6b6b6, 0, 0xd2d2d2, 0, 0xececec, 0, + 0x000000, 0, 0x2b2b2b, 0, 0x525252, 0, 0x767676, 0, + 0x979797, 0, 0xb6b6b6, 0, 0xd2d2d2, 0, 0xececec, 0, + 0x805800, 0, 0x96711a, 0, 0xab8732, 0, 0xbe9c48, 0, + 0xcfaf5c, 0, 0xdfc06f, 0, 0xeed180, 0, 0xfce090, 0, + 0x445c00, 0, 0x5e791a, 0, 0x769332, 0, 0x8cac48, 0, + 0xa0c25c, 0, 0xb3d76f, 0, 0xc4ea80, 0, 0xd4fc90, 0, + 0x703400, 0, 0x89511a, 0, 0xa06b32, 0, 0xb68448, 0, + 0xc99a5c, 0, 0xdcaf6f, 0, 0xecc280, 0, 0xfcd490, 0, + 0x006414, 0, 0x1a8035, 0, 0x329852, 0, 0x48b06e, 0, + 0x5cc587, 0, 0x6fd99e, 0, 0x80ebb4, 0, 0x90fcc8, 0, + 0x700014, 0, 0x891a35, 0, 0xa03252, 0, 0xb6486e, 0, + 0xc95c87, 0, 0xdc6f9e, 0, 0xec80b4, 0, 0xfc90c8, 0, + 0x005c5c, 0, 0x1a7676, 0, 0x328e8e, 0, 0x48a4a4, 0, + 0x5cb8b8, 0, 0x6fcbcb, 0, 0x80dcdc, 0, 0x90ecec, 0, + 0x70005c, 0, 0x841a74, 0, 0x963289, 0, 0xa8489e, 0, + 0xb75cb0, 0, 0xc66fc1, 0, 0xd380d1, 0, 0xe090e0, 0, + 0x003c70, 0, 0x195a89, 0, 0x2f75a0, 0, 0x448eb6, 0, + 0x57a5c9, 0, 0x68badc, 0, 0x79ceec, 0, 0x88e0fc, 0, + 0x580070, 0, 0x6e1a89, 0, 0x8332a0, 0, 0x9648b6, 0, + 0xa75cc9, 0, 0xb76fdc, 0, 0xc680ec, 0, 0xd490fc, 0, + 0x002070, 0, 0x193f89, 0, 0x2f5aa0, 0, 0x4474b6, 0, + 0x578bc9, 0, 0x68a1dc, 0, 0x79b5ec, 0, 0x88c8fc, 0, + 0x340080, 0, 0x4a1a96, 0, 0x5f32ab, 0, 0x7248be, 0, + 0x835ccf, 0, 0x936fdf, 0, 0xa280ee, 0, 0xb090fc, 0, + 0x000088, 0, 0x1a1a9d, 0, 0x3232b0, 0, 0x4848c2, 0, + 0x5c5cd2, 0, 0x6f6fe1, 0, 0x8080ef, 0, 0x9090fc, 0, + 0x000000, 0, 0x2b2b2b, 0, 0x525252, 0, 0x767676, 0, + 0x979797, 0, 0xb6b6b6, 0, 0xd2d2d2, 0, 0xececec, 0, + 0x000000, 0, 0x2b2b2b, 0, 0x525252, 0, 0x767676, 0, + 0x979797, 0, 0xb6b6b6, 0, 0xd2d2d2, 0, 0xececec, 0 }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt32 Console::ourNTSCPalette11[256] = { - 0x000000, 0x000000, 0x393939, 0x393939, - 0x797979, 0x797979, 0xababab, 0xababab, - 0xcdcdcd, 0xcdcdcd, 0xe6e6e6, 0xe6e6e6, - 0xf2f2f2, 0xf2f2f2, 0xffffff, 0xffffff, - 0x391701, 0x391701, 0x833008, 0x833008, - 0xc85f24, 0xc85f24, 0xff911d, 0xff911d, - 0xffc51d, 0xffc51d, 0xffd84c, 0xffd84c, - 0xfff456, 0xfff456, 0xffff98, 0xffff98, - 0x451904, 0x451904, 0x9f241e, 0x9f241e, - 0xc85122, 0xc85122, 0xff811e, 0xff811e, - 0xff982c, 0xff982c, 0xffc545, 0xffc545, - 0xffc66d, 0xffc66d, 0xffe4a1, 0xffe4a1, - 0x4a1704, 0x4a1704, 0xb21d17, 0xb21d17, - 0xdf251c, 0xdf251c, 0xfa5255, 0xfa5255, - 0xff706e, 0xff706e, 0xff8f8f, 0xff8f8f, - 0xffabad, 0xffabad, 0xffc7ce, 0xffc7ce, - 0x050568, 0x050568, 0x712272, 0x712272, - 0xa532a6, 0xa532a6, 0xcd3ecf, 0xcd3ecf, - 0xea51eb, 0xea51eb, 0xfe6dff, 0xfe6dff, - 0xff87fb, 0xff87fb, 0xffa4ff, 0xffa4ff, - 0x280479, 0x280479, 0x590f90, 0x590f90, - 0x8839aa, 0x8839aa, 0xc04adc, 0xc04adc, - 0xe05eff, 0xe05eff, 0xf27cff, 0xf27cff, - 0xff98ff, 0xff98ff, 0xfeabff, 0xfeabff, - 0x35088a, 0x35088a, 0x500cd0, 0x500cd0, - 0x7945d0, 0x7945d0, 0xa251d9, 0xa251d9, - 0xbe60ff, 0xbe60ff, 0xcc77ff, 0xcc77ff, - 0xd790ff, 0xd790ff, 0xdfaaff, 0xdfaaff, - 0x051e81, 0x051e81, 0x082fca, 0x082fca, - 0x444cde, 0x444cde, 0x5a68ff, 0x5a68ff, - 0x7183ff, 0x7183ff, 0x90a0ff, 0x90a0ff, - 0x9fb2ff, 0x9fb2ff, 0xc0cbff, 0xc0cbff, - 0x0c048b, 0x0c048b, 0x382db5, 0x382db5, - 0x584fda, 0x584fda, 0x6b64ff, 0x6b64ff, - 0x8a84ff, 0x8a84ff, 0x9998ff, 0x9998ff, - 0xb1aeff, 0xb1aeff, 0xc0c2ff, 0xc0c2ff, - 0x1d295a, 0x1d295a, 0x1d4892, 0x1d4892, - 0x1c71c6, 0x1c71c6, 0x489bd9, 0x489bd9, - 0x55b6ff, 0x55b6ff, 0x8cd8ff, 0x8cd8ff, - 0x9bdfff, 0x9bdfff, 0xc3e9ff, 0xc3e9ff, - 0x2f4302, 0x2f4302, 0x446103, 0x446103, - 0x3e9421, 0x3e9421, 0x57ab3b, 0x57ab3b, - 0x61d070, 0x61d070, 0x72f584, 0x72f584, - 0x87ff97, 0x87ff97, 0xadffb6, 0xadffb6, - 0x0a4108, 0x0a4108, 0x10680d, 0x10680d, - 0x169212, 0x169212, 0x1cb917, 0x1cb917, - 0x21d91b, 0x21d91b, 0x6ef040, 0x6ef040, - 0x83ff5b, 0x83ff5b, 0xb2ff9a, 0xb2ff9a, - 0x04410b, 0x04410b, 0x066611, 0x066611, - 0x088817, 0x088817, 0x0baf1d, 0x0baf1d, - 0x86d922, 0x86d922, 0x99f927, 0x99f927, - 0xb7ff5b, 0xb7ff5b, 0xdcff81, 0xdcff81, - 0x02350f, 0x02350f, 0x0c4a1c, 0x0c4a1c, - 0x4f7420, 0x4f7420, 0x649228, 0x649228, - 0xa1b034, 0xa1b034, 0xb2d241, 0xb2d241, - 0xd6e149, 0xd6e149, 0xf2ff53, 0xf2ff53, - 0x263001, 0x263001, 0x234005, 0x234005, - 0x806931, 0x806931, 0xaf993a, 0xaf993a, - 0xd5b543, 0xd5b543, 0xe1cb38, 0xe1cb38, - 0xe3e534, 0xe3e534, 0xfbff7d, 0xfbff7d, - 0x401a02, 0x401a02, 0x702408, 0x702408, - 0xab511f, 0xab511f, 0xbf7730, 0xbf7730, - 0xe19344, 0xe19344, 0xf9ad58, 0xf9ad58, - 0xffc160, 0xffc160, 0xffcb83, 0xffcb83 +uInt32 Console::ourNTSCPalette11[256] = { + 0x000000, 0, 0x393939, 0, 0x797979, 0, 0xababab, 0, + 0xcdcdcd, 0, 0xe6e6e6, 0, 0xf2f2f2, 0, 0xffffff, 0, + 0x391701, 0, 0x833008, 0, 0xc85f24, 0, 0xff911d, 0, + 0xffc51d, 0, 0xffd84c, 0, 0xfff456, 0, 0xffff98, 0, + 0x451904, 0, 0x9f241e, 0, 0xc85122, 0, 0xff811e, 0, + 0xff982c, 0, 0xffc545, 0, 0xffc66d, 0, 0xffe4a1, 0, + 0x4a1704, 0, 0xb21d17, 0, 0xdf251c, 0, 0xfa5255, 0, + 0xff706e, 0, 0xff8f8f, 0, 0xffabad, 0, 0xffc7ce, 0, + 0x050568, 0, 0x712272, 0, 0xa532a6, 0, 0xcd3ecf, 0, + 0xea51eb, 0, 0xfe6dff, 0, 0xff87fb, 0, 0xffa4ff, 0, + 0x280479, 0, 0x590f90, 0, 0x8839aa, 0, 0xc04adc, 0, + 0xe05eff, 0, 0xf27cff, 0, 0xff98ff, 0, 0xfeabff, 0, + 0x35088a, 0, 0x500cd0, 0, 0x7945d0, 0, 0xa251d9, 0, + 0xbe60ff, 0, 0xcc77ff, 0, 0xd790ff, 0, 0xdfaaff, 0, + 0x051e81, 0, 0x082fca, 0, 0x444cde, 0, 0x5a68ff, 0, + 0x7183ff, 0, 0x90a0ff, 0, 0x9fb2ff, 0, 0xc0cbff, 0, + 0x0c048b, 0, 0x382db5, 0, 0x584fda, 0, 0x6b64ff, 0, + 0x8a84ff, 0, 0x9998ff, 0, 0xb1aeff, 0, 0xc0c2ff, 0, + 0x1d295a, 0, 0x1d4892, 0, 0x1c71c6, 0, 0x489bd9, 0, + 0x55b6ff, 0, 0x8cd8ff, 0, 0x9bdfff, 0, 0xc3e9ff, 0, + 0x2f4302, 0, 0x446103, 0, 0x3e9421, 0, 0x57ab3b, 0, + 0x61d070, 0, 0x72f584, 0, 0x87ff97, 0, 0xadffb6, 0, + 0x0a4108, 0, 0x10680d, 0, 0x169212, 0, 0x1cb917, 0, + 0x21d91b, 0, 0x6ef040, 0, 0x83ff5b, 0, 0xb2ff9a, 0, + 0x04410b, 0, 0x066611, 0, 0x088817, 0, 0x0baf1d, 0, + 0x86d922, 0, 0x99f927, 0, 0xb7ff5b, 0, 0xdcff81, 0, + 0x02350f, 0, 0x0c4a1c, 0, 0x4f7420, 0, 0x649228, 0, + 0xa1b034, 0, 0xb2d241, 0, 0xd6e149, 0, 0xf2ff53, 0, + 0x263001, 0, 0x234005, 0, 0x806931, 0, 0xaf993a, 0, + 0xd5b543, 0, 0xe1cb38, 0, 0xe3e534, 0, 0xfbff7d, 0, + 0x401a02, 0, 0x702408, 0, 0xab511f, 0, 0xbf7730, 0, + 0xe19344, 0, 0xf9ad58, 0, 0xffc160, 0, 0xffcb83, 0 }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt32 Console::ourPALPalette11[256] = { - 0x000000, 0x000000, 0x242424, 0x232323, - 0x484848, 0x474747, 0x6d6d6d, 0x6c6c6c, - 0x919191, 0x909090, 0xb6b6b6, 0xb5b5b5, - 0xdadada, 0xd9d9d9, 0xffffff, 0xfefefe, - 0x000000, 0x000000, 0x242424, 0x232323, - 0x484848, 0x474747, 0x6d6d6d, 0x6c6c6c, - 0x919191, 0x909090, 0xb6b6b6, 0xb5b5b5, - 0xdadada, 0xd9d9d9, 0xffffff, 0xfefefe, - 0x4a3700, 0x363636, 0x705813, 0x575757, - 0x8c732a, 0x727272, 0xa68d46, 0x8c8c8c, - 0xbea767, 0xa6a6a6, 0xd4c18b, 0xc0c0c0, - 0xeadcb3, 0xdbdbdb, 0xfff6de, 0xf5f5f5, - 0x284a00, 0x373737, 0x44700f, 0x575757, - 0x5c8c21, 0x717171, 0x74a638, 0x8a8a8a, - 0x8cbe51, 0xa2a2a2, 0xa6d46e, 0xbababa, - 0xc0ea8e, 0xd2d2d2, 0xdbffb0, 0xebebeb, - 0x4a1300, 0x212121, 0x70280f, 0x3a3a3a, - 0x8c3d21, 0x515151, 0xa65438, 0x696969, - 0xbe6d51, 0x828282, 0xd4886e, 0x9b9b9b, - 0xeaa58e, 0xb6b6b6, 0xffc4b0, 0xd3d3d3, - 0x004a22, 0x2f2f2f, 0x0f703b, 0x4c4c4c, - 0x218c52, 0x656565, 0x38a66a, 0x7e7e7e, - 0x51be83, 0x969696, 0x6ed49d, 0xafafaf, - 0x8eeab8, 0xc8c8c8, 0xb0ffd4, 0xe2e2e2, - 0x4a0028, 0x1a1a1a, 0x700f44, 0x323232, - 0x8c215c, 0x474747, 0xa63874, 0x5f5f5f, - 0xbe518c, 0x787878, 0xd46ea6, 0x929292, - 0xea8ec0, 0xafafaf, 0xffb0db, 0xcccccc, - 0x00404a, 0x2e2e2e, 0x0f6370, 0x4b4b4b, - 0x217e8c, 0x636363, 0x3897a6, 0x7c7c7c, - 0x51afbe, 0x949494, 0x6ec7d4, 0xadadad, - 0x8edeea, 0xc7c7c7, 0xb0f4ff, 0xe0e0e0, - 0x43002c, 0x191919, 0x650f4b, 0x2f2f2f, - 0x7e2165, 0x444444, 0x953880, 0x5c5c5c, - 0xa6519a, 0x727272, 0xbf6eb7, 0x8e8e8e, - 0xd38ed3, 0xaaaaaa, 0xe5b0f1, 0xc7c7c7, - 0x001d4a, 0x191919, 0x0f3870, 0x323232, - 0x21538c, 0x4a4a4a, 0x386ea6, 0x646464, - 0x518dbe, 0x808080, 0x6ea8d4, 0x9b9b9b, - 0x8ec8ea, 0xbababa, 0xb0e9ff, 0xdadada, - 0x37004a, 0x181818, 0x570f70, 0x2f2f2f, - 0x70218c, 0x444444, 0x8938a6, 0x5c5c5c, - 0xa151be, 0x757575, 0xba6ed4, 0x909090, - 0xd28eea, 0xacacac, 0xeab0ff, 0xcacaca, - 0x00184a, 0x161616, 0x0f2e70, 0x2c2c2c, - 0x21448c, 0x414141, 0x385ba6, 0x595959, - 0x5174be, 0x717171, 0x6e8fd4, 0x8c8c8c, - 0x8eabea, 0xa9a9a9, 0xb0c9ff, 0xc7c7c7, - 0x13004a, 0x0e0e0e, 0x280f70, 0x212121, - 0x3d218c, 0x353535, 0x5438a6, 0x4c4c4c, - 0x6d51be, 0x656565, 0x886ed4, 0x818181, - 0xa58eea, 0x9f9f9f, 0xc4b0ff, 0xbebebe, - 0x00014a, 0x090909, 0x0f1170, 0x1b1b1b, - 0x21248c, 0x2e2e2e, 0x383aa6, 0x454545, - 0x5153be, 0x5e5e5e, 0x6e70d4, 0x7a7a7a, - 0x8e8fea, 0x999999, 0xb0b2ff, 0xbababa, - 0x000000, 0x000000, 0x242424, 0x232323, - 0x484848, 0x474747, 0x6d6d6d, 0x6c6c6c, - 0x919191, 0x909090, 0xb6b6b6, 0xb5b5b5, - 0xdadada, 0xd9d9d9, 0xffffff, 0xfefefe, - 0x000000, 0x000000, 0x242424, 0x232323, - 0x484848, 0x474747, 0x6d6d6d, 0x6c6c6c, - 0x919191, 0x909090, 0xb6b6b6, 0xb5b5b5, - 0xdadada, 0xd9d9d9, 0xffffff, 0xfefefe +uInt32 Console::ourPALPalette11[256] = { + 0x000000, 0, 0x242424, 0, 0x484848, 0, 0x6d6d6d, 0, + 0x919191, 0, 0xb6b6b6, 0, 0xdadada, 0, 0xffffff, 0, + 0x000000, 0, 0x242424, 0, 0x484848, 0, 0x6d6d6d, 0, + 0x919191, 0, 0xb6b6b6, 0, 0xdadada, 0, 0xffffff, 0, + 0x4a3700, 0, 0x705813, 0, 0x8c732a, 0, 0xa68d46, 0, + 0xbea767, 0, 0xd4c18b, 0, 0xeadcb3, 0, 0xfff6de, 0, + 0x284a00, 0, 0x44700f, 0, 0x5c8c21, 0, 0x74a638, 0, + 0x8cbe51, 0, 0xa6d46e, 0, 0xc0ea8e, 0, 0xdbffb0, 0, + 0x4a1300, 0, 0x70280f, 0, 0x8c3d21, 0, 0xa65438, 0, + 0xbe6d51, 0, 0xd4886e, 0, 0xeaa58e, 0, 0xffc4b0, 0, + 0x004a22, 0, 0x0f703b, 0, 0x218c52, 0, 0x38a66a, 0, + 0x51be83, 0, 0x6ed49d, 0, 0x8eeab8, 0, 0xb0ffd4, 0, + 0x4a0028, 0, 0x700f44, 0, 0x8c215c, 0, 0xa63874, 0, + 0xbe518c, 0, 0xd46ea6, 0, 0xea8ec0, 0, 0xffb0db, 0, + 0x00404a, 0, 0x0f6370, 0, 0x217e8c, 0, 0x3897a6, 0, + 0x51afbe, 0, 0x6ec7d4, 0, 0x8edeea, 0, 0xb0f4ff, 0, + 0x43002c, 0, 0x650f4b, 0, 0x7e2165, 0, 0x953880, 0, + 0xa6519a, 0, 0xbf6eb7, 0, 0xd38ed3, 0, 0xe5b0f1, 0, + 0x001d4a, 0, 0x0f3870, 0, 0x21538c, 0, 0x386ea6, 0, + 0x518dbe, 0, 0x6ea8d4, 0, 0x8ec8ea, 0, 0xb0e9ff, 0, + 0x37004a, 0, 0x570f70, 0, 0x70218c, 0, 0x8938a6, 0, + 0xa151be, 0, 0xba6ed4, 0, 0xd28eea, 0, 0xeab0ff, 0, + 0x00184a, 0, 0x0f2e70, 0, 0x21448c, 0, 0x385ba6, 0, + 0x5174be, 0, 0x6e8fd4, 0, 0x8eabea, 0, 0xb0c9ff, 0, + 0x13004a, 0, 0x280f70, 0, 0x3d218c, 0, 0x5438a6, 0, + 0x6d51be, 0, 0x886ed4, 0, 0xa58eea, 0, 0xc4b0ff, 0, + 0x00014a, 0, 0x0f1170, 0, 0x21248c, 0, 0x383aa6, 0, + 0x5153be, 0, 0x6e70d4, 0, 0x8e8fea, 0, 0xb0b2ff, 0, + 0x000000, 0, 0x242424, 0, 0x484848, 0, 0x6d6d6d, 0, + 0x919191, 0, 0xb6b6b6, 0, 0xdadada, 0, 0xffffff, 0, + 0x000000, 0, 0x242424, 0, 0x484848, 0, 0x6d6d6d, 0, + 0x919191, 0, 0xb6b6b6, 0, 0xdadada, 0, 0xffffff, 0 }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt32 Console::ourNTSCPaletteZ26[256] = { - 0x000000, 0x000000, 0x505050, 0x505050, - 0x646464, 0x646464, 0x787878, 0x787878, - 0x8c8c8c, 0x8c8c8c, 0xa0a0a0, 0xa0a0a0, - 0xb4b4b4, 0xb4b4b4, 0xc8c8c8, 0xc8c8c8, - 0x445400, 0x445400, 0x586800, 0x586800, - 0x6c7c00, 0x6c7c00, 0x809000, 0x809000, - 0x94a414, 0x94a414, 0xa8b828, 0xa8b828, - 0xbccc3c, 0xbccc3c, 0xd0e050, 0xd0e050, - 0x673900, 0x673900, 0x7b4d00, 0x7b4d00, - 0x8f6100, 0x8f6100, 0xa37513, 0xa37513, - 0xb78927, 0xb78927, 0xcb9d3b, 0xcb9d3b, - 0xdfb14f, 0xdfb14f, 0xf3c563, 0xf3c563, - 0x7b2504, 0x7b2504, 0x8f3918, 0x8f3918, - 0xa34d2c, 0xa34d2c, 0xb76140, 0xb76140, - 0xcb7554, 0xcb7554, 0xdf8968, 0xdf8968, - 0xf39d7c, 0xf39d7c, 0xffb190, 0xffb190, - 0x7d122c, 0x7d122c, 0x912640, 0x912640, - 0xa53a54, 0xa53a54, 0xb94e68, 0xb94e68, - 0xcd627c, 0xcd627c, 0xe17690, 0xe17690, - 0xf58aa4, 0xf58aa4, 0xff9eb8, 0xff9eb8, - 0x730871, 0x730871, 0x871c85, 0x871c85, - 0x9b3099, 0x9b3099, 0xaf44ad, 0xaf44ad, - 0xc358c1, 0xc358c1, 0xd76cd5, 0xd76cd5, - 0xeb80e9, 0xeb80e9, 0xff94fd, 0xff94fd, - 0x5d0b92, 0x5d0b92, 0x711fa6, 0x711fa6, - 0x8533ba, 0x8533ba, 0x9947ce, 0x9947ce, - 0xad5be2, 0xad5be2, 0xc16ff6, 0xc16ff6, - 0xd583ff, 0xd583ff, 0xe997ff, 0xe997ff, - 0x401599, 0x401599, 0x5429ad, 0x5429ad, - 0x683dc1, 0x683dc1, 0x7c51d5, 0x7c51d5, - 0x9065e9, 0x9065e9, 0xa479fd, 0xa479fd, - 0xb88dff, 0xb88dff, 0xcca1ff, 0xcca1ff, - 0x252593, 0x252593, 0x3939a7, 0x3939a7, - 0x4d4dbb, 0x4d4dbb, 0x6161cf, 0x6161cf, - 0x7575e3, 0x7575e3, 0x8989f7, 0x8989f7, - 0x9d9dff, 0x9d9dff, 0xb1b1ff, 0xb1b1ff, - 0x0f3480, 0x0f3480, 0x234894, 0x234894, - 0x375ca8, 0x375ca8, 0x4b70bc, 0x4b70bc, - 0x5f84d0, 0x5f84d0, 0x7398e4, 0x7398e4, - 0x87acf8, 0x87acf8, 0x9bc0ff, 0x9bc0ff, - 0x04425a, 0x04425a, 0x18566e, 0x18566e, - 0x2c6a82, 0x2c6a82, 0x407e96, 0x407e96, - 0x5492aa, 0x5492aa, 0x68a6be, 0x68a6be, - 0x7cbad2, 0x7cbad2, 0x90cee6, 0x90cee6, - 0x044f30, 0x044f30, 0x186344, 0x186344, - 0x2c7758, 0x2c7758, 0x408b6c, 0x408b6c, - 0x549f80, 0x549f80, 0x68b394, 0x68b394, - 0x7cc7a8, 0x7cc7a8, 0x90dbbc, 0x90dbbc, - 0x0f550a, 0x0f550a, 0x23691e, 0x23691e, - 0x377d32, 0x377d32, 0x4b9146, 0x4b9146, - 0x5fa55a, 0x5fa55a, 0x73b96e, 0x73b96e, - 0x87cd82, 0x87cd82, 0x9be196, 0x9be196, - 0x1f5100, 0x1f5100, 0x336505, 0x336505, - 0x477919, 0x477919, 0x5b8d2d, 0x5b8d2d, - 0x6fa141, 0x6fa141, 0x83b555, 0x83b555, - 0x97c969, 0x97c969, 0xabdd7d, 0xabdd7d, - 0x344600, 0x344600, 0x485a00, 0x485a00, - 0x5c6e14, 0x5c6e14, 0x708228, 0x708228, - 0x84963c, 0x84963c, 0x98aa50, 0x98aa50, - 0xacbe64, 0xacbe64, 0xc0d278, 0xc0d278, - 0x463e00, 0x463e00, 0x5a5205, 0x5a5205, - 0x6e6619, 0x6e6619, 0x827a2d, 0x827a2d, - 0x968e41, 0x968e41, 0xaaa255, 0xaaa255, - 0xbeb669, 0xbeb669, 0xd2ca7d, 0xd2ca7d +uInt32 Console::ourNTSCPaletteZ26[256] = { + 0x000000, 0, 0x505050, 0, 0x646464, 0, 0x787878, 0, + 0x8c8c8c, 0, 0xa0a0a0, 0, 0xb4b4b4, 0, 0xc8c8c8, 0, + 0x445400, 0, 0x586800, 0, 0x6c7c00, 0, 0x809000, 0, + 0x94a414, 0, 0xa8b828, 0, 0xbccc3c, 0, 0xd0e050, 0, + 0x673900, 0, 0x7b4d00, 0, 0x8f6100, 0, 0xa37513, 0, + 0xb78927, 0, 0xcb9d3b, 0, 0xdfb14f, 0, 0xf3c563, 0, + 0x7b2504, 0, 0x8f3918, 0, 0xa34d2c, 0, 0xb76140, 0, + 0xcb7554, 0, 0xdf8968, 0, 0xf39d7c, 0, 0xffb190, 0, + 0x7d122c, 0, 0x912640, 0, 0xa53a54, 0, 0xb94e68, 0, + 0xcd627c, 0, 0xe17690, 0, 0xf58aa4, 0, 0xff9eb8, 0, + 0x730871, 0, 0x871c85, 0, 0x9b3099, 0, 0xaf44ad, 0, + 0xc358c1, 0, 0xd76cd5, 0, 0xeb80e9, 0, 0xff94fd, 0, + 0x5d0b92, 0, 0x711fa6, 0, 0x8533ba, 0, 0x9947ce, 0, + 0xad5be2, 0, 0xc16ff6, 0, 0xd583ff, 0, 0xe997ff, 0, + 0x401599, 0, 0x5429ad, 0, 0x683dc1, 0, 0x7c51d5, 0, + 0x9065e9, 0, 0xa479fd, 0, 0xb88dff, 0, 0xcca1ff, 0, + 0x252593, 0, 0x3939a7, 0, 0x4d4dbb, 0, 0x6161cf, 0, + 0x7575e3, 0, 0x8989f7, 0, 0x9d9dff, 0, 0xb1b1ff, 0, + 0x0f3480, 0, 0x234894, 0, 0x375ca8, 0, 0x4b70bc, 0, + 0x5f84d0, 0, 0x7398e4, 0, 0x87acf8, 0, 0x9bc0ff, 0, + 0x04425a, 0, 0x18566e, 0, 0x2c6a82, 0, 0x407e96, 0, + 0x5492aa, 0, 0x68a6be, 0, 0x7cbad2, 0, 0x90cee6, 0, + 0x044f30, 0, 0x186344, 0, 0x2c7758, 0, 0x408b6c, 0, + 0x549f80, 0, 0x68b394, 0, 0x7cc7a8, 0, 0x90dbbc, 0, + 0x0f550a, 0, 0x23691e, 0, 0x377d32, 0, 0x4b9146, 0, + 0x5fa55a, 0, 0x73b96e, 0, 0x87cd82, 0, 0x9be196, 0, + 0x1f5100, 0, 0x336505, 0, 0x477919, 0, 0x5b8d2d, 0, + 0x6fa141, 0, 0x83b555, 0, 0x97c969, 0, 0xabdd7d, 0, + 0x344600, 0, 0x485a00, 0, 0x5c6e14, 0, 0x708228, 0, + 0x84963c, 0, 0x98aa50, 0, 0xacbe64, 0, 0xc0d278, 0, + 0x463e00, 0, 0x5a5205, 0, 0x6e6619, 0, 0x827a2d, 0, + 0x968e41, 0, 0xaaa255, 0, 0xbeb669, 0, 0xd2ca7d, 0 }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt32 Console::ourPALPaletteZ26[256] = { - 0x000000, 0x000000, 0x4c4c4c, 0x4b4b4b, - 0x606060, 0x5f5f5f, 0x747474, 0x737373, - 0x888888, 0x878787, 0x9c9c9c, 0x9b9b9b, - 0xb0b0b0, 0xafafaf, 0xc4c4c4, 0xc3c3c3, - 0x000000, 0x000000, 0x4c4c4c, 0x4b4b4b, - 0x606060, 0x5f5f5f, 0x747474, 0x737373, - 0x888888, 0x878787, 0x9c9c9c, 0x9b9b9b, - 0xb0b0b0, 0xafafaf, 0xc4c4c4, 0xc3c3c3, - 0x533a00, 0x3a3a3a, 0x674e00, 0x4c4c4c, - 0x7b6203, 0x5e5e5e, 0x8f7617, 0x727272, - 0xa38a2b, 0x868686, 0xb79e3f, 0x9a9a9a, - 0xcbb253, 0xaeaeae, 0xdfc667, 0xc2c2c2, - 0x1b5800, 0x3b3b3b, 0x2f6c00, 0x4d4d4d, - 0x438001, 0x5f5f5f, 0x579415, 0x737373, - 0x6ba829, 0x878787, 0x7fbc3d, 0x9b9b9b, - 0x93d051, 0xafafaf, 0xa7e465, 0xc3c3c3, - 0x6a2900, 0x373737, 0x7e3d12, 0x4b4b4b, - 0x925126, 0x5f5f5f, 0xa6653a, 0x737373, - 0xba794e, 0x878787, 0xce8d62, 0x9b9b9b, - 0xe2a176, 0xafafaf, 0xf6b58a, 0xc3c3c3, - 0x075b00, 0x373737, 0x1b6f11, 0x4b4b4b, - 0x2f8325, 0x5f5f5f, 0x439739, 0x737373, - 0x57ab4d, 0x878787, 0x6bbf61, 0x9b9b9b, - 0x7fd375, 0xafafaf, 0x93e789, 0xc3c3c3, - 0x741b2f, 0x373737, 0x882f43, 0x4b4b4b, - 0x9c4357, 0x5f5f5f, 0xb0576b, 0x737373, - 0xc46b7f, 0x878787, 0xd87f93, 0x9b9b9b, - 0xec93a7, 0xafafaf, 0xffa7bb, 0xc3c3c3, - 0x00572e, 0x383838, 0x106b42, 0x4b4b4b, - 0x247f56, 0x5f5f5f, 0x38936a, 0x737373, - 0x4ca77e, 0x878787, 0x60bb92, 0x9b9b9b, - 0x74cfa6, 0xafafaf, 0x88e3ba, 0xc3c3c3, - 0x6d165f, 0x383838, 0x812a73, 0x4c4c4c, - 0x953e87, 0x606060, 0xa9529b, 0x747474, - 0xbd66af, 0x888888, 0xd17ac3, 0x9c9c9c, - 0xe58ed7, 0xb0b0b0, 0xf9a2eb, 0xc4c4c4, - 0x014c5e, 0x373737, 0x156072, 0x4b4b4b, - 0x297486, 0x5f5f5f, 0x3d889a, 0x737373, - 0x519cae, 0x878787, 0x65b0c2, 0x9b9b9b, - 0x79c4d6, 0xafafaf, 0x8dd8ea, 0xc3c3c3, - 0x5f1588, 0x383838, 0x73299c, 0x4c4c4c, - 0x873db0, 0x606060, 0x9b51c4, 0x747474, - 0xaf65d8, 0x888888, 0xc379ec, 0x9c9c9c, - 0xd78dff, 0xb0b0b0, 0xeba1ff, 0xc1c1c1, - 0x123b87, 0x373737, 0x264f9b, 0x4b4b4b, - 0x3a63af, 0x5f5f5f, 0x4e77c3, 0x737373, - 0x628bd7, 0x878787, 0x769feb, 0x9b9b9b, - 0x8ab3ff, 0xafafaf, 0x9ec7ff, 0xc1c1c1, - 0x451e9d, 0x383838, 0x5932b1, 0x4c4c4c, - 0x6d46c5, 0x606060, 0x815ad9, 0x747474, - 0x956eed, 0x888888, 0xa982ff, 0x9b9b9b, - 0xbd96ff, 0xadadad, 0xd1aaff, 0xbfbfbf, - 0x2a2b9e, 0x373737, 0x3e3fb2, 0x4b4b4b, - 0x5253c6, 0x5f5f5f, 0x6667da, 0x737373, - 0x7a7bee, 0x878787, 0x8e8fff, 0x9b9b9b, - 0xa2a3ff, 0xadadad, 0xb6b7ff, 0xbebebe, - 0x000000, 0x000000, 0x4c4c4c, 0x4b4b4b, - 0x606060, 0x5f5f5f, 0x747474, 0x737373, - 0x888888, 0x878787, 0x9c9c9c, 0x9b9b9b, - 0xb0b0b0, 0xafafaf, 0xc4c4c4, 0xc3c3c3, - 0x000000, 0x000000, 0x4c4c4c, 0x4b4b4b, - 0x606060, 0x5f5f5f, 0x747474, 0x737373, - 0x888888, 0x878787, 0x9c9c9c, 0x9b9b9b, - 0xb0b0b0, 0xafafaf, 0xc4c4c4, 0xc3c3c3 +uInt32 Console::ourPALPaletteZ26[256] = { + 0x000000, 0, 0x4c4c4c, 0, 0x606060, 0, 0x747474, 0, + 0x888888, 0, 0x9c9c9c, 0, 0xb0b0b0, 0, 0xc4c4c4, 0, + 0x000000, 0, 0x4c4c4c, 0, 0x606060, 0, 0x747474, 0, + 0x888888, 0, 0x9c9c9c, 0, 0xb0b0b0, 0, 0xc4c4c4, 0, + 0x533a00, 0, 0x674e00, 0, 0x7b6203, 0, 0x8f7617, 0, + 0xa38a2b, 0, 0xb79e3f, 0, 0xcbb253, 0, 0xdfc667, 0, + 0x1b5800, 0, 0x2f6c00, 0, 0x438001, 0, 0x579415, 0, + 0x6ba829, 0, 0x7fbc3d, 0, 0x93d051, 0, 0xa7e465, 0, + 0x6a2900, 0, 0x7e3d12, 0, 0x925126, 0, 0xa6653a, 0, + 0xba794e, 0, 0xce8d62, 0, 0xe2a176, 0, 0xf6b58a, 0, + 0x075b00, 0, 0x1b6f11, 0, 0x2f8325, 0, 0x439739, 0, + 0x57ab4d, 0, 0x6bbf61, 0, 0x7fd375, 0, 0x93e789, 0, + 0x741b2f, 0, 0x882f43, 0, 0x9c4357, 0, 0xb0576b, 0, + 0xc46b7f, 0, 0xd87f93, 0, 0xec93a7, 0, 0xffa7bb, 0, + 0x00572e, 0, 0x106b42, 0, 0x247f56, 0, 0x38936a, 0, + 0x4ca77e, 0, 0x60bb92, 0, 0x74cfa6, 0, 0x88e3ba, 0, + 0x6d165f, 0, 0x812a73, 0, 0x953e87, 0, 0xa9529b, 0, + 0xbd66af, 0, 0xd17ac3, 0, 0xe58ed7, 0, 0xf9a2eb, 0, + 0x014c5e, 0, 0x156072, 0, 0x297486, 0, 0x3d889a, 0, + 0x519cae, 0, 0x65b0c2, 0, 0x79c4d6, 0, 0x8dd8ea, 0, + 0x5f1588, 0, 0x73299c, 0, 0x873db0, 0, 0x9b51c4, 0, + 0xaf65d8, 0, 0xc379ec, 0, 0xd78dff, 0, 0xeba1ff, 0, + 0x123b87, 0, 0x264f9b, 0, 0x3a63af, 0, 0x4e77c3, 0, + 0x628bd7, 0, 0x769feb, 0, 0x8ab3ff, 0, 0x9ec7ff, 0, + 0x451e9d, 0, 0x5932b1, 0, 0x6d46c5, 0, 0x815ad9, 0, + 0x956eed, 0, 0xa982ff, 0, 0xbd96ff, 0, 0xd1aaff, 0, + 0x2a2b9e, 0, 0x3e3fb2, 0, 0x5253c6, 0, 0x6667da, 0, + 0x7a7bee, 0, 0x8e8fff, 0, 0xa2a3ff, 0, 0xb6b7ff, 0, + 0x000000, 0, 0x4c4c4c, 0, 0x606060, 0, 0x747474, 0, + 0x888888, 0, 0x9c9c9c, 0, 0xb0b0b0, 0, 0xc4c4c4, 0, + 0x000000, 0, 0x4c4c4c, 0, 0x606060, 0, 0x747474, 0, + 0x888888, 0, 0x9c9c9c, 0, 0xb0b0b0, 0, 0xc4c4c4, 0 }; +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt32 Console::ourUserNTSCPalette[256] = { 0 }; // filled from external file + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt32 Console::ourUserPALPalette[256] = { 0 }; // filled from external file + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Console::Console(const Console& console) : myOSystem(console.myOSystem) diff --git a/stella/src/emucore/Console.hxx b/stella/src/emucore/Console.hxx index 18ff699d0..b2d002a8c 100644 --- a/stella/src/emucore/Console.hxx +++ b/stella/src/emucore/Console.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Console.hxx,v 1.53 2006-12-26 00:39:43 stephena Exp $ +// $Id: Console.hxx,v 1.54 2006-12-26 17:06:01 stephena Exp $ //============================================================================ #ifndef CONSOLE_HXX @@ -38,7 +38,7 @@ class System; This class represents the entire game console. @author Bradford W. Mott - @version $Id: Console.hxx,v 1.53 2006-12-26 00:39:43 stephena Exp $ + @version $Id: Console.hxx,v 1.54 2006-12-26 17:06:01 stephena Exp $ */ class Console { @@ -169,6 +169,11 @@ class Console */ void togglePhosphor(); + /** + Toggles the PAL color-loss effect. + */ + void toggleColorLoss(); + /** Initialize the basic properties of the console. TODO - This is a workaround for a bug in the TIA rendering, whereby @@ -246,6 +251,12 @@ class Console */ void loadUserPalette(); + /** + Loads all defined palettes with PAL color-loss data depending + on 'state'. + */ + void setColorLossPalette(bool state); + /** Returns a pointer to the palette data for the palette currently defined by the ROM properties. @@ -292,35 +303,27 @@ class Console // successfully loaded bool myUserPaletteDefined; - // User-defined NTSC and PAL RGB values - uInt32* ourUserNTSCPalette; - uInt32* ourUserPALPalette; - // Contains info about this console in string format string myAboutString; // The currently defined display format (NTSC/PAL/PAL60) string myDisplayFormat; - // Table of RGB values for NTSC - static const uInt32 ourNTSCPalette[256]; + // Table of RGB values for NTSC and PAL + static uInt32 ourNTSCPalette[256]; + static uInt32 ourPALPalette[256]; - // Table of RGB values for PAL. NOTE: The odd numbered entries in - // this array are always shades of grey. This is used to implement - // the PAL color loss effect. - static const uInt32 ourPALPalette[256]; + // Table of RGB values for NTSC and PAL - Stella 1.1 version + static uInt32 ourNTSCPalette11[256]; + static uInt32 ourPALPalette11[256]; - // Table of RGB values for NTSC - Stella 1.1 version - static const uInt32 ourNTSCPalette11[256]; + // Table of RGB values for NTSC and PAL - Z26 version + static uInt32 ourNTSCPaletteZ26[256]; + static uInt32 ourPALPaletteZ26[256]; - // Table of RGB values for PAL - Stella 1.1 version - static const uInt32 ourPALPalette11[256]; - - // Table of RGB values for NTSC - Z26 version - static const uInt32 ourNTSCPaletteZ26[256]; - - // Table of RGB values for PAL - Z26 version - static const uInt32 ourPALPaletteZ26[256]; + // Table of RGB values for NTSC and PAL - user-defined + static uInt32 ourUserNTSCPalette[256]; + static uInt32 ourUserPALPalette[256]; }; #endif diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index 55313148f..e3074c1e3 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: EventHandler.cxx,v 1.189 2006-12-18 16:44:39 stephena Exp $ +// $Id: EventHandler.cxx,v 1.190 2006-12-26 17:06:01 stephena Exp $ //============================================================================ #include @@ -574,6 +574,10 @@ void EventHandler::poll(uInt32 time) myOSystem->console().toggleFormat(); break; + case SDLK_l: // Ctrl-l toggles PAL color-loss effect + myOSystem->console().toggleColorLoss(); + break; + case SDLK_p: // Ctrl-p toggles different palettes myOSystem->console().togglePalette(); break; diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index e86169e77..24b649200 100644 --- a/stella/src/emucore/Settings.cxx +++ b/stella/src/emucore/Settings.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Settings.cxx,v 1.107 2006-12-26 00:39:44 stephena Exp $ +// $Id: Settings.cxx,v 1.108 2006-12-26 17:06:01 stephena Exp $ //============================================================================ #include @@ -48,6 +48,7 @@ Settings::Settings(OSystem* osystem) setInternal("center", "true"); setInternal("grabmouse", "false"); setInternal("palette", "standard"); + setInternal("colorloss", "false"); setInternal("sound", "true"); setInternal("fragsize", "512"); @@ -320,6 +321,7 @@ void Settings::usage() << " standard|\n" << " z26|\n" << " user>\n" + << " -colorloss <1|0> Enable PAL color-loss effect\n" << " -framerate Display the given number of frames per second\n" << endl #ifdef SOUND_SUPPORT