Direct3D9 plugin now uses BPFunctions and removed its BPStructs. Some cleanup and commenting in BPStructs.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2897 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
omegadox 2009-04-06 15:24:40 +00:00
parent c126c5a9f9
commit 67834f960e
8 changed files with 227 additions and 1358 deletions

View file

@ -37,24 +37,23 @@ enum
};
void FlushPipeline();
void SetGenerationMode();
void SetGenerationMode(const BreakPoint &bp);
void SetScissor(const BreakPoint &bp);
void SetLineWidth();
void SetDepthMode();
void SetBlendMode();
void SetDitherMode();
void SetLogicOpMode();
void SetColorMask();
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);
float GetRendererTargetScaleX();
float GetRendererTargetScaleY();
void CopyEFB(const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 &copyfmt, const bool &scaleByHalf);
void RenderToXFB(const TRectangle &multirc, const float &yScale, const float &xfbLines, u8* pXFB, const u32 &dstWidth, const u32 &dstHeight);
void ClearScreen(const TRectangle &multirc);
void RestoreRenderState();
void SetScissorRectangle();
void CopyEFB(const BreakPoint &bp, const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 &copyfmt, 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);
u8 *GetPointer(const u32 &address);
bool GetConfig(const int &type);
void SetSamplerState(const BreakPoint &bp);
};
#endif // _BPFUNCTIONS_H_

View file

@ -15,6 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <cmath>
#include "Profiler.h"
#include "Statistics.h"
#include "VideoCommon.h"
@ -46,27 +48,28 @@ void BPInit()
// ----------------------------------------------------------------------------------------------------------
void BPWritten(const BreakPoint& bp)
{
// If nothing changed, return
//if ((bp.changes == 0 ? false : true))
// return;
// Flush the pipeline then update the BreakPoint Memory
// --------------------------------------------------------------------------------------------------------
// First the pipeline is flushed then update the bpmem with the new value.
// Some of the BP cases have to call certain functions while others just update the bpmem.
// some bp cases check the changes variable, because they might not have to be updated all the time
// NOTE: it seems not all bp cases like checking changes, so calling if (bp.changes == 0 ? false : true)
// had to be ditched and the games seem to work fine with out it.
// --------------------------------------------------------------------------------------------------------
FlushPipeline();
((u32*)&bpmem)[bp.address] = bp.newvalue;
switch (bp.address)
{
// -----------------------------------------------------
// BPs that calls other code besides updating the memory
// -----------------------------------------------------
case BPMEM_GENMODE:
case BPMEM_GENMODE: // Set the Generation Mode
PRIM_LOG("genmode: texgen=%d, col=%d, ms_en=%d, tev=%d, culmode=%d, ind=%d, zfeeze=%d",
bpmem.genMode.numtexgens, bpmem.genMode.numcolchans,
bpmem.genMode.ms_en, bpmem.genMode.numtevstages+1, bpmem.genMode.cullmode,
bpmem.genMode.numindstages, bpmem.genMode.zfreeze);
SetGenerationMode();
SetGenerationMode(bp);
break;
case BPMEM_IND_MTXA:
case BPMEM_IND_MTXA: // Index Matrix Changed
case BPMEM_IND_MTXB:
case BPMEM_IND_MTXC:
case BPMEM_IND_MTXA+3:
@ -83,17 +86,18 @@ void BPWritten(const BreakPoint& bp)
break;
case BPMEM_SCISSORTL: // Scissor Rectable Top, Left
case BPMEM_SCISSORBR: // Scissor Rectable Bottom, Right
case BPMEM_SCISSOROFFSET: // Scissor Offset
SetScissor(bp);
break;
case BPMEM_LINEPTWIDTH:
SetLineWidth();
case BPMEM_LINEPTWIDTH: // Line Width
SetLineWidth(bp);
break;
case BPMEM_ZMODE:
case BPMEM_ZMODE: // Depth Control
PRIM_LOG("zmode: test=%d, func=%d, upd=%d", bpmem.zmode.testenable, bpmem.zmode.func,
bpmem.zmode.updateenable);
SetDepthMode();
SetDepthMode(bp);
break;
case BPMEM_BLENDMODE:
case BPMEM_BLENDMODE: // Blending Control
if (bp.changes & 0xFFFF)
{
PRIM_LOG("blendmode: en=%d, open=%d, colupd=%d, alphaupd=%d, dst=%d, src=%d, sub=%d, mode=%d",
@ -103,37 +107,37 @@ void BPWritten(const BreakPoint& bp)
if (bp.changes & 2)
{
SETSTAT(stats.logicOpMode, bpmem.blendmode.logicopenable != 0 ? bpmem.blendmode.logicmode : stats.logicOpMode);
SetLogicOpMode();
SetLogicOpMode(bp);
}
// Set Dithering Mode
if (bp.changes & 4)
{
SETSTAT(stats.dither, bpmem.blendmode.dither);
SetDitherMode();
SetDitherMode(bp);
}
// Set Blending Mode
if (bp.changes & 0xFE1)
{
SETSTAT(stats.srcFactor, bpmem.blendmode.srcfactor);
SETSTAT(stats.dstFactor, bpmem.blendmode.dstfactor);
SetBlendMode();
SetBlendMode(bp);
}
// Set Color Mask
if (bp.changes & 0x18)
{
SETSTAT(stats.alphaUpdate, bpmem.blendmode.alphaupdate);
SETSTAT(stats.colorUpdate, bpmem.blendmode.colorupdate);
SetColorMask();
SetColorMask(bp);
}
}
break;
case BPMEM_CONSTANTALPHA:
case BPMEM_CONSTANTALPHA: // Set Destination Alpha
PRIM_LOG("constalpha: alp=%d, en=%d", bpmem.dstalpha.alpha, bpmem.dstalpha.enable);
SETSTAT(stats.dstAlphaEnable, bpmem.dstalpha.enable);
SETSTAT_UINT(stats.dstAlpha, bpmem.dstalpha.alpha);
PixelShaderManager::SetDestAlpha(bpmem.dstalpha);
break;
case BPMEM_SETDRAWDONE:
case BPMEM_SETDRAWDONE: // This is called when the game is done drawing (eg: like in DX: Begin(); Draw(); End();)
switch (bp.newvalue & 0xFF)
{
case 0x02:
@ -146,18 +150,18 @@ void BPWritten(const BreakPoint& bp)
break;
}
break;
case BPMEM_PE_TOKEN_ID:
case BPMEM_PE_TOKEN_ID: // Pixel Engine Token ID
g_VideoInitialize.pSetPEToken(static_cast<u16>(bp.newvalue & 0xFFFF), FALSE);
DEBUG_LOG(VIDEO, "SetPEToken 0x%04x", (bp.newvalue & 0xFFFF));
break;
case BPMEM_PE_TOKEN_INT_ID:
case BPMEM_PE_TOKEN_INT_ID: // Pixel Engine Interrupt Token ID
g_VideoInitialize.pSetPEToken(static_cast<u16>(bp.newvalue & 0xFFFF), TRUE);
DEBUG_LOG(VIDEO, "SetPEToken + INT 0x%04x", (bp.newvalue & 0xFFFF));
break;
// ------------------------
// EFB copy command. This copies a rectangle from the EFB to either RAM in a texture format or to XFB as YUYV.
// It can also optionally clear the EFB while copying from it. To emulate this, we of course copy first and clear afterwards.
case BPMEM_TRIGGER_EFB_COPY:
case BPMEM_TRIGGER_EFB_COPY: // Copy EFB Region or Render to the XFB or Clear the screen.
{
DVSTARTSUBPROFILE("LoadBPReg:swap");
// The bottom right is within the rectangle
@ -171,6 +175,7 @@ void BPWritten(const BreakPoint& bp)
float MValueX = GetRendererTargetScaleX();
float MValueY = GetRendererTargetScaleY();
// Need another rc here to get it to scale.
// Here the bottom right is the out of the rectangle.
TRectangle multirc = {
@ -188,38 +193,35 @@ void BPWritten(const BreakPoint& bp)
{
if (GetConfig(CONFIG_SHOWEFBREGIONS))
stats.efb_regions.push_back(rc);
u32 address = bpmem.copyTexDest << 5;
bool fromZBuffer = (bpmem.zcontrol.pixel_format == PIXELFMT_Z24);
bool isIntensity = (PE_copy.intensity_fmt > 0);
u32 copyFormat = ((PE_copy.target_pixel_format / 2) + ((PE_copy.target_pixel_format & 1) * 8));
bool scaleByHalf = (PE_copy.half_scale > 0);
CopyEFB(rc, address, fromZBuffer, isIntensity, copyFormat, scaleByHalf);
CopyEFB(bp, rc, bpmem.copyTexDest << 5,
bpmem.zcontrol.pixel_format == PIXELFMT_Z24,
PE_copy.intensity_fmt > 0,
((PE_copy.target_pixel_format / 2) + ((PE_copy.target_pixel_format & 1) * 8)),
PE_copy.half_scale > 0);
}
else
{
// the number of lines copied is determined by the y scale * source efb height
float yScale = bpmem.dispcopyyscale / 256.0f;
float xfbLines = bpmem.copyTexSrcWH.y + 1.0f * yScale;
u8* pXFB = Memory_GetPtr(bpmem.copyTexDest << 5);
u32 dstWidth = (bpmem.copyMipMapStrideChannels << 4);
u32 dstHeight = (u32)xfbLines;
RenderToXFB(multirc, yScale, xfbLines, pXFB, dstWidth, dstHeight);
const float yScale = bpmem.dispcopyyscale / 256.0f;
const float xfbLines = ((bpmem.copyTexSrcWH.y + 1.0f) * yScale);
RenderToXFB(bp, multirc, yScale, xfbLines,
Memory_GetPtr(bpmem.copyTexDest << 5),
bpmem.copyMipMapStrideChannels << 4,
(u32)ceil(xfbLines));
}
// ----------------------------------------------------------------------------------
// Clear the picture after it's done and submitted, to prepare for the next picture
// ----------------------------------------------------------------------------------
if (PE_copy.clear)
ClearScreen(multirc);
ClearScreen(bp, multirc);
RestoreRenderState();
RestoreRenderState(bp);
break;
}
case BPMEM_SCISSOROFFSET:
SetScissorRectangle();
break;
case BPMEM_LOADTLUT0:
case BPMEM_LOADTLUT0: // Load the Texture Look Up Table
case BPMEM_LOADTLUT1:
{
DVSTARTSUBPROFILE("LoadBPReg:GXLoadTlut");
@ -244,7 +246,7 @@ void BPWritten(const BreakPoint& bp)
// Not sure if it's a good idea, though. For now, we hash texture palettes
}
break;
case BPMEM_FOGRANGE:
case BPMEM_FOGRANGE: // Fog Settings Control
case BPMEM_FOGPARAM0:
case BPMEM_FOGBMAGNITUDE:
case BPMEM_FOGBEXPONENT:
@ -252,7 +254,7 @@ void BPWritten(const BreakPoint& bp)
if(!GetConfig(CONFIG_DISABLEFOG))
PixelShaderManager::SetFogParamChanged();
break;
case BPMEM_FOGCOLOR:
case BPMEM_FOGCOLOR: // Fog Color
PixelShaderManager::SetFogColorChanged();
break;
case BPMEM_ALPHACOMPARE:
@ -264,7 +266,7 @@ void BPWritten(const BreakPoint& bp)
PRIM_LOG("ztex bias=0x%x", bpmem.ztex1.bias);
PixelShaderManager::SetZTextureBias(bpmem.ztex1.bias);
break;
case BPMEM_ZTEX2:
case BPMEM_ZTEX2: // Z Texture type
{
if (bp.changes & 3)
PixelShaderManager::SetZTextureTypeChanged();
@ -276,36 +278,40 @@ void BPWritten(const BreakPoint& bp)
break;
}
// --------------------------------------
// BPs that only flush and update memory
// --------------------------------------
case BPMEM_DISPLAYCOPYFILER:
case BPMEM_DISPLAYCOPYFILER: // Display Filtering Control
case BPMEM_DISPLAYCOPYFILER+1:
case BPMEM_DISPLAYCOPYFILER+2:
case BPMEM_DISPLAYCOPYFILER+3:
case BPMEM_IND_IMASK:
case BPMEM_SU_COUNTER:
case BPMEM_RAS_COUNTER:
case BPMEM_IREF:
case BPMEM_PE_CONTROL:
case BPMEM_FIELDMASK:
case BPMEM_CLOCK0:
case BPMEM_EFB_TL: // EFB Source Rect. Top, Left
case BPMEM_EFB_BR: // EFB Source Rect. Bottom, Right (w, h - 1)
case BPMEM_EFB_ADDR: // EFB Target Address
case BPMEM_MIPMAP_STRIDE: // MipMap Stride Channel
case BPMEM_COPYYSCALE: // Display Copy Y Scale
case BPMEM_CLEAR_AR: // Set Clear Alpha and Red Components
case BPMEM_CLEAR_GB: // Green and Blue
case BPMEM_CLEAR_Z: // Clear Z, 24-bit Z Value
case BPMEM_COPYFILTER0:
case BPMEM_COPYFILTER1:
break;
case BPMEM_SU_COUNTER: // Counters
case BPMEM_RAS_COUNTER:
break;
case BPMEM_FIELDMASK: // Field Control
case BPMEM_FIELDMODE:
break;
case BPMEM_CLOCK0: // Debugging info
case BPMEM_CLOCK1:
case BPMEM_SETGPMETRIC:
break;
case BPMEM_EFB_TL: // EFB Source Rect. Top, Left
case BPMEM_EFB_BR: // EFB Source Rect. Bottom, Right (w, h - 1)
case BPMEM_EFB_ADDR: // EFB Target Address
break;
case BPMEM_CLEAR_AR: // Set Clear Alpha and Red Components
case BPMEM_CLEAR_GB: // Green and Blue
case BPMEM_CLEAR_Z: // Clear Z, 24-bit Z Value
break;
case BPMEM_CLEARBBOX1: // let's hope not many games use bboxes..
case BPMEM_CLEARBBOX2: // TODO(ector): add something that watches bboxes
case BPMEM_TEXINVALIDATE:
case BPMEM_SETGPMETRIC: // Debugging info
case BPMEM_FIELDMODE:
case BPMEM_CLOCK1:
break;
case BPMEM_IREF:
case BPMEM_PE_CONTROL: // Pixel Engine Control (GXSetZCompLoc, GXPixModeSync)
case BPMEM_TEXINVALIDATE: // Used, if game has manual control the Texture Cache, which we don't allow
case BPMEM_MIPMAP_STRIDE: // MipMap Stride Channel
case BPMEM_COPYYSCALE: // Display Copy Y Scale
break;
case BPMEM_TEV_KSEL: // Texture Environment Swap Mode Table 0
case BPMEM_TEV_KSEL+1:// Texture Environment Swap Mode Table 1
case BPMEM_TEV_KSEL+2:// Texture Environment Swap Mode Table 2
@ -314,7 +320,9 @@ void BPWritten(const BreakPoint& bp)
case BPMEM_TEV_KSEL+5:// Texture Environment Swap Mode Table 5
case BPMEM_TEV_KSEL+6:// Texture Environment Swap Mode Table 6
case BPMEM_TEV_KSEL+7:// Texture Environment Swap Mode Table 7
case BPMEM_BP_MASK:
break;
case BPMEM_BP_MASK: // Masks
case BPMEM_IND_IMASK:
break;
// ------------------------------------------------
@ -332,6 +340,7 @@ void BPWritten(const BreakPoint& bp)
case BPMEM_TREF+5:
case BPMEM_TREF+6:
case BPMEM_TREF+7:
break;
case BPMEM_SU_SSIZE: // Texture Wrap Size U?
case BPMEM_SU_TSIZE: // Texture Wrap Size V?
case BPMEM_SU_SSIZE+2:
@ -348,6 +357,7 @@ void BPWritten(const BreakPoint& bp)
case BPMEM_SU_TSIZE+12:
case BPMEM_SU_SSIZE+14:
case BPMEM_SU_TSIZE+14:
break;
case BPMEM_TX_SETMODE0: // 0x90 for Linear, Index 0
case BPMEM_TX_SETMODE0+1:
case BPMEM_TX_SETMODE0+2:
@ -356,6 +366,8 @@ void BPWritten(const BreakPoint& bp)
case BPMEM_TX_SETMODE1+1:
case BPMEM_TX_SETMODE1+2:
case BPMEM_TX_SETMODE1+3:
SetSamplerState(bp);
break;
case BPMEM_TX_SETIMAGE0: // Texture Size ?
case BPMEM_TX_SETIMAGE0+1:
case BPMEM_TX_SETIMAGE0+2:
@ -372,18 +384,21 @@ void BPWritten(const BreakPoint& bp)
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:
case BPMEM_TX_SETMODE0_4: // This is Mode 0 for Index 5 to 8
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: // 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:
@ -400,7 +415,8 @@ void BPWritten(const BreakPoint& bp)
case BPMEM_TX_SETIMAGE3_4+1:
case BPMEM_TX_SETIMAGE3_4+2:
case BPMEM_TX_SETIMAGE3_4+3:
case BPMEM_TX_SETLUT_4: // This is Setting TLUT for Index 5 to 8
break;
case BPMEM_TX_SETLUT_4: // This is Setting TLUT for Index 5 to 8
case BPMEM_TX_SETLUT_4+1:
case BPMEM_TX_SETLUT_4+2:
case BPMEM_TX_SETLUT_4+3:
@ -444,6 +460,7 @@ void BPWritten(const BreakPoint& bp)
case BPMEM_IND_CMD+13:
case BPMEM_IND_CMD+14:
case BPMEM_IND_CMD+15:
break;
case BPMEM_TEV_COLOR_ENV: // Texture Environment 1
case BPMEM_TEV_ALPHA_ENV:
case BPMEM_TEV_COLOR_ENV+2: // Texture Environment 2

View file

@ -1183,14 +1183,6 @@
RelativePath=".\Src\BPFunctions.cpp"
>
</File>
<File
RelativePath=".\Src\BPStructs.cpp"
>
</File>
<File
RelativePath=".\Src\BPStructs.h"
>
</File>
</Filter>
<Filter
Name="Render"

View file

@ -16,6 +16,14 @@
// http://code.google.com/p/dolphin-emu/
#include "BPFunctions.h"
#include "D3DBase.h"
#include "Config.h"
#include "Common.h"
#include "TextureCache.h"
#include "VertexManager.h"
#include "VertexShaderManager.h"
#include "Utils.h"
bool textureChanged[8];
@ -92,7 +100,7 @@ void FlushPipeline()
VertexManager::Flush();
}
void SetGenerationMode()
void SetGenerationMode(const BreakPoint &bp)
{
// dev->SetRenderState(D3DRS_CULLMODE, d3dCullModes[bpmem.genMode.cullmode]);
Renderer::SetRenderState(D3DRS_CULLMODE, d3dCullModes[bpmem.genMode.cullmode]);
@ -117,15 +125,15 @@ void SetGenerationMode()
void SetScissor(const BreakPoint &bp)
{
Renderer::SetScissorRect();
}
void SetLineWidth()
void SetLineWidth(const BreakPoint &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()
void SetDepthMode(const BreakPoint &bp)
{
if (bpmem.zmode.testenable)
{
@ -151,42 +159,82 @@ void SetDepthMode()
// Renderer::SetRenderMode(Renderer::RM_Normal);
}
void SetBlendMode()
void SetBlendMode(const BreakPoint &bp)
{
if (bp.changes & 1)
Renderer::SetRenderState(D3DRS_ALPHABLENDENABLE, bpmem.blendmode.blendenable);
D3DBLEND src = d3dSrcFactors[bpmem.blendmode.srcfactor];
D3DBLEND dst = d3dDestFactors[bpmem.blendmode.dstfactor];
if (bp.changes & 0x700)
Renderer::SetRenderState(D3DRS_SRCBLEND, src);
if (bp.changes & 0xE0) {
if (!bpmem.blendmode.subtract)
{
Renderer::SetRenderState(D3DRS_DESTBLEND, dst);
}
else
{
Renderer::SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
}
}
if (bp.changes & 0x800)
{
if (bpmem.blendmode.subtract)
{
Renderer::SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
Renderer::SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
}
else
{
Renderer::SetRenderState(D3DRS_SRCBLEND, src);
Renderer::SetRenderState(D3DRS_DESTBLEND, dst);
}
Renderer::SetRenderState(D3DRS_BLENDOP, bpmem.blendmode.subtract ? D3DBLENDOP_SUBTRACT : D3DBLENDOP_ADD);
}
}
void SetDitherMode()
void SetDitherMode(const BreakPoint &bp)
{
Renderer::SetRenderState(D3DRS_DITHERENABLE,bpmem.blendmode.dither);
}
void SetLogicOpMode()
void SetLogicOpMode(const BreakPoint &bp)
{
// Logic op blending. D3D can't do this but can fake some modes.
}
void SetColorMask()
void SetColorMask(const BreakPoint &bp)
{
DWORD write = 0;
if (bpmem.blendmode.alphaupdate)
write = D3DCOLORWRITEENABLE_ALPHA;
if (bpmem.blendmode.colorupdate)
write |= D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE;
Renderer::SetRenderState(D3DRS_COLORWRITEENABLE, write);
}
float GetRendererTargetScaleX()
{
Renderer::GetXScale();
return Renderer::GetXScale();
}
float GetRendererTargetScaleY()
{
Renderer::GetYScale();
return Renderer::GetYScale();
}
void CopyEFB(const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 &copyfmt, const bool &scaleByHalf)
void CopyEFB(const BreakPoint &bp, const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 &copyfmt, const bool &scaleByHalf)
{
TextureCache::CopyEFBToRenderTarget(bpmem.copyTexDest<<5, &rc);
RECT rec = { rc.left, rc.top, rc.right, rc.bottom };
TextureCache::CopyEFBToRenderTarget(bpmem.copyTexDest<<5, &rec);
}
void RenderToXFB(const TRectangle &multirc, const float &yScale, const float &xfbLines, u8* pXFB, const u32 &dstWidth, const u32 &dstHeight)
void RenderToXFB(const BreakPoint &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 TRectangle &multirc)
void ClearScreen(const BreakPoint &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
@ -198,6 +246,7 @@ void ClearScreen(const TRectangle &multirc)
DWORD clearflags = 0;
D3DCOLOR col = 0;
float clearZ = 0;
if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate)
{
if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate)
@ -213,17 +262,15 @@ void ClearScreen(const TRectangle &multirc)
if (clearZ < 0.0f) clearZ = 0.0f;
clearflags |= D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL;
}
D3D::dev->Clear(0, NULL, clearflags, col, clearZ, 0);
}
void RestoreRenderState()
void RestoreRenderState(const BreakPoint &bp)
{
//Renderer::SetRenderMode(Renderer::RM_Normal);
}
void SetScissorRectangle()
{
Renderer::SetScissorRect();
}
bool GetConfig(const int &type)
{
switch (type)
@ -241,6 +288,45 @@ bool GetConfig(const int &type)
}
u8 *GetPointer(const u32 &address)
{
g_VideoInitialize.pGetMemoryPointer(address);
return g_VideoInitialize.pGetMemoryPointer(address);
}
void SetSamplerState(const BreakPoint &bp)
{
FourTexUnits &tex = bpmem.tex[(bp.address & 0xE0) == 0xA0];
int stage = (bp.address & 3);//(addr>>4)&2;
TexMode0 &tm0 = tex.texMode0[stage];
D3DTEXTUREFILTERTYPE min, mag, mip;
if (g_Config.bForceFiltering)
{
min = mag = mip = D3DTEXF_LINEAR;
}
else
{
min = (tm0.min_filter & 4) ? D3DTEXF_LINEAR : D3DTEXF_POINT;
mag = tm0.mag_filter ? D3DTEXF_LINEAR : D3DTEXF_POINT;
mip = d3dMipFilters[tm0.min_filter & 3];
}
if ((bp.address & 0xE0) == 0xA0)
stage += 4;
if (g_Config.bForceMaxAniso)
{
mag = D3DTEXF_ANISOTROPIC;
mip = D3DTEXF_ANISOTROPIC;
min = D3DTEXF_ANISOTROPIC;
}
dev->SetSamplerState(stage, D3DSAMP_MINFILTER, min);
dev->SetSamplerState(stage, D3DSAMP_MAGFILTER, mag);
dev->SetSamplerState(stage, D3DSAMP_MIPFILTER, mip);
dev->SetSamplerState(stage, D3DSAMP_MAXANISOTROPY, 16);
dev->SetSamplerState(stage, D3DSAMP_ADDRESSU, d3dClamps[tm0.wrap_s]);
dev->SetSamplerState(stage, D3DSAMP_ADDRESSV, d3dClamps[tm0.wrap_t]);
//wip
//dev->SetSamplerState(stage,D3DSAMP_MIPMAPLODBIAS,tm0.lod_bias/4.0f);
//char temp[256];
//sprintf(temp,"lod %f",tm0.lod_bias/4.0f);
//g_VideoInitialize.pLog(temp);
}
};

View file

@ -1,569 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "D3DBase.h"
#include "Config.h"
#include "Common.h"
#include "Profiler.h"
#include "BPStructs.h"
#include "OpcodeDecoding.h"
#include "TextureCache.h"
#include "TextureDecoder.h"
#include "VertexManager.h"
#include "PixelShaderGen.h"
#include "PixelShaderManager.h"
#include "VertexShaderManager.h"
#include "Utils.h"
#include "main.h" //for the plugin interface
void BPInit()
{
memset(&bpmem, 0, sizeof(bpmem));
bpmem.bpMask = 0xFFFFFF;
}
// __________________________________________________________________________________________________
// BPWritten
//
void BPWritten(int addr, int changes, int newval)
{
switch(addr)
{
case BPMEM_GENMODE:
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case BPMEM_IND_MTX+0:
case BPMEM_IND_MTX+1:
case BPMEM_IND_MTX+2:
case BPMEM_IND_MTX+3:
case BPMEM_IND_MTX+4:
case BPMEM_IND_MTX+5:
case BPMEM_IND_MTX+6:
case BPMEM_IND_MTX+7:
case BPMEM_IND_MTX+8:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetIndMatrixChanged((addr-BPMEM_IND_MTX)/3);
}
break;
case BPMEM_RAS1_SS0:
case BPMEM_RAS1_SS1:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetIndTexScaleChanged();
}
break;
case BPMEM_ZMODE:
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case BPMEM_ALPHACOMPARE:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PRIM_LOG("alphacmp: ref0=%d, ref1=%d, comp0=%d, comp1=%d, logic=%d\n", bpmem.alphaFunc.ref0,
bpmem.alphaFunc.ref1, bpmem.alphaFunc.comp0, bpmem.alphaFunc.comp1, bpmem.alphaFunc.logic);
PixelShaderManager::SetAlpha(bpmem.alphaFunc);
}
break;
case BPMEM_CONSTANTALPHA:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PRIM_LOG("constalpha: alp=%d, en=%d\n", bpmem.dstalpha.alpha, bpmem.dstalpha.enable);
//PixelShaderManager::SetDestAlpha(bpmem.dstalpha);
}
break;
case BPMEM_LINEPTWIDTH:
{
}
break;
case BPMEM_PE_CONTROL: // GXSetZCompLoc, GXPixModeSync
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case BPMEM_BLENDMODE:
if (changes & 0xFFFF)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
if (changes & 1)
{
Renderer::SetRenderState(D3DRS_ALPHABLENDENABLE, bpmem.blendmode.blendenable);
}
if (changes & 2) {} // Logic op blending. D3D can't do this but can fake some modes.
if (changes & 4) {
// Dithering is pointless. Will make things uglier and will be different from GC.
// dev->SetRenderState(D3DRS_DITHERENABLE,bpmem.blendmode.dither);
}
D3DBLEND src = d3dSrcFactors[bpmem.blendmode.srcfactor];
D3DBLEND dst = d3dDestFactors[bpmem.blendmode.dstfactor];
if (changes & 0x700)
{
Renderer::SetRenderState(D3DRS_SRCBLEND, src);
}
if (changes & 0xE0) {
if (!bpmem.blendmode.subtract)
{
Renderer::SetRenderState(D3DRS_DESTBLEND, dst);
}
else
{
Renderer::SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
}
}
if (changes & 0x800) {
if (bpmem.blendmode.subtract)
{
Renderer::SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
Renderer::SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
}
else
{
Renderer::SetRenderState(D3DRS_SRCBLEND, src);
Renderer::SetRenderState(D3DRS_DESTBLEND, dst);
}
Renderer::SetRenderState(D3DRS_BLENDOP, bpmem.blendmode.subtract ? D3DBLENDOP_SUBTRACT : D3DBLENDOP_ADD);
}
//if (bpmem.blendmode.logicopenable) // && bpmem.blendmode.logicmode == 4)
// MessageBox(0,"LOGIC",0,0);
if (changes & 0x18)
{
// Color Mask
DWORD write = 0;
if (bpmem.blendmode.alphaupdate)
write = D3DCOLORWRITEENABLE_ALPHA;
if (bpmem.blendmode.colorupdate)
write |= D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE;
Renderer::SetRenderState(D3DRS_COLORWRITEENABLE, write);
}
}
break;
case BPMEM_FOGRANGE:
case BPMEM_FOGPARAM0:
case BPMEM_FOGBEXPONENT:
case BPMEM_FOGBMAGNITUDE:
case BPMEM_FOGPARAM3:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetFogParamChanged();
}
break;
case BPMEM_FOGCOLOR:
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetFogColorChanged();
}
break;
case BPMEM_TEXINVALIDATE:
//TexCache_Invalidate();
break;
case BPMEM_SCISSOROFFSET: //TODO: investigate
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
Renderer::SetScissorRect();
}
break;
case BPMEM_SCISSORTL:
case BPMEM_SCISSORBR:
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
/*if (!Renderer::SetScissorRect())
{
if (addr == BPMEM_SCISSORBR) {
ERROR_LOG(VIDEO, "bad scissor!\n");
}
}*/
}
break;
case BPMEM_ZTEX1:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
//PRIM_LOG("ztex bias=0x%x\n", bpmem.ztex1.bias);
PixelShaderManager::SetZTextureBias(bpmem.ztex1.bias);
}
break;
case BPMEM_ZTEX2:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
if (changes & 3) {
PixelShaderManager::SetZTextureTypeChanged();
}
#ifdef _DEBUG
const char* pzop[] = {"DISABLE", "ADD", "REPLACE", "?"};
const char* pztype[] = {"Z8", "Z16", "Z24", "?"};
DEBUG_LOG(VIDEO, "ztex op=%s, type=%s\n", pzop[bpmem.ztex2.op], pztype[bpmem.ztex2.type]);
#endif
}
break;
case BPMEM_SETDRAWDONE: //GXSetDrawDone
VertexManager::Flush();
switch (newval & 0xFF)
{
case 0x02:
g_VideoInitialize.pSetPEFinish(); // may generate interrupt
DEBUG_LOG(VIDEO, "GXSetDrawDone SetPEFinish (value: 0x%02X)", (newval & 0xFFFF));
break;
default:
DEBUG_LOG(VIDEO, "GXSetDrawDone ??? (value 0x%02X)", (newval & 0xFFFF));
break;
}
break;
case BPMEM_PE_TOKEN_ID:
g_VideoInitialize.pSetPEToken(static_cast<u16>(newval & 0xFFFF), FALSE);
DEBUG_LOG(VIDEO, "SetPEToken 0x%04x", (newval & 0xFFFF));
break;
case BPMEM_PE_TOKEN_INT_ID:
g_VideoInitialize.pSetPEToken(static_cast<u16>(newval & 0xFFFF), TRUE);
DEBUG_LOG(VIDEO, "SetPEToken + INT 0x%04x", (newval & 0xFFFF));
break;
case BPMEM_SETGPMETRIC: // set gp metric?
break;
case BPMEM_TRIGGER_EFB_COPY:
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
RECT rc = {
(LONG)(bpmem.copyTexSrcXY.x*Renderer::GetXScale()),
(LONG)(bpmem.copyTexSrcXY.y*Renderer::GetYScale()),
(LONG)((bpmem.copyTexSrcXY.x+bpmem.copyTexSrcWH.x)*Renderer::GetXScale()),
(LONG)((bpmem.copyTexSrcXY.y+bpmem.copyTexSrcWH.y)*Renderer::GetYScale())
};
UPE_Copy PE_copy;
PE_copy.Hex = bpmem.triggerEFBCopy;
// clamp0
// clamp1
// target_pixel_format
// gamma
// scale_something
// clear
// frame_to_field
// copy_to_xfb
// ???: start Mem to/from EFB transfer
/* bool bMip = false; // ignored
if (bpmem.triggerEFBCopy & EFBCOPY_GENERATEMIPS)
bMip = true;*/
if (PE_copy.copy_to_xfb == 0) // bpmem.triggerEFBCopy & EFBCOPY_EFBTOTEXTURE)
{
// EFB to texture
// for some reason it sets bpmem.zcontrol.pixel_format to PIXELFMT_Z24 every time a zbuffer format is given as a dest to GXSetTexCopyDst
TextureCache::CopyEFBToRenderTarget(bpmem.copyTexDest<<5, &rc);
}
else
{
// EFB to XFB
// MessageBox(0, "WASDF", 0, 0);
Renderer::SwapBuffers();
PRIM_LOG("Renderer::SwapBuffers()");
g_VideoInitialize.pCopiedToXFB();
}
// clearing
if (PE_copy.clear) // bpmem.triggerEFBCopy & EFBCOPY_CLEAR)
{
// 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
VertexShaderManager::SetViewportChanged();
// Since clear operations use the source rectangle, we have to do
// regular renders
DWORD clearflags = 0;
D3DCOLOR col = 0;
float clearZ = 0;
if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate)
{
if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate)
col = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB;
// clearflags |= D3DCLEAR_TARGET; set to break animal crossing :p
}
// clear z-buffer
if (bpmem.zmode.updateenable)
{
clearZ = (float)(bpmem.clearZValue & 0xFFFFFF) / float(0xFFFFFF);
if (clearZ > 1.0f) clearZ = 1.0f;
if (clearZ < 0.0f) clearZ = 0.0f;
clearflags |= D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL;
}
D3D::dev->Clear(0, NULL, clearflags, col, clearZ, 0);
}
}
break;
case BPMEM_LOADTLUT: //GXLoadTlut
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
u32 tlutTMemAddr = (newval & 0x3FF) << 9;
u32 tlutXferCount = (newval & 0x1FFC00) >> 5;
u8 *ptr = 0;
// TODO - figure out a cleaner way.
if (g_VideoInitialize.bWii)
ptr = g_VideoInitialize.pGetMemoryPointer(bpmem.tlutXferSrc << 5);
else
ptr = g_VideoInitialize.pGetMemoryPointer((bpmem.tlutXferSrc & 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);
// TODO(ector) : kill all textures that use this palette
// Not sure if it's a good idea, though. For now, we hash texture palettes
}
break;
case 0xf6: // ksel0
case 0xf7: // ksel1
case 0xf8: // ksel2
case 0xf9: // ksel3
case 0xfa: // ksel4
case 0xfb: // ksel5
case 0xfc: // ksel6
case 0xfd: // ksel7
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetTevKSelChanged(addr-0xf6);
}
break;
default:
switch (addr & 0xFC) //texture sampler filter
{
case 0x28: // tevorder 0-3
case 0x2C: // tevorder 4-7
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetTevOrderChanged(addr - 0x28);
}
break;
case 0x80: // TEX MODE 0
case 0xA0:
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
FourTexUnits &tex = bpmem.tex[(addr&0xE0)==0xA0];
int stage = (addr&3);//(addr>>4)&2;
TexMode0 &tm0 = tex.texMode0[stage];
D3DTEXTUREFILTERTYPE min, mag, mip;
if (g_Config.bForceFiltering)
{
min = mag = mip = D3DTEXF_LINEAR;
}
else
{
min = (tm0.min_filter&4) ? D3DTEXF_LINEAR : D3DTEXF_POINT;
mag = tm0.mag_filter ? D3DTEXF_LINEAR : D3DTEXF_POINT;
mip = d3dMipFilters[tm0.min_filter&3];
}
if ((addr & 0xE0) == 0xA0)
stage += 4;
if (g_Config.bForceMaxAniso)
{
mag = D3DTEXF_ANISOTROPIC;
mip = D3DTEXF_ANISOTROPIC;
min = D3DTEXF_ANISOTROPIC;
}
dev->SetSamplerState(stage, D3DSAMP_MINFILTER, min);
dev->SetSamplerState(stage, D3DSAMP_MAGFILTER, mag);
dev->SetSamplerState(stage, D3DSAMP_MIPFILTER, mip);
dev->SetSamplerState(stage, D3DSAMP_MAXANISOTROPY,16);
dev->SetSamplerState(stage, D3DSAMP_ADDRESSU,d3dClamps[tm0.wrap_s]);
dev->SetSamplerState(stage, D3DSAMP_ADDRESSV,d3dClamps[tm0.wrap_t]);
//wip
//dev->SetSamplerState(stage,D3DSAMP_MIPMAPLODBIAS,tm0.lod_bias/4.0f);
//char temp[256];
//sprintf(temp,"lod %f",tm0.lod_bias/4.0f);
//g_VideoInitialize.pLog(temp);
}
break;
case 0x84://TEX MODE 1
case 0xA4:
break;
case 0x88://TEX IMAGE 0
case 0xA8:
if (changes)
{
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case 0x8C://TEX IMAGE 1
case 0xAC:
if (changes)
{
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case 0x90://TEX IMAGE 2
case 0xB0:
if (changes)
{
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case 0x94://TEX IMAGE 3
case 0xB4:
if (changes)
{
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case 0x98://TEX TLUT
case 0xB8:
if (changes)
{
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case 0x9C://TEX UNKNOWN
case 0xBC:
//ERROR_LOG("texunknown%x = %x\n", addr, newval);
((u32*)&bpmem)[addr] = newval;
break;
case 0xE0:
case 0xE4:
if (addr&1) { // don't compare with changes!
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
int num = (addr >> 1) & 0x3;
PixelShaderManager::SetColorChanged(bpmem.tevregs[num].high.type, num);
} else
((u32*)&bpmem)[addr] = newval;
break;
default:
switch (addr&0xF0)
{
case 0x10: // tevindirect 0-15
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetTevIndirectChanged(addr - 0x10);
}
break;
case 0x30:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetTexDimsChanged((addr >> 1) & 0x7);
}
break;
case 0xC0:
case 0xD0:
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetTevCombinerChanged((addr & 0x1f)/2);
}
break;
case 0x20:
case 0x80:
case 0x90:
case 0xA0:
case 0xB0:
default:
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
}
}
break;
}
}

View file

@ -1,27 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _BPSTRUCTS_H
#define _BPSTRUCTS_H
#include "BPMemory.h"
void BPInit();
void LoadBPReg(u32 value0);
void ActivateTextures();
#endif

View file

@ -47,7 +47,7 @@ void FlushPipeline()
{
VertexManager::Flush();
}
void SetGenerationMode()
void SetGenerationMode(const BreakPoint &bp)
{
// none, ccw, cw, ccw
if (bpmem.genMode.cullmode > 0)
@ -66,7 +66,7 @@ void SetScissor(const BreakPoint &bp)
if (bp.address == BPMEM_SCISSORBR)
ERROR_LOG(VIDEO, "bad scissor!");
}
void SetLineWidth()
void SetLineWidth(const BreakPoint &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()
if (bpmem.lineptwidth.pointsize > 0)
glPointSize((float)bpmem.lineptwidth.pointsize * fratio / 6.0f);
}
void SetDepthMode()
void SetDepthMode(const BreakPoint &bp)
{
if (bpmem.zmode.testenable)
{
@ -92,18 +92,18 @@ void SetDepthMode()
if (!bpmem.zmode.updateenable)
Renderer::SetRenderMode(Renderer::RM_Normal);
}
void SetBlendMode()
void SetBlendMode(const BreakPoint &bp)
{
Renderer::SetBlendMode(false);
}
void SetDitherMode()
void SetDitherMode(const BreakPoint &bp)
{
if (bpmem.blendmode.dither)
glEnable(GL_DITHER);
else
glDisable(GL_DITHER);
}
void SetLogicOpMode()
void SetLogicOpMode(const BreakPoint &bp)
{
if (bpmem.blendmode.logicopenable)
{
@ -113,7 +113,7 @@ void SetLogicOpMode()
else
glDisable(GL_COLOR_LOGIC_OP);
}
void SetColorMask()
void SetColorMask(const BreakPoint &bp)
{
Renderer::SetColorMask();
}
@ -125,7 +125,7 @@ float GetRendererTargetScaleY()
{
return Renderer::GetTargetScaleY();
}
void CopyEFB(const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 &copyfmt, const bool &scaleByHalf)
void CopyEFB(const BreakPoint &bp, const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 &copyfmt, 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 TRectangle &rc, const u32 &address, const bool &fromZBuffer,
TextureMngr::CopyRenderTargetToTexture(address, fromZBuffer, isIntensityFmt, copyfmt, scaleByHalf, rc);
}
void RenderToXFB(const TRectangle &multirc, const float &yScale, const float &xfbLines, u8* pXFB, const u32 &dstWidth, const u32 &dstHeight)
void RenderToXFB(const BreakPoint &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 TRectangle &multirc, const float &yScale, const float &xf
}
g_VideoInitialize.pCopiedToXFB();
}
void ClearScreen(const TRectangle &multirc)
void ClearScreen(const BreakPoint &bp, const TRectangle &multirc)
{
// Clear color
@ -224,15 +224,11 @@ void ClearScreen(const TRectangle &multirc)
}
}
void RestoreRenderState()
void RestoreRenderState(const BreakPoint &bp)
{
Renderer::RestoreGLState();
}
void SetScissorRectangle()
{
Renderer::SetScissorRect();
}
bool GetConfig(const int &type)
{
switch (type)
@ -252,4 +248,8 @@ u8 *GetPointer(const u32 &address)
{
return g_VideoInitialize.pGetMemoryPointer(address);
}
void SetSamplerState(const BreakPoint &bp)
{
// TODO
}
};

View file

@ -1,629 +0,0 @@
switch (addr)
{
case BPMEM_GENMODE:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PRIM_LOG("genmode: texgen=%d, col=%d, ms_en=%d, tev=%d, culmode=%d, ind=%d, zfeeze=%d",
bpmem.genMode.numtexgens, bpmem.genMode.numcolchans,
bpmem.genMode.ms_en, bpmem.genMode.numtevstages+1, bpmem.genMode.cullmode,
bpmem.genMode.numindstages, bpmem.genMode.zfreeze);
// none, ccw, cw, ccw
if (bpmem.genMode.cullmode > 0) {
glEnable(GL_CULL_FACE);
glFrontFace(bpmem.genMode.cullmode == 2 ? GL_CCW : GL_CW);
}
else
glDisable(GL_CULL_FACE);
PixelShaderManager::SetGenModeChanged();
}
break;
case BPMEM_IND_MTX+0:
case BPMEM_IND_MTX+1:
case BPMEM_IND_MTX+2:
case BPMEM_IND_MTX+3:
case BPMEM_IND_MTX+4:
case BPMEM_IND_MTX+5:
case BPMEM_IND_MTX+6:
case BPMEM_IND_MTX+7:
case BPMEM_IND_MTX+8:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetIndMatrixChanged((addr-BPMEM_IND_MTX)/3);
}
break;
case BPMEM_RAS1_SS0:
case BPMEM_RAS1_SS1:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetIndTexScaleChanged();
}
break;
case BPMEM_ZMODE:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PRIM_LOG("zmode: test=%d, func=%d, upd=%d", bpmem.zmode.testenable, bpmem.zmode.func,
bpmem.zmode.updateenable);
if (bpmem.zmode.testenable) {
glEnable(GL_DEPTH_TEST);
glDepthMask(bpmem.zmode.updateenable?GL_TRUE:GL_FALSE);
glDepthFunc(glCmpFuncs[bpmem.zmode.func]);
}
else {
// if the test is disabled write is disabled too
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
}
if (!bpmem.zmode.updateenable)
Renderer::SetRenderMode(Renderer::RM_Normal);
}
break;
case BPMEM_ALPHACOMPARE:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PRIM_LOG("alphacmp: ref0=%d, ref1=%d, comp0=%d, comp1=%d, logic=%d", bpmem.alphaFunc.ref0,
bpmem.alphaFunc.ref1, bpmem.alphaFunc.comp0, bpmem.alphaFunc.comp1, bpmem.alphaFunc.logic);
PixelShaderManager::SetAlpha(bpmem.alphaFunc);
}
break;
case BPMEM_CONSTANTALPHA:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PRIM_LOG("constalpha: alp=%d, en=%d", bpmem.dstalpha.alpha, bpmem.dstalpha.enable);
SETSTAT(stats.dstAlphaEnable, bpmem.dstalpha.enable);
SETSTAT_UINT(stats.dstAlpha, bpmem.dstalpha.alpha);
PixelShaderManager::SetDestAlpha(bpmem.dstalpha);
}
break;
case BPMEM_LINEPTWIDTH:
{
float fratio = xfregs.rawViewport[0] != 0 ? ((float)Renderer::GetTargetWidth() / EFB_WIDTH) : 1.0f;
if (bpmem.lineptwidth.linesize > 0)
glLineWidth((float)bpmem.lineptwidth.linesize * fratio / 6.0f); // scale by ratio of widths
if (bpmem.lineptwidth.pointsize > 0)
glPointSize((float)bpmem.lineptwidth.pointsize * fratio / 6.0f);
break;
}
case BPMEM_PE_CONTROL: // GXSetZCompLoc, GXPixModeSync
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case BPMEM_BLENDMODE:
if (changes & 0xFFFF) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PRIM_LOG("blendmode: en=%d, open=%d, colupd=%d, alphaupd=%d, dst=%d, src=%d, sub=%d, mode=%d",
bpmem.blendmode.blendenable, bpmem.blendmode.logicopenable, bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate,
bpmem.blendmode.dstfactor, bpmem.blendmode.srcfactor, bpmem.blendmode.subtract, bpmem.blendmode.logicmode);
// Set LogicOp Blending Mode
if (changes & 2)
{
SETSTAT(stats.logicOpMode, bpmem.blendmode.logicopenable != 0 ? bpmem.blendmode.logicmode : stats.logicOpMode);
if (bpmem.blendmode.logicopenable)
{
glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(glLogicOpCodes[bpmem.blendmode.logicmode]);
}
else
glDisable(GL_COLOR_LOGIC_OP);
}
// Set Dithering Mode
if (changes & 4)
{
SETSTAT(stats.dither, bpmem.blendmode.dither);
if (bpmem.blendmode.dither) glEnable(GL_DITHER);
else glDisable(GL_DITHER);
}
// Set Blending Mode
if (changes & 0xFE1)
{
SETSTAT(stats.srcFactor, bpmem.blendmode.srcfactor);
SETSTAT(stats.dstFactor, bpmem.blendmode.dstfactor);
Renderer::SetBlendMode(false);
}
// Set Color Mask
if (changes & 0x18)
{
SETSTAT(stats.alphaUpdate, bpmem.blendmode.alphaupdate);
SETSTAT(stats.colorUpdate, bpmem.blendmode.colorupdate);
Renderer::SetColorMask();
}
}
break;
case BPMEM_FOGRANGE:
case BPMEM_FOGPARAM0:
case BPMEM_FOGBEXPONENT:
case BPMEM_FOGBMAGNITUDE:
case BPMEM_FOGPARAM3:
if (!g_Config.bDisableFog)
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetFogParamChanged();
}
break;
case BPMEM_FOGCOLOR:
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetFogColorChanged();
}
break;
case BPMEM_TEXINVALIDATE:
break;
case BPMEM_SCISSOROFFSET:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
Renderer::SetScissorRect();
}
break;
case BPMEM_SCISSORTL:
case BPMEM_SCISSORBR:
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
if (!Renderer::SetScissorRect())
{
if (addr == BPMEM_SCISSORBR) {
ERROR_LOG(VIDEO, "bad scissor!");
}
}
}
break;
case BPMEM_ZTEX1:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PRIM_LOG("ztex bias=0x%x", bpmem.ztex1.bias);
PixelShaderManager::SetZTextureBias(bpmem.ztex1.bias);
}
break;
case BPMEM_ZTEX2:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
if (changes & 3) {
PixelShaderManager::SetZTextureTypeChanged();
}
#if defined(_DEBUG) || defined(DEBUGFAST)
const char* pzop[] = {"DISABLE", "ADD", "REPLACE", "?"};
const char* pztype[] = {"Z8", "Z16", "Z24", "?"};
PRIM_LOG("ztex op=%s, type=%s", pzop[bpmem.ztex2.op], pztype[bpmem.ztex2.type]);
#endif
}
break;
case 0xf6: // ksel0
case 0xf7: // ksel1
case 0xf8: // ksel2
case 0xf9: // ksel3
case 0xfa: // ksel4
case 0xfb: // ksel5
case 0xfc: // ksel6
case 0xfd: // ksel7
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetTevKSelChanged(addr-0xf6);
}
break;
case BPMEM_SETDRAWDONE:
VertexManager::Flush();
switch (newval & 0xFF)
{
case 0x02:
g_VideoInitialize.pSetPEFinish(); // may generate interrupt
DEBUG_LOG(VIDEO, "GXSetDrawDone SetPEFinish (value: 0x%02X)", (newval & 0xFFFF));
break;
default:
DEBUG_LOG(VIDEO, "GXSetDrawDone ??? (value 0x%02X)", (newval & 0xFFFF));
break;
}
break;
case BPMEM_PE_TOKEN_ID:
g_VideoInitialize.pSetPEToken(static_cast<u16>(newval & 0xFFFF), FALSE);
DEBUG_LOG(VIDEO, "SetPEToken 0x%04x", (newval & 0xFFFF));
break;
case BPMEM_PE_TOKEN_INT_ID:
g_VideoInitialize.pSetPEToken(static_cast<u16>(newval & 0xFFFF), TRUE);
DEBUG_LOG(VIDEO, "SetPEToken + INT 0x%04x", (newval & 0xFFFF));
break;
case BPMEM_SETGPMETRIC: // Set gp metric?
break;
// ------------------------
// EFB copy command. This copies a rectangle from the EFB to either RAM in a texture format or to XFB as YUYV.
// It can also optionally clear the EFB while copying from it. To emulate this, we of course copy first and clear afterwards.
case BPMEM_TRIGGER_EFB_COPY:
{
DVSTARTSUBPROFILE("LoadBPReg:swap");
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
// The bottom right is within the rectangle
// The values in bpmem.copyTexSrcXY and bpmem.copyTexSrcWH are updated in case 0x49 and 0x4a in this function
TRectangle rc = {
(int)(bpmem.copyTexSrcXY.x),
(int)(bpmem.copyTexSrcXY.y),
(int)((bpmem.copyTexSrcXY.x + bpmem.copyTexSrcWH.x + 1)),
(int)((bpmem.copyTexSrcXY.y + bpmem.copyTexSrcWH.y + 1))
};
float MValueX = Renderer::GetTargetScaleX();
float MValueY = Renderer::GetTargetScaleY();
// Need another rc here to get it to scale.
// Here the bottom right is the out of the rectangle.
TRectangle multirc = {
(int)(bpmem.copyTexSrcXY.x * MValueX),
(int)(bpmem.copyTexSrcXY.y * MValueY),
(int)((bpmem.copyTexSrcXY.x * MValueX + (bpmem.copyTexSrcWH.x + 1) * MValueX)),
(int)((bpmem.copyTexSrcXY.y * MValueY + (bpmem.copyTexSrcWH.y + 1) * MValueY))
};
UPE_Copy PE_copy;
PE_copy.Hex = bpmem.triggerEFBCopy;
// --------------------------------------------------------
// Check to where we should copy the image data from the EFB.
// --------------------------
if (PE_copy.copy_to_xfb == 0)
{
if (g_Config.bShowEFBCopyRegions)
stats.efb_regions.push_back(rc);
// EFB to texture
// for some reason it sets bpmem.zcontrol.pixel_format to PIXELFMT_Z24 every time a zbuffer format is given as a dest to GXSetTexCopyDst
if (!g_Config.bEFBCopyDisable)
{
if (g_Config.bCopyEFBToRAM)
{
TextureConverter::EncodeToRam(bpmem.copyTexDest << 5,
bpmem.zcontrol.pixel_format == PIXELFMT_Z24,
PE_copy.intensity_fmt > 0,
(PE_copy.target_pixel_format / 2) + ((PE_copy.target_pixel_format & 1) * 8), // ??
PE_copy.half_scale > 0, rc);
}
else
{
TextureMngr::CopyRenderTargetToTexture(bpmem.copyTexDest << 5,
bpmem.zcontrol.pixel_format == PIXELFMT_Z24,
PE_copy.intensity_fmt > 0,
(PE_copy.target_pixel_format / 2) + ((PE_copy.target_pixel_format & 1) * 8), // ??
PE_copy.half_scale > 0, rc);
}
}
}
else
{
// EFB to XFB
if (g_Config.bUseXFB)
{
// the number of lines copied is determined by the y scale * source efb height
float yScale = bpmem.dispcopyyscale / 256.0f;
float xfbLines = bpmem.copyTexSrcWH.y + 1.0f * yScale;
u8* pXFB = Memory_GetPtr(bpmem.copyTexDest << 5);
u32 dstWidth = (bpmem.copyMipMapStrideChannels << 4);
u32 dstHeight = (u32)xfbLines;
XFB_Write(pXFB, multirc, dstWidth, dstHeight);
// FIXME: we draw XFB from here in DC mode.
// Bad hack since we can have multiple EFB to XFB copy before a draw.
// Plus we should use width and height from VI regs (see VI->Update()).
// Dixit donkopunchstania for the info.
//DebugLog("(EFB to XFB->XFB_Draw): ptr: %08x | %ix%i", (u32)pXFB, dstWidth, dstHeight);
if (g_VideoInitialize.bUseDualCore)
XFB_Draw(pXFB, dstWidth, dstHeight, 0);
}
else
{
// Hm, we need to compensate for the fact that the copy may be bigger than what is displayed.
// Seen in Spartan Warrior. Not sure how to deal with it yet.
Renderer::Swap(multirc);
}
g_VideoInitialize.pCopiedToXFB();
}
// --------------------------------------------------------
// Clear the picture after it's done and submitted, to prepare for the next picture
// --------------------------
if (PE_copy.clear)
{
// Clear color
Renderer::SetRenderMode(Renderer::RM_Normal);
// Clear Z-Buffer target
bool bRestoreZBufferTarget = Renderer::UseFakeZTarget();
// Update the view port for clearing the picture
glViewport(0, 0, Renderer::GetTargetWidth(), Renderer::GetTargetHeight());
// Always set the scissor in case it was set by the game and has not been reset
glScissor(multirc.left, (Renderer::GetTargetHeight() - multirc.bottom),
(multirc.right - multirc.left), (multirc.bottom - multirc.top));
// ---------------------------
VertexShaderManager::SetViewportChanged();
// Since clear operations use the source rectangle, we have to do
// regular renders (glClear clears the entire buffer)
if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate || bpmem.zmode.updateenable)
{
GLbitfield bits = 0;
if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate)
{
u32 clearColor = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB;
glClearColor(((clearColor>>16) & 0xff)*(1/255.0f),
((clearColor>>8 ) & 0xff)*(1/255.0f),
((clearColor>>0 ) & 0xff)*(1/255.0f),
((clearColor>>24) & 0xff)*(1/255.0f));
bits |= GL_COLOR_BUFFER_BIT;
}
if (bpmem.zmode.updateenable)
{
glClearDepth((float)(bpmem.clearZValue & 0xFFFFFF) / float(0xFFFFFF));
bits |= GL_DEPTH_BUFFER_BIT;
}
if (bRestoreZBufferTarget)
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); // don't clear ztarget here
glClear(bits);
}
// Have to clear the target zbuffer
if (bpmem.zmode.updateenable && bRestoreZBufferTarget)
{
glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
GL_REPORT_ERRORD();
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
// red should probably be the LSB
glClearColor(((bpmem.clearZValue>>0)&0xff)*(1/255.0f),
((bpmem.clearZValue>>8)&0xff)*(1/255.0f),
((bpmem.clearZValue>>16)&0xff)*(1/255.0f), 0);
glClear(GL_COLOR_BUFFER_BIT);
Renderer::SetColorMask();
GL_REPORT_ERRORD();
}
if (bRestoreZBufferTarget)
{
// restore target
GLenum s_drawbuffers[2] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT};
glDrawBuffers(2, s_drawbuffers);
}
}
Renderer::RestoreGLState();
}
break;
// ==================================
case BPMEM_LOADTLUT:
{
DVSTARTSUBPROFILE("LoadBPReg:GXLoadTlut");
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
u32 tlutTMemAddr = (newval & 0x3FF) << 9;
u32 tlutXferCount = (newval & 0x1FFC00) >> 5;
u8 *ptr = 0;
// TODO - figure out a cleaner way.
if (g_VideoInitialize.bWii)
ptr = g_VideoInitialize.pGetMemoryPointer(bpmem.tlutXferSrc << 5);
else
ptr = g_VideoInitialize.pGetMemoryPointer((bpmem.tlutXferSrc & 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);
// TODO(ector) : kill all textures that use this palette
// Not sure if it's a good idea, though. For now, we hash texture palettes
}
break;
default:
switch (addr & 0xFC) //texture sampler filter
{
case 0x28: // tevorder 0-3
case 0x2C: // tevorder 4-7
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetTevOrderChanged(addr - 0x28);
}
break;
case 0x80: // TEX MODE 0
case 0xA0:
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case 0x84://TEX MODE 1
case 0xA4:
break;
case 0x88://TEX IMAGE 0
case 0xA8:
if (changes)
{
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case 0x8C://TEX IMAGE 1
case 0xAC:
if (changes)
{
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case 0x90://TEX IMAGE 2
case 0xB0:
if (changes)
{
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case 0x94://TEX IMAGE 3
case 0xB4:
if (changes)
{
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case 0x98://TEX TLUT
case 0xB8:
if (changes)
{
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
case 0x9C://TEX UNKNOWN
case 0xBC:
//ERROR_LOG("texunknown%x = %x", addr, newval);
((u32*)&bpmem)[addr] = newval;
break;
case 0xE0:
case 0xE4:
if (addr&1) { // don't compare with changes!
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
int num = (addr>>1)&0x3;
PixelShaderManager::SetColorChanged(bpmem.tevregs[num].high.type, num);
}
else
((u32*)&bpmem)[addr] = newval;
break;
default:
switch (addr&0xF0) {
case 0x10: // tevindirect 0-15
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetTevIndirectChanged(addr - 0x10);
}
break;
case 0x30:
if (changes) {
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetTexDimsChanged((addr >> 1) & 0x7);
}
break;
case 0xC0:
case 0xD0:
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PixelShaderManager::SetTevCombinerChanged((addr & 0x1f) / 2);
}
break;
case 0x20:
case 0x80:
case 0x90:
case 0xA0:
case 0xB0:
// Just update the bpmem struct, don't do anything else
default:
if (changes)
{
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
/*switch(addr) {
case 0x01:
case 0x02:
case 0x03:
case 0x04: break; // copy filter values
case 0x0f: break; // mask
case 0x27: break; // tev ind order
case 0x44: break; // field mask
case 0x45: break; // draw done
case 0x46: break; // clock
case 0x49:
case 0x4a: break; // copy tex src
case 0x4b: break; // copy tex dest
case 0x4d: break; // copyMipMapStrideChannels
case 0x4e: break; // disp copy scale
case 0x4f: break; // clear color
case 0x50: break; // clear color
case 0x51: break; // casez
case 0x52: break; // trigger efb copy
case 0x53:
case 0x54: break; // more copy filters
case 0x55:
case 0x56: break; // bounding box
case 0x64:
case 0x65: break; // tlut src dest
case 0xe8: break; // fog range
case 0xe9:
case 0xea:
case 0xeb:
case 0xec:
case 0xed: break; // fog
case 0xfe: break; // mask
default:
// 0x58 = 0xf
// 0x69 = 0x49e
ERROR_LOG("bp%.2x = %x", addr, newval);
}*/
}
break;
}
break;
}
break;
}