diff options
| author | hrydgard <hrydgard@gmail.com> | 2009-06-28 20:04:07 +0000 |
|---|---|---|
| committer | hrydgard <hrydgard@gmail.com> | 2009-06-28 20:04:07 +0000 |
| commit | 3d9279a73f15667e94267820b0bc926394cefaa0 (patch) | |
| tree | 9dfc99dde26bee7c950c38cd8996cb20c5f82f91 /Source/Core/VideoCommon/Src/BPStructs.cpp | |
| parent | faa63713e2a645cc053c46967f24dbe79222ad35 (diff) | |
Graphics: (faked) bounding box support. Helps some Paper Mario effects although they're still a bit glitchy. Might also help other games? Enable with the #define in VideoCommon.h. Since there might be a speed hit it's off by default.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3580 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon/Src/BPStructs.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/BPStructs.cpp | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index 74c53906af..7773773439 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -211,7 +211,12 @@ void BPWritten(const Bypass& bp) }
else
{
+ // 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
+ *g_VideoInitialize.pBBoxActive = false;
+#endif
const float yScale = bpmem.dispcopyyscale / 256.0f;
const float xfbLines = ((bpmem.copyTexSrcWH.y + 1.0f) * yScale);
RenderToXFB(bp, multirc, yScale, xfbLines,
@@ -324,13 +329,35 @@ void BPWritten(const Bypass& bp) case BPMEM_CLEAR_Z: // Z Components (24-bit Zbuffer)
break;
// -------------------------
- // Culling Occulsion, we don't support this
- // let's hope not many games use bboxes..
- // TODO(ector): add something that watches bboxes
+ // Bounding Box support
// -------------------------
case BPMEM_CLEARBBOX1:
- case BPMEM_CLEARBBOX2:
+ 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;
+
+ // We should only set these if bbox is calculated properly.
+ g_VideoInitialize.pBBox[0] = left;
+ g_VideoInitialize.pBBox[1] = right;
+ *g_VideoInitialize.pBBoxActive = 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.
+ g_VideoInitialize.pBBox[2] = top;
+ g_VideoInitialize.pBBox[3] = bottom;
+ *g_VideoInitialize.pBBoxActive = true;
+ // WARN_LOG(VIDEO, "ClearBBox TB: %i, %08x - %i, %i", bp.address, bp.newvalue, top, bottom);
+ }
+#endif
break;
+ }
case BPMEM_ZCOMPARE: // Set the Z-Compare
case BPMEM_TEXINVALIDATE: // Used, if game has manual control the Texture Cache, which we don't allow
case BPMEM_MIPMAP_STRIDE: // MipMap Stride Channel
@@ -363,14 +390,14 @@ void BPWritten(const Bypass& bp) PanicAlert("Unknown is not 0xF! val = 0x%08x", bp.newvalue);
break;
- // Cases added due to: http://code.google.com/p/dolphin-emu/issues/detail?id=360#c90
- // Are these related to BBox?
case BPMEM_UNKNOWN1:
case BPMEM_UNKNOWN2:
case BPMEM_UNKNOWN3:
case BPMEM_UNKNOWN4:
-
+ // Cases added due to: http://code.google.com/p/dolphin-emu/issues/detail?id=360#c90
+ // Are these related to BBox?
break;
+
// ------------------------------------------------
// On Default, we try to look for other things
// before we give up and say its an unknown opcode
|
