diff options
Diffstat (limited to 'Source/Core/VideoCommon/Src/BPStructs.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/BPStructs.cpp | 77 |
1 files changed, 45 insertions, 32 deletions
diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index 42b5b2212a..6cb102555b 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -30,6 +30,7 @@ #include "VertexLoader.h" #include "VertexShaderManager.h" #include "Thread.h" +#include "HW/Memmap.h" using namespace BPFunctions; @@ -37,6 +38,8 @@ u32 mapTexAddress; bool mapTexFound; int numWrites; +extern volatile bool g_bSkipCurrentFrame; + static const float s_gammaLUT[] = { 1.0f, @@ -162,7 +165,7 @@ void BPWritten(const BPCmd& bp) case BPMEM_SCISSORTL: // Scissor Rectable Top, Left case BPMEM_SCISSORBR: // Scissor Rectable Bottom, Right case BPMEM_SCISSOROFFSET: // Scissor Offset - SetScissor(bp); + SetScissor(); break; case BPMEM_LINEPTWIDTH: // Line Width SetLineWidth(bp); @@ -257,9 +260,8 @@ void BPWritten(const BPCmd& bp) // We should be able to get away with deactivating the current bbox tracking // here. Not sure if there's a better spot to put this. // the number of lines copied is determined by the y scale * source efb height -#ifdef BBOX_SUPPORT + PixelEngine::bbox_active = false; -#endif float yScale; if (PE_copy.scale_invert) @@ -300,14 +302,14 @@ void BPWritten(const BPCmd& bp) // TODO - figure out a cleaner way. if (GetConfig(CONFIG_ISWII)) - ptr = GetPointer(bpmem.tlutXferSrc << 5); + ptr = GetPointer(bpmem.tmem_config.tlut_src << 5); else - ptr = GetPointer((bpmem.tlutXferSrc & 0xFFFFF) << 5); + ptr = GetPointer((bpmem.tmem_config.tlut_src & 0xFFFFF) << 5); if (ptr) memcpy_gc(texMem + tlutTMemAddr, ptr, tlutXferCount); else - PanicAlert("Invalid palette pointer %08x %08x %08x", bpmem.tlutXferSrc, bpmem.tlutXferSrc << 5, (bpmem.tlutXferSrc & 0xFFFFF)<< 5); + PanicAlert("Invalid palette pointer %08x %08x %08x", bpmem.tmem_config.tlut_src, bpmem.tmem_config.tlut_src << 5, (bpmem.tmem_config.tlut_src & 0xFFFFF)<< 5); // TODO(ector) : kill all textures that use this palette // Not sure if it's a good idea, though. For now, we hash texture palettes @@ -400,28 +402,31 @@ void BPWritten(const BPCmd& bp) case BPMEM_CLEARBBOX1: case BPMEM_CLEARBBOX2: { -#ifdef BBOX_SUPPORT - // which is which? these are GUESSES! - if (bp.address == BPMEM_CLEARBBOX1) { - int right = bp.newvalue >> 10; - int left = bp.newvalue & 0x3ff; + if(g_ActiveConfig.bUseBBox) + { + // Don't compute bounding box if this frame is being skipped! + // Wrong but valid values are better than bogus values... + if(g_bSkipCurrentFrame) + break; + + if (bp.address == BPMEM_CLEARBBOX1) { + int right = bp.newvalue >> 10; + int left = bp.newvalue & 0x3ff; - // We should only set these if bbox is calculated properly. - PixelEngine::bbox[0] = left; - PixelEngine::bbox[1] = right; - PixelEngine::bbox_active = true; - // WARN_LOG(VIDEO, "ClearBBox LR: %i, %08x - %i, %i", bp.address, bp.newvalue, left, right); - } else { - int bottom = bp.newvalue >> 10; - int top = bp.newvalue & 0x3ff; - - // We should only set these if bbox is calculated properly. - PixelEngine::bbox[2] = top; - PixelEngine::bbox[3] = bottom; - PixelEngine::bbox_active = true; - // WARN_LOG(VIDEO, "ClearBBox TB: %i, %08x - %i, %i", bp.address, bp.newvalue, top, bottom); + // We should only set these if bbox is calculated properly. + PixelEngine::bbox[0] = left; + PixelEngine::bbox[1] = right; + PixelEngine::bbox_active = true; + } else { + int bottom = bp.newvalue >> 10; + int top = bp.newvalue & 0x3ff; + + // We should only set these if bbox is calculated properly. + PixelEngine::bbox[2] = top; + PixelEngine::bbox[3] = bottom; + PixelEngine::bbox_active = true; + } } -#endif } break; case BPMEM_TEXINVALIDATE: // Used, if game has manual control the Texture Cache, which we don't allow @@ -462,14 +467,22 @@ void BPWritten(const BPCmd& bp) DEBUG_LOG(VIDEO, "Uknown BP Reg 0x57: %08x", bp.newvalue); break; - case BPMEM_UNKNOWN_60: - case BPMEM_UNKNOWN_61: - case BPMEM_UNKNOWN_62: - // Cases added due to: http://code.google.com/p/dolphin-emu/issues/detail?id=360#c90 - // Are these related to BBox? + case BPMEM_PRELOAD_ADDR: + case BPMEM_PRELOAD_TMEMEVEN: + case BPMEM_PRELOAD_TMEMODD: // Used when PRELOAD_MODE is set break; - case BPMEM_TEXMODESYNC: // Always set to 0 when GX_TexModeSync() is called. + case BPMEM_PRELOAD_MODE: // Set to 0 when GX_TexModeSync() is called. + // if this is different from 0, manual TMEM management is used. + if (bp.newvalue != 0) + { + // NOTE(neobrain): Apparently tmemodd doesn't affect hardware behavior at all (libogc uses it just as a buffer and switches its contents with tmemeven whenever this is called) + BPS_TmemConfig& tmem_cfg = bpmem.tmem_config; + u8* ram_ptr = Memory::GetPointer(tmem_cfg.preload_addr << 5); + u32 tmem_addr = tmem_cfg.preload_tmem_even * TMEM_LINE_SIZE; + u32 size = tmem_cfg.preload_tile_info.count * 32; + memcpy(texMem + tmem_addr, ram_ptr, size); + } break; // ------------------------------------------------ |
