From 80d48a08d805b4faa16ea1107f466884ae873634 Mon Sep 17 00:00:00 2001 From: omegadox Date: Mon, 6 Apr 2009 16:10:45 +0000 Subject: [PATCH] Change "BreakPoint" to "Bypass", YAGD says BP REG is a "Bypass Raster State Register" Also some cleanup in BPStructs and I think this should be SETTLUT not LOADTLUT, because there is already a LOADTLUT earlier in the reg list. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2898 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/VideoCommon/Src/BPFunctions.h | 26 ++++---- Source/Core/VideoCommon/Src/BPMemory.cpp | 6 +- Source/Core/VideoCommon/Src/BPMemory.h | 5 +- Source/Core/VideoCommon/Src/BPStructs.cpp | 66 +++++++++---------- .../Plugin_VideoDX9/Src/BPFunctions.cpp | 26 ++++---- .../Plugin_VideoOGL/Src/BPFunctions.cpp | 26 ++++---- 6 files changed, 78 insertions(+), 77 deletions(-) diff --git a/Source/Core/VideoCommon/Src/BPFunctions.h b/Source/Core/VideoCommon/Src/BPFunctions.h index 76dc49f54f..e0d252b0bc 100644 --- a/Source/Core/VideoCommon/Src/BPFunctions.h +++ b/Source/Core/VideoCommon/Src/BPFunctions.h @@ -37,23 +37,23 @@ enum }; void FlushPipeline(); -void SetGenerationMode(const BreakPoint &bp); -void SetScissor(const BreakPoint &bp); -void SetLineWidth(const BreakPoint &bp); -void SetDepthMode(const BreakPoint &bp); -void SetBlendMode(const BreakPoint &bp); -void SetDitherMode(const BreakPoint &bp); -void SetLogicOpMode(const BreakPoint &bp); -void SetColorMask(const BreakPoint &bp); +void SetGenerationMode(const Bypass &bp); +void SetScissor(const Bypass &bp); +void SetLineWidth(const Bypass &bp); +void SetDepthMode(const Bypass &bp); +void SetBlendMode(const Bypass &bp); +void SetDitherMode(const Bypass &bp); +void SetLogicOpMode(const Bypass &bp); +void SetColorMask(const Bypass &bp); float GetRendererTargetScaleX(); float GetRendererTargetScaleY(); -void CopyEFB(const BreakPoint &bp, const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 ©fmt, const bool &scaleByHalf); -void RenderToXFB(const BreakPoint &bp, const TRectangle &multirc, const float &yScale, const float &xfbLines, u8* pXFB, const u32 &dstWidth, const u32 &dstHeight); -void ClearScreen(const BreakPoint &bp, const TRectangle &multirc); -void RestoreRenderState(const BreakPoint &bp); +void CopyEFB(const Bypass &bp, const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 ©fmt, const bool &scaleByHalf); +void RenderToXFB(const Bypass &bp, const TRectangle &multirc, const float &yScale, const float &xfbLines, u8* pXFB, const u32 &dstWidth, const u32 &dstHeight); +void ClearScreen(const Bypass &bp, const TRectangle &multirc); +void RestoreRenderState(const Bypass &bp); u8 *GetPointer(const u32 &address); bool GetConfig(const int &type); -void SetSamplerState(const BreakPoint &bp); +void SetSamplerState(const Bypass &bp); }; #endif // _BPFUNCTIONS_H_ \ No newline at end of file diff --git a/Source/Core/VideoCommon/Src/BPMemory.cpp b/Source/Core/VideoCommon/Src/BPMemory.cpp index a055fbcaeb..01634c40ba 100644 --- a/Source/Core/VideoCommon/Src/BPMemory.cpp +++ b/Source/Core/VideoCommon/Src/BPMemory.cpp @@ -24,7 +24,7 @@ BPMemory bpmem; // The plugin must implement this. -void BPWritten(const BreakPoint& bp); +void BPWritten(const Bypass& bp); // Call browser: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg() void LoadBPReg(u32 value0) @@ -35,7 +35,7 @@ void LoadBPReg(u32 value0) int newval = (oldval & ~bpmem.bpMask) | (value0 & bpmem.bpMask); int changes = (oldval ^ newval) & 0xFFFFFF; - BreakPoint bp = {opcode, changes, newval}; + Bypass bp = {opcode, changes, newval}; //reset the mask register if (opcode != 0xFE) @@ -61,7 +61,7 @@ void BPReload() // Cases in which we DON'T want to reload the BP continue; default: - BreakPoint bp = {i, 0xFFFFFF, ((u32*)&bpmem)[i]}; + Bypass bp = {i, 0xFFFFFF, ((u32*)&bpmem)[i]}; BPWritten(bp); } } diff --git a/Source/Core/VideoCommon/Src/BPMemory.h b/Source/Core/VideoCommon/Src/BPMemory.h index 43e7ce114c..9ff834941f 100644 --- a/Source/Core/VideoCommon/Src/BPMemory.h +++ b/Source/Core/VideoCommon/Src/BPMemory.h @@ -62,6 +62,7 @@ #define BPMEM_COPYFILTER1 0x54 #define BPMEM_CLEARBBOX1 0x55 #define BPMEM_CLEARBBOX2 0x56 +#define BPMEM_UNKNOWN 0xFF #define BPMEM_SCISSOROFFSET 0x59 #define BPMEM_LOADTLUT0 0x64 #define BPMEM_LOADTLUT1 0x65 @@ -75,7 +76,7 @@ #define BPMEM_TX_SETIMAGE1 0x8C // 0x8C + 4 #define BPMEM_TX_SETIMAGE2 0x90 // 0x90 + 4 #define BPMEM_TX_SETIMAGE3 0x94 // 0x94 + 4 -#define BPMEM_TX_LOADTLUT_0 0x98 // 0x98 + 4, This smells wrong, I think it should be SET +#define BPMEM_TX_SETTLUT 0x98 // 0x98 + 4 #define BPMEM_TX_SETMODE0_4 0xA0 // 0xA0 + 4 #define BPMEM_TX_SETMODE1_4 0xA4 // 0xA4 + 4 #define BPMEM_TX_SETIMAGE0_4 0xA8 // 0xA8 + 4 @@ -821,7 +822,7 @@ union UPE_Copy // All of BP memory ////////////////////////////////////////////////////////////////////////// -struct BreakPoint +struct Bypass { int address; int changes; diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index 82463df07a..6d9419449d 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -37,7 +37,7 @@ void BPInit() } // ---------------------------------------------------------------------------------------------------------- -// Write to the BreakPoint Memory +// Write to the Bypass Memory /* ------------------ Called: At the end of every: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg @@ -46,7 +46,7 @@ void BPInit() getting rid of dynamic dispatch. Unfortunately, few games use DLs properly - most\ just stuff geometry in them and don't put state changes there. */ // ---------------------------------------------------------------------------------------------------------- -void BPWritten(const BreakPoint& bp) +void BPWritten(const Bypass& bp) { // -------------------------------------------------------------------------------------------------------- @@ -324,6 +324,7 @@ void BPWritten(const BreakPoint& bp) case BPMEM_BP_MASK: // Masks case BPMEM_IND_IMASK: break; + case BPMEM_UNKNOWN: // This is always set to 0xF at boot of any game, so this sounds like a useless reg // ------------------------------------------------ // On Default, we try to look for other things @@ -341,6 +342,8 @@ void BPWritten(const BreakPoint& bp) case BPMEM_TREF+6: case BPMEM_TREF+7: break; + // ------------------------------------- + // This could be Level Of Detail control for Wrap case BPMEM_SU_SSIZE: // Texture Wrap Size U? case BPMEM_SU_TSIZE: // Texture Wrap Size V? case BPMEM_SU_SSIZE+2: @@ -366,57 +369,54 @@ void BPWritten(const BreakPoint& bp) case BPMEM_TX_SETMODE1+1: case BPMEM_TX_SETMODE1+2: case BPMEM_TX_SETMODE1+3: + case BPMEM_TX_SETMODE0_4: + case BPMEM_TX_SETMODE0_4+1: + case BPMEM_TX_SETMODE0_4+2: + case BPMEM_TX_SETMODE0_4+3: + case BPMEM_TX_SETMODE1_4: + case BPMEM_TX_SETMODE1_4+1: + case BPMEM_TX_SETMODE1_4+2: + case BPMEM_TX_SETMODE1_4+3: SetSamplerState(bp); break; - case BPMEM_TX_SETIMAGE0: // Texture Size ? + case BPMEM_TX_SETIMAGE0: case BPMEM_TX_SETIMAGE0+1: case BPMEM_TX_SETIMAGE0+2: case BPMEM_TX_SETIMAGE0+3: + case BPMEM_TX_SETIMAGE0_4: + case BPMEM_TX_SETIMAGE0_4+1: + case BPMEM_TX_SETIMAGE0_4+2: + case BPMEM_TX_SETIMAGE0_4+3: case BPMEM_TX_SETIMAGE1: case BPMEM_TX_SETIMAGE1+1: case BPMEM_TX_SETIMAGE1+2: case BPMEM_TX_SETIMAGE1+3: + case BPMEM_TX_SETIMAGE1_4: + case BPMEM_TX_SETIMAGE1_4+1: + case BPMEM_TX_SETIMAGE1_4+2: + case BPMEM_TX_SETIMAGE1_4+3: case BPMEM_TX_SETIMAGE2: case BPMEM_TX_SETIMAGE2+1: case BPMEM_TX_SETIMAGE2+2: case BPMEM_TX_SETIMAGE2+3: + case BPMEM_TX_SETIMAGE2_4: + case BPMEM_TX_SETIMAGE2_4+1: + case BPMEM_TX_SETIMAGE2_4+2: + case BPMEM_TX_SETIMAGE2_4+3: case BPMEM_TX_SETIMAGE3: // Texture Pointer case BPMEM_TX_SETIMAGE3+1: case BPMEM_TX_SETIMAGE3+2: case BPMEM_TX_SETIMAGE3+3: - break; - case BPMEM_TX_LOADTLUT_0: // wtf? Load TLUT 0 here ?? (THIS HAS TO BE SET TLUT NOT LOAD TLUT !! :P, mistake found in YAGD!) - case BPMEM_TX_LOADTLUT_0+1: - case BPMEM_TX_LOADTLUT_0+2: - case BPMEM_TX_LOADTLUT_0+3: - break; - case BPMEM_TX_SETMODE0_4: // This is Mode 0 for Index 5 to 8 - case BPMEM_TX_SETMODE0_4+1: - case BPMEM_TX_SETMODE0_4+2: - case BPMEM_TX_SETMODE0_4+3: - case BPMEM_TX_SETMODE1_4: // This is Mode 1 for Index 5 to 8 - case BPMEM_TX_SETMODE1_4+1: - case BPMEM_TX_SETMODE1_4+2: - case BPMEM_TX_SETMODE1_4+3: - break; - case BPMEM_TX_SETIMAGE0_4: // This is Image 0 for Index 5 to 8 - case BPMEM_TX_SETIMAGE0_4+1: - case BPMEM_TX_SETIMAGE0_4+2: - case BPMEM_TX_SETIMAGE0_4+3: - case BPMEM_TX_SETIMAGE1_4: // This is Image 1 for Index 5 to 8 - case BPMEM_TX_SETIMAGE1_4+1: - case BPMEM_TX_SETIMAGE1_4+2: - case BPMEM_TX_SETIMAGE1_4+3: - case BPMEM_TX_SETIMAGE2_4: // This is Image 2 for Index 5 to 8 - case BPMEM_TX_SETIMAGE2_4+1: - case BPMEM_TX_SETIMAGE2_4+2: - case BPMEM_TX_SETIMAGE2_4+3: - case BPMEM_TX_SETIMAGE3_4: // This is Image 3 for Index 5 to 8 + case BPMEM_TX_SETIMAGE3_4: case BPMEM_TX_SETIMAGE3_4+1: case BPMEM_TX_SETIMAGE3_4+2: case BPMEM_TX_SETIMAGE3_4+3: break; - case BPMEM_TX_SETLUT_4: // This is Setting TLUT for Index 5 to 8 + case BPMEM_TX_SETTLUT: + case BPMEM_TX_SETTLUT+1: + case BPMEM_TX_SETTLUT+2: + case BPMEM_TX_SETTLUT+3: + case BPMEM_TX_SETLUT_4: case BPMEM_TX_SETLUT_4+1: case BPMEM_TX_SETLUT_4+2: case BPMEM_TX_SETLUT_4+3: @@ -495,7 +495,7 @@ void BPWritten(const BreakPoint& bp) case BPMEM_TEV_ALPHA_ENV+32: break; default: - WARN_LOG(VIDEO, "Unknown BreakPoint opcode: address = %08x value = %08x", bp.address, bp.newvalue); + WARN_LOG(VIDEO, "Unknown Bypass opcode: address = %08x value = %08x", bp.address, bp.newvalue); } } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/BPFunctions.cpp b/Source/Plugins/Plugin_VideoDX9/Src/BPFunctions.cpp index 5bc3e44103..99b5491df3 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/BPFunctions.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/BPFunctions.cpp @@ -100,7 +100,7 @@ void FlushPipeline() VertexManager::Flush(); } -void SetGenerationMode(const BreakPoint &bp) +void SetGenerationMode(const Bypass &bp) { // dev->SetRenderState(D3DRS_CULLMODE, d3dCullModes[bpmem.genMode.cullmode]); Renderer::SetRenderState(D3DRS_CULLMODE, d3dCullModes[bpmem.genMode.cullmode]); @@ -123,17 +123,17 @@ void SetGenerationMode(const BreakPoint &bp) } } -void SetScissor(const BreakPoint &bp) +void SetScissor(const Bypass &bp) { Renderer::SetScissorRect(); } -void SetLineWidth(const BreakPoint &bp) +void SetLineWidth(const Bypass &bp) { // We can't change line width in D3D unless we use ID3DXLine float psize = float(bpmem.lineptwidth.pointsize) * 6.0f; Renderer::SetRenderState(D3DRS_POINTSIZE, *((DWORD*)&psize)); } -void SetDepthMode(const BreakPoint &bp) +void SetDepthMode(const Bypass &bp) { if (bpmem.zmode.testenable) { @@ -159,7 +159,7 @@ void SetDepthMode(const BreakPoint &bp) // Renderer::SetRenderMode(Renderer::RM_Normal); } -void SetBlendMode(const BreakPoint &bp) +void SetBlendMode(const Bypass &bp) { if (bp.changes & 1) Renderer::SetRenderState(D3DRS_ALPHABLENDENABLE, bpmem.blendmode.blendenable); @@ -196,15 +196,15 @@ void SetBlendMode(const BreakPoint &bp) Renderer::SetRenderState(D3DRS_BLENDOP, bpmem.blendmode.subtract ? D3DBLENDOP_SUBTRACT : D3DBLENDOP_ADD); } } -void SetDitherMode(const BreakPoint &bp) +void SetDitherMode(const Bypass &bp) { Renderer::SetRenderState(D3DRS_DITHERENABLE,bpmem.blendmode.dither); } -void SetLogicOpMode(const BreakPoint &bp) +void SetLogicOpMode(const Bypass &bp) { // Logic op blending. D3D can't do this but can fake some modes. } -void SetColorMask(const BreakPoint &bp) +void SetColorMask(const Bypass &bp) { DWORD write = 0; if (bpmem.blendmode.alphaupdate) @@ -222,19 +222,19 @@ float GetRendererTargetScaleY() { return Renderer::GetYScale(); } -void CopyEFB(const BreakPoint &bp, const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 ©fmt, const bool &scaleByHalf) +void CopyEFB(const Bypass &bp, const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 ©fmt, const bool &scaleByHalf) { RECT rec = { rc.left, rc.top, rc.right, rc.bottom }; TextureCache::CopyEFBToRenderTarget(bpmem.copyTexDest<<5, &rec); } -void RenderToXFB(const BreakPoint &bp, const TRectangle &multirc, const float &yScale, const float &xfbLines, u8* pXFB, const u32 &dstWidth, const u32 &dstHeight) +void RenderToXFB(const Bypass &bp, const TRectangle &multirc, const float &yScale, const float &xfbLines, u8* pXFB, const u32 &dstWidth, const u32 &dstHeight) { Renderer::SwapBuffers(); PRIM_LOG("Renderer::SwapBuffers()"); g_VideoInitialize.pCopiedToXFB(); } -void ClearScreen(const BreakPoint &bp, const TRectangle &multirc) +void ClearScreen(const Bypass &bp, const TRectangle &multirc) { // it seems that the GC is able to alpha blend on color-fill // we cant do that so if alpha is != 255 we skip it @@ -266,7 +266,7 @@ void ClearScreen(const BreakPoint &bp, const TRectangle &multirc) D3D::dev->Clear(0, NULL, clearflags, col, clearZ, 0); } -void RestoreRenderState(const BreakPoint &bp) +void RestoreRenderState(const Bypass &bp) { //Renderer::SetRenderMode(Renderer::RM_Normal); } @@ -290,7 +290,7 @@ u8 *GetPointer(const u32 &address) { return g_VideoInitialize.pGetMemoryPointer(address); } -void SetSamplerState(const BreakPoint &bp) +void SetSamplerState(const Bypass &bp) { FourTexUnits &tex = bpmem.tex[(bp.address & 0xE0) == 0xA0]; int stage = (bp.address & 3);//(addr>>4)&2; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/BPFunctions.cpp b/Source/Plugins/Plugin_VideoOGL/Src/BPFunctions.cpp index 72f75344fc..d27c236db3 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/BPFunctions.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/BPFunctions.cpp @@ -47,7 +47,7 @@ void FlushPipeline() { VertexManager::Flush(); } -void SetGenerationMode(const BreakPoint &bp) +void SetGenerationMode(const Bypass &bp) { // none, ccw, cw, ccw if (bpmem.genMode.cullmode > 0) @@ -60,13 +60,13 @@ void SetGenerationMode(const BreakPoint &bp) } -void SetScissor(const BreakPoint &bp) +void SetScissor(const Bypass &bp) { if (!Renderer::SetScissorRect()) if (bp.address == BPMEM_SCISSORBR) ERROR_LOG(VIDEO, "bad scissor!"); } -void SetLineWidth(const BreakPoint &bp) +void SetLineWidth(const Bypass &bp) { float fratio = xfregs.rawViewport[0] != 0 ? ((float)Renderer::GetTargetWidth() / EFB_WIDTH) : 1.0f; if (bpmem.lineptwidth.linesize > 0) @@ -74,7 +74,7 @@ void SetLineWidth(const BreakPoint &bp) if (bpmem.lineptwidth.pointsize > 0) glPointSize((float)bpmem.lineptwidth.pointsize * fratio / 6.0f); } -void SetDepthMode(const BreakPoint &bp) +void SetDepthMode(const Bypass &bp) { if (bpmem.zmode.testenable) { @@ -92,18 +92,18 @@ void SetDepthMode(const BreakPoint &bp) if (!bpmem.zmode.updateenable) Renderer::SetRenderMode(Renderer::RM_Normal); } -void SetBlendMode(const BreakPoint &bp) +void SetBlendMode(const Bypass &bp) { Renderer::SetBlendMode(false); } -void SetDitherMode(const BreakPoint &bp) +void SetDitherMode(const Bypass &bp) { if (bpmem.blendmode.dither) glEnable(GL_DITHER); else glDisable(GL_DITHER); } -void SetLogicOpMode(const BreakPoint &bp) +void SetLogicOpMode(const Bypass &bp) { if (bpmem.blendmode.logicopenable) { @@ -113,7 +113,7 @@ void SetLogicOpMode(const BreakPoint &bp) else glDisable(GL_COLOR_LOGIC_OP); } -void SetColorMask(const BreakPoint &bp) +void SetColorMask(const Bypass &bp) { Renderer::SetColorMask(); } @@ -125,7 +125,7 @@ float GetRendererTargetScaleY() { return Renderer::GetTargetScaleY(); } -void CopyEFB(const BreakPoint &bp, const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 ©fmt, const bool &scaleByHalf) +void CopyEFB(const Bypass &bp, const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 ©fmt, const bool &scaleByHalf) { // bpmem.zcontrol.pixel_format to PIXELFMT_Z24 is when the game wants to copy from ZBuffer (Zbuffer uses 24-bit Format) if (!g_Config.bEFBCopyDisable) @@ -135,7 +135,7 @@ void CopyEFB(const BreakPoint &bp, const TRectangle &rc, const u32 &address, con TextureMngr::CopyRenderTargetToTexture(address, fromZBuffer, isIntensityFmt, copyfmt, scaleByHalf, rc); } -void RenderToXFB(const BreakPoint &bp, const TRectangle &multirc, const float &yScale, const float &xfbLines, u8* pXFB, const u32 &dstWidth, const u32 &dstHeight) +void RenderToXFB(const Bypass &bp, const TRectangle &multirc, const float &yScale, const float &xfbLines, u8* pXFB, const u32 &dstWidth, const u32 &dstHeight) { // EFB to XFB if (g_Config.bUseXFB) @@ -158,7 +158,7 @@ void RenderToXFB(const BreakPoint &bp, const TRectangle &multirc, const float &y } g_VideoInitialize.pCopiedToXFB(); } -void ClearScreen(const BreakPoint &bp, const TRectangle &multirc) +void ClearScreen(const Bypass &bp, const TRectangle &multirc) { // Clear color @@ -224,7 +224,7 @@ void ClearScreen(const BreakPoint &bp, const TRectangle &multirc) } } -void RestoreRenderState(const BreakPoint &bp) +void RestoreRenderState(const Bypass &bp) { Renderer::RestoreGLState(); } @@ -248,7 +248,7 @@ u8 *GetPointer(const u32 &address) { return g_VideoInitialize.pGetMemoryPointer(address); } -void SetSamplerState(const BreakPoint &bp) +void SetSamplerState(const Bypass &bp) { // TODO }