From 652639d1c465df720d264d0e518e4a63f1b542d4 Mon Sep 17 00:00:00 2001 From: "sl1nk3.s" Date: Sat, 22 Aug 2009 13:22:35 +0000 Subject: [PATCH] Fix GXPeekARGB, this fixes Killer 7, and Wind Waker's pictograph quest :D git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4034 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/Memmap.h | 12 +++++------- Source/Core/VideoCommon/Src/XFStructs.cpp | 8 ++++++-- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 17 ++++++++++------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/Source/Core/Core/Src/HW/Memmap.h b/Source/Core/Core/Src/HW/Memmap.h index ab5af5f807..b3da643916 100644 --- a/Source/Core/Core/Src/HW/Memmap.h +++ b/Source/Core/Core/Src/HW/Memmap.h @@ -18,17 +18,15 @@ #ifndef _MEMMAP_H #define _MEMMAP_H -// Enable memory checks in the Debug/DebugFast builds, but NOT in release -#if MAX_LOGLEVEL >= 4 -#if _DEBUG - #define ENABLE_MEM_CHECK -#endif -#endif - // Includes #include #include "Common.h" +// Enable memory checks in the Debug/DebugFast builds, but NOT in release +#if _DEBUG || DEBUGFAST + #define ENABLE_MEM_CHECK +#endif + // Global declarations class PointerWrap; diff --git a/Source/Core/VideoCommon/Src/XFStructs.cpp b/Source/Core/VideoCommon/Src/XFStructs.cpp index 7b8ca915e7..9a96c3294a 100644 --- a/Source/Core/VideoCommon/Src/XFStructs.cpp +++ b/Source/Core/VideoCommon/Src/XFStructs.cpp @@ -190,8 +190,12 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData) case 0x1016: case 0x1017: - case 0x101c: // paper mario writes 16777216.0f, 1677721.75 - case 0x101f: // paper mario writes 16777216.0f, 5033165.0f + case 0x101c: + // paper mario writes 16777216.0f, 1677721.75 + // Killer 7 writes 0x4b800000 here on 3D rendering only + case 0x101f: + // paper mario writes 16777216.0f, 5033165.0f + // Killer 7 alterns this between 0x4b800000 and 0x4b7ef9db on 3D rendering default: WARN_LOG(VIDEO, "Unknown XF Reg: %x=%x\n", address, data); break; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 6a8d7fd36e..539ba0d643 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -564,6 +564,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y) TargetRectangle targetPixelRc = Renderer::ConvertEFBRectangle(efbPixelRc); + // TODO (FIX) : currently, AA path is broken/offset and doesn't return the correct pixel switch (type) { @@ -593,10 +594,13 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y) // TODO: Implement break; - case PEEK_COLOR: + case PEEK_COLOR: // GXPeekARGB { - // TODO: Find some way to test PEEK_COLOR. Wind Waker may be using it - // for pictograph quests. + // Although it may sound strange, this really is A8R8G8B8 and not RGBA or 24-bit... + + // Tested in Killer 7, the first 8bits represent the alpha value which is used to + // determine if we're aiming at an enemy (0x80 / 0x88) or not (0x70) + // Wind Waker is also using it for the pictograph to determine the color of each pixel if (s_MSAASamples > 1) { @@ -609,13 +613,12 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y) int srcX = (targetPixelRc.left + targetPixelRc.right) / 2; int srcY = (targetPixelRc.top + targetPixelRc.bottom) / 2; - // Read back pixel in BGRA format, then byteswap to get GameCube's - // ARGB format. + // Read back pixel in BGRA format, then byteswap to get GameCube's ARGB Format. u32 color = 0; - glReadPixels(srcX, srcY, 1, 1, GL_BGRA, GL_UNSIGNED_BYTE, &color); + glReadPixels(srcX, srcY, 1, 1, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, &color); GL_REPORT_ERRORD(); - return Common::swap32(color); + return color; } case POKE_COLOR: