From 45415e10573706187fb33505f8ec7a0666dabd36 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 13 Jan 2017 17:07:26 -0500 Subject: [PATCH] ColorUtil: Make decodeCI8image's pal parameter const --- Source/Core/Common/ColorUtil.cpp | 2 +- Source/Core/Common/ColorUtil.h | 2 +- Source/Core/Core/HW/GCMemcard.cpp | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Source/Core/Common/ColorUtil.cpp b/Source/Core/Common/ColorUtil.cpp index fafdcf227f..b859f843f8 100644 --- a/Source/Core/Common/ColorUtil.cpp +++ b/Source/Core/Common/ColorUtil.cpp @@ -58,7 +58,7 @@ void decode5A3image(u32* dst, const u16* src, int width, int height) } } -void decodeCI8image(u32* dst, const u8* src, u16* pal, int width, int height) +void decodeCI8image(u32* dst, const u8* src, const u16* pal, int width, int height) { for (int y = 0; y < height; y += 4) { diff --git a/Source/Core/Common/ColorUtil.h b/Source/Core/Common/ColorUtil.h index 8b17919ec3..1c90245a7b 100644 --- a/Source/Core/Common/ColorUtil.h +++ b/Source/Core/Common/ColorUtil.h @@ -9,6 +9,6 @@ namespace ColorUtil { void decode5A3image(u32* dst, const u16* src, int width, int height); -void decodeCI8image(u32* dst, const u8* src, u16* pal, int width, int height); +void decodeCI8image(u32* dst, const u8* src, const u16* pal, int width, int height); } // namespace diff --git a/Source/Core/Core/HW/GCMemcard.cpp b/Source/Core/Core/HW/GCMemcard.cpp index 85a26e4ac8..5b04adac4c 100644 --- a/Source/Core/Core/HW/GCMemcard.cpp +++ b/Source/Core/Core/HW/GCMemcard.cpp @@ -1160,8 +1160,7 @@ u32 GCMemcard::ReadAnimRGBA8(u8 index, u32* buffer, u8* delays) const } } - u16* sharedPal = (u16*)(animData); - int j = 0; + const u16* sharedPal = reinterpret_cast(animData); for (int i = 0; i < 8; i++) { @@ -1183,7 +1182,7 @@ u32 GCMemcard::ReadAnimRGBA8(u8 index, u32* buffer, u8* delays) const buffer += 32 * 32; break; case CI8: // CI8 with own palette - u16* paldata = (u16*)(data[i] + 32 * 32); + const u16* paldata = reinterpret_cast(data[i] + 32 * 32); ColorUtil::decodeCI8image(buffer, data[i], paldata, 32, 32); buffer += 32 * 32; break; @@ -1194,7 +1193,7 @@ u32 GCMemcard::ReadAnimRGBA8(u8 index, u32* buffer, u8* delays) const // Speed is set but there's no actual icon // This is used to reduce animation speed in Pikmin and Luigi's Mansion for example // These "blank frames" show the next icon - for (j = i; j < 8; ++j) + for (int j = i; j < 8; ++j) { if (fmts[j] != 0) { @@ -1208,7 +1207,7 @@ u32 GCMemcard::ReadAnimRGBA8(u8 index, u32* buffer, u8* delays) const buffer += 32 * 32; break; case CI8: // CI8 with own palette - u16* paldata = (u16*)(data[j] + 32 * 32); + const u16* paldata = reinterpret_cast(data[j] + 32 * 32); ColorUtil::decodeCI8image(buffer, data[j], paldata, 32, 32); buffer += 32 * 32; break;