From f27b7209e83b1b86a52562e25b0287912da2dccd Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 5 Sep 2009 03:55:29 +0000 Subject: [PATCH] - Fixed: R_CreatePlayerTranslation() only initialized the first truecolor palette entry. SVN r1795 (trunk) --- docs/rh-log.txt | 4 ++ src/r_translate.cpp | 10 ++--- src/win32/fb_d3d9.cpp | 8 ++-- src/x86.h | 98 +++++++++++++++++++++---------------------- 4 files changed, 63 insertions(+), 57 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 4cc334b88..b5d30a2e2 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -2,6 +2,10 @@ September 5, 2009 (Changes by Graf Zahl) - made menu dimming a mapping option but kept the CVARS as user override. September 4, 2009 +- Fixed: R_CreatePlayerTranslation() only initialized the first truecolor + palette entry. +- Fixed: D3DPal::Update() used BorderColor == 0 as the condition for skipping + an entry. It should be SM14 as in UploadPalette(). - Fixed: The aliasing of CPUInfo was still wrong. (Yarr! The things I do for you, GCC!) The AMD feature flags weren't stored anywhere, either; not that it really matters. diff --git a/src/r_translate.cpp b/src/r_translate.cpp index b7d3300de..212253288 100644 --- a/src/r_translate.cpp +++ b/src/r_translate.cpp @@ -816,18 +816,18 @@ static void R_CreatePlayerTranslation (float h, float s, float v, FPlayerSkin *s // the current one. if (skin->othergame) { - memcpy (table->Remap, OtherGameSkinRemap, 256); - memcpy (table->Palette, OtherGameSkinPalette, sizeof(table->Palette)); + memcpy (table->Remap, OtherGameSkinRemap, table->NumEntries); + memcpy (table->Palette, OtherGameSkinPalette, sizeof(*table->Palette) * table->NumEntries); } else { - for (i = 0; i < 256; ++i) + for (i = 0; i < table->NumEntries; ++i) { table->Remap[i] = i; } - memcpy(table->Palette, GPalette.BaseColors, sizeof(table->Palette)); + memcpy(table->Palette, GPalette.BaseColors, sizeof(*table->Palette) * table->NumEntries); } - for (i = 1; i < 256; ++i) + for (i = 1; i < table->NumEntries; ++i) { table->Palette[i].a = 255; } diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index e8e6ce551..6eb7da66f 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -150,6 +150,7 @@ public: IDirect3DTexture9 *Tex; D3DCOLOR BorderColor; + bool DoColorSkip; bool Update(); @@ -2033,7 +2034,7 @@ D3DPal::D3DPal(FRemapTable *remap, D3DFB *fb) count = 256; // If the palette isn't big enough, then we don't need to // worry about setting the gamma ramp. - BorderColor = (remap->NumEntries >= 256 - 8) ? ~0 : 0; + DoColorSkip = (remap->NumEntries >= 256 - 8); } else { @@ -2043,8 +2044,9 @@ D3DPal::D3DPal(FRemapTable *remap, D3DFB *fb) for (pow2count = 1; pow2count < remap->NumEntries; pow2count <<= 1) { } count = pow2count; - BorderColor = 0; + DoColorSkip = false; } + BorderColor = 0; RoundedPaletteSize = count; if (SUCCEEDED(fb->D3DDevice->CreateTexture(count, 1, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &Tex, NULL))) @@ -2104,7 +2106,7 @@ bool D3DPal::Update() pal = Remap->Palette; // See explanation in UploadPalette() for skipat rationale. - skipat = MIN(Remap->NumEntries, BorderColor != 0 ? 256 - 8 : 256); + skipat = MIN(Remap->NumEntries, DoColorSkip ? 256 - 8 : 256); for (i = 0; i < skipat; ++i) { diff --git a/src/x86.h b/src/x86.h index d2a37e9ad..e5ce7a00b 100644 --- a/src/x86.h +++ b/src/x86.h @@ -8,12 +8,12 @@ struct CPUInfo // 92 bytes union { char VendorID[16]; - DWORD dwVendorID[4]; + uint32 dwVendorID[4]; }; union { char CPUString[48]; - DWORD dwCPUString[12]; + uint32 dwCPUString[12]; }; BYTE Stepping; @@ -30,55 +30,55 @@ struct CPUInfo // 92 bytes BYTE CPUCount; BYTE APICID; - DWORD bSSE3:1; - DWORD DontCare1:8; - DWORD bSSSE3:1; - DWORD DontCare1a:9; - DWORD bSSE41:1; - DWORD bSSE42:1; - DWORD DontCare2a:11; + uint32 bSSE3:1; + uint32 DontCare1:8; + uint32 bSSSE3:1; + uint32 DontCare1a:9; + uint32 bSSE41:1; + uint32 bSSE42:1; + uint32 DontCare2a:11; - DWORD bFPU:1; - DWORD bVME:1; - DWORD bDE:1; - DWORD bPSE:1; - DWORD bRDTSC:1; - DWORD bMSR:1; - DWORD bPAE:1; - DWORD bMCE:1; - DWORD bCX8:1; - DWORD bAPIC:1; - DWORD bReserved1:1; - DWORD bSEP:1; - DWORD bMTRR:1; - DWORD bPGE:1; - DWORD bMCA:1; - DWORD bCMOV:1; - DWORD bPAT:1; - DWORD bPSE36:1; - DWORD bPSN:1; - DWORD bCFLUSH:1; - DWORD bReserved2:1; - DWORD bDS:1; - DWORD bACPI:1; - DWORD bMMX:1; - DWORD bFXSR:1; - DWORD bSSE:1; - DWORD bSSE2:1; - DWORD bSS:1; - DWORD bHTT:1; - DWORD bTM:1; - DWORD bReserved3:1; - DWORD bPBE:1; + uint32 bFPU:1; + uint32 bVME:1; + uint32 bDE:1; + uint32 bPSE:1; + uint32 bRDTSC:1; + uint32 bMSR:1; + uint32 bPAE:1; + uint32 bMCE:1; + uint32 bCX8:1; + uint32 bAPIC:1; + uint32 bReserved1:1; + uint32 bSEP:1; + uint32 bMTRR:1; + uint32 bPGE:1; + uint32 bMCA:1; + uint32 bCMOV:1; + uint32 bPAT:1; + uint32 bPSE36:1; + uint32 bPSN:1; + uint32 bCFLUSH:1; + uint32 bReserved2:1; + uint32 bDS:1; + uint32 bACPI:1; + uint32 bMMX:1; + uint32 bFXSR:1; + uint32 bSSE:1; + uint32 bSSE2:1; + uint32 bSS:1; + uint32 bHTT:1; + uint32 bTM:1; + uint32 bReserved3:1; + uint32 bPBE:1; - DWORD DontCare2:22; - DWORD bMMXPlus:1; // AMD's MMX extensions - DWORD bMMXAgain:1; // Just a copy of bMMX above - DWORD DontCare3:6; - DWORD b3DNowPlus:1; - DWORD b3DNow:1; + uint32 DontCare2:22; + uint32 bMMXPlus:1; // AMD's MMX extensions + uint32 bMMXAgain:1; // Just a copy of bMMX above + uint32 DontCare3:6; + uint32 b3DNowPlus:1; + uint32 b3DNow:1; }; - DWORD FeatureFlags[4]; + uint32 FeatureFlags[4]; }; BYTE AMDStepping; @@ -95,7 +95,7 @@ struct CPUInfo // 92 bytes BYTE DataL1Associativity; BYTE DataL1SizeKB; }; - DWORD AMD_DataL1Info; + uint32 AMD_DataL1Info; }; };