void DumpDlistAt(uint32 dwPC) { uint32 word0, word1, opcode; char *name; switch( gRSP.ucode ) { case 2: case 10: //case 8: name=ucodeNames_GBI2; break; default: name=ucodeNames_GBI1; } DebuggerAppendMsg("\n\n"); //if( dwPC>100 ) dwPC -= 40; for( uint32 i=0; i<20; i++) { word0 = g_pRDRAMu32[(dwPC>>2)+0]; word1 = g_pRDRAMu32[(dwPC>>2)+1]; opcode = word0>>24; DebuggerAppendMsg("%08X: %08X, %08X - %s", dwPC, word0, word1, name[opcode] ); dwPC+=8; } DebuggerAppendMsg("\n\n"); }
void DumpHex(uint32 rdramAddr, int count) { rdramAddr &= 0xFFFFFFF0; uint32 *ptr = (uint32 *)((rdramAddr&(g_dwRamSize-1))+g_pRDRAMu8); for( int i=0; i<(count+3)/4; i++) { DebuggerAppendMsg("%08X: %08X, %08X, %08X, %08X\n", rdramAddr+i*16, ptr[i*4], ptr[i*4+1], ptr[i*4+2], ptr[i*4+3]); } DebuggerAppendMsg("\n"); }
void DumpMatrix2(const Matrix &mat, const char* prompt) { DebuggerAppendMsg(prompt); DebuggerAppendMsg( " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n" " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n" " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n" " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n", mat.m[0][0], mat.m[0][1], mat.m[0][2], mat.m[0][3], mat.m[1][0], mat.m[1][1], mat.m[1][2], mat.m[1][3], mat.m[2][0], mat.m[2][1], mat.m[2][2], mat.m[2][3], mat.m[3][0], mat.m[3][1], mat.m[3][2], mat.m[3][3]); }
void DecodedMux::DisplaySimpliedMuxString(const char *prompt) { DebuggerAppendMsg("//Simplied Mux=0x%08x%08x\t%s in %s\n", m_dwMux0, m_dwMux1, prompt, g_curRomInfo.szGameName); DebuggerAppendMsg("Simplied DWORDs=%08X, %08X, %08X, %08X", m_dWords[0],m_dWords[1],m_dWords[2],m_dWords[3]); Display(true); DebuggerAppendMsg("Simplfied type: %s", muxTypeStrs[mType]); if( m_dwShadeColorChannelFlag != 0 ) { if( m_dwShadeColorChannelFlag == MUX_ENV ) TRACE0("Shade = ENV in color channel") else if( m_dwShadeColorChannelFlag == MUX_PRIM ) TRACE0("Shade = PRIM in color channel") else if( m_dwShadeColorChannelFlag == MUX_LODFRAC ) TRACE0("Shade = MUX_LODFRAC in color channel") else if( m_dwShadeColorChannelFlag == MUX_PRIMLODFRAC ) TRACE0("Shade = MUX_PRIMLODFRAC in color channel") else DisplayConstantsWithShade(m_dwShadeColorChannelFlag,COLOR_CHANNEL); } if( m_dwShadeAlphaChannelFlag != 0 ) { if( m_dwShadeAlphaChannelFlag == MUX_ENV ) TRACE0("Shade = ENV in alpha channel") else if( m_dwShadeAlphaChannelFlag == MUX_PRIM ) TRACE0("Shade = PRIM in alpha channel") else if( m_dwShadeAlphaChannelFlag == MUX_LODFRAC ) TRACE0("Shade = MUX_LODFRAC in alpha channel") else if( m_dwShadeAlphaChannelFlag == MUX_PRIMLODFRAC ) TRACE0("Shade = MUX_PRIMLODFRAC in alpha channel") else DisplayConstantsWithShade(m_dwShadeAlphaChannelFlag,ALPHA_CHANNEL); } for( int i=0; i<2; i++ ) { if( m_ColorTextureFlag[i] != 0 ) { if( m_ColorTextureFlag[i] == MUX_ENV ) TRACE1("Tex %d = ENV", i) else if( m_ColorTextureFlag[i] == MUX_PRIM ) TRACE1("Tex %d = PRIM", i) else if( m_ColorTextureFlag[i] == MUX_LODFRAC ) TRACE1("Tex %d = MUX_LODFRAC", i) else if( m_ColorTextureFlag[i] == MUX_PRIMLODFRAC ) TRACE1("Tex %d = MUX_PRIMLODFRAC", i) } } TRACE0("\n"); }
void COGLColorCombiner4::DisplaySimpleMuxString(void) { char buf0[30], buf1[30], buf2[30]; OGLExtCombinerSaveType &result = m_vCompiledSettings[m_lastIndex]; COGLColorCombiner::DisplaySimpleMuxString(); DebuggerAppendMsg("OpenGL 1.2: %d Stages", result.numOfUnits); for( int i=0; i<result.numOfUnits; i++ ) { DebuggerAppendMsg("//aRGB%d:\t%s: %s, %s, %s\n", i,GetOpStr(result.units[i].rgbOp), DecodedMux::FormatStr(result.units[i].rgbArg0,buf0), DecodedMux::FormatStr(result.units[i].rgbArg1,buf1), DecodedMux::FormatStr(result.units[i].rgbArg2,buf2)); DebuggerAppendMsg("//aAlpha%d:\t%s: %s, %s, %s\n", i,GetOpStr(result.units[i].alphaOp), DecodedMux::FormatStr(result.units[i].alphaArg0,buf0), DecodedMux::FormatStr(result.units[i].alphaArg1,buf1), DecodedMux::FormatStr(result.units[i].alphaArg2,buf2)); } TRACE0("\n\n"); }
void OGLRender::DrawSimple2DTexture(float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, COLOR dif, COLOR spe, float z, float rhw) { if( status.bVIOriginIsUpdated == true && currentRomOptions.screenUpdateSetting==SCREEN_UPDATE_AT_1ST_PRIMITIVE ) { status.bVIOriginIsUpdated=false; CGraphicsContext::Get()->UpdateFrame(); DEBUGGER_PAUSE_AND_DUMP_NO_UPDATE(NEXT_SET_CIMG,{DebuggerAppendMsg("Screen Update at 1st Simple2DTexture");});
void DumpVertexArray(void) { DebuggerAppendMsg("----Vertexes----\n"); try{ for( int i=0; i<32; i++ ) { FiddledVtx &v = g_pVtxBase[i]; DebuggerAppendMsg("[%d] x=%d,y=%d,z=%d -- r=%d,g=%d,b=%d,a=%d\n", i, v.x, v.y, v.z, v.rgba.r, v.rgba.g, v.rgba.b, v.rgba.a); DebuggerAppendMsg("\tx=%f,y=%f,z=%f,rhw=%f\n", g_vecProjected[i].x, g_vecProjected[i].y, g_vecProjected[i].z, g_vecProjected[i].w); } }catch(...) { DebuggerAppendMsg("Invalid memory pointer of vertex array\n"); } }
void COGLColorCombiner::DisableCombiner(void) { m_pOGLRender->DisableMultiTexture(); glEnable(GL_BLEND); OPENGL_CHECK_ERRORS; glBlendFunc(GL_ONE, GL_ZERO); OPENGL_CHECK_ERRORS; if( m_bTexelsEnable ) { COGLTexture* pTexture = g_textures[gRSP.curTile].m_pCOGLTexture; if( pTexture ) { m_pOGLRender->EnableTexUnit(0,TRUE); m_pOGLRender->BindTexture(pTexture->m_dwTextureName, 0); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); OPENGL_CHECK_ERRORS; m_pOGLRender->SetAllTexelRepeatFlag(); } #ifdef DEBUGGER else { DebuggerAppendMsg("Check me, texture is NULL but it is enabled"); } #endif } else { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); OPENGL_CHECK_ERRORS; m_pOGLRender->EnableTexUnit(0,FALSE); } }
void DumpMatrixAt(uint32 dwPC) { Matrix mat; const float fRecip = 1.0f / 65536.0f; for (uint32 dwI = 0; dwI < 4; dwI++) { for (uint32 dwJ = 0; dwJ < 4; dwJ++) { int nDataHi = *(short *)(g_pRDRAMu8 + ((dwPC+(dwI<<3)+(dwJ<<1) )^0x2)); int nDataLo = *(uint16 *)(g_pRDRAMu8 + ((dwPC+(dwI<<3)+(dwJ<<1) + 32)^0x2)); mat.m[dwI][dwJ] = (float)((nDataHi << 16) | nDataLo) * fRecip; } } TRACE0("Dump Matrix in Memory"); DebuggerAppendMsg( " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n" " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n" " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n" " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n", mat.m[0][0], mat.m[0][1], mat.m[0][2], mat.m[0][3], mat.m[1][0], mat.m[1][1], mat.m[1][2], mat.m[1][3], mat.m[2][0], mat.m[2][1], mat.m[2][2], mat.m[2][3], mat.m[3][0], mat.m[3][1], mat.m[3][2], mat.m[3][3]); }
void DumpCachedTexture(uint32 index) { TxtrCacheEntry *p = gTextureManager.GetCachedTexture(index); if( p != NULL ) { char filename[80]; sprintf(filename,"\\Texture%d_rgb", index); CRender::GetRender()->SaveTextureToFile(*(p->pTexture), filename, TXT_RGB); DebuggerAppendMsg("Display cached texture #%d of %d\n", index, gTextureManager.GetNumOfCachedTexture()); DebuggerAppendMsg("W:%d, H:%d, RealW:%d, RealH:%d, D3DW:%d, D3DH: %d", p->ti.WidthToCreate, p->ti.HeightToCreate, p->ti.WidthToLoad, p->ti.HeightToLoad, p->pTexture->m_dwCreatedTextureWidth, p->pTexture->m_dwCreatedTextureHeight); } else { DebuggerAppendMsg("No cached texture at index = %d\n", index); } }
void DumpTileInfo(uint32 dwTile) { const char *pszOnOff[2] = {"Off", "On"}; DebuggerAppendMsg("Tile: %d\nFmt: %s/%s Line:%d (Pitch %d) TMem:0x%04x Palette:%d\n", dwTile, pszImgFormat[gRDP.tiles[dwTile].dwFormat], pszImgSize[gRDP.tiles[dwTile].dwSize], gRDP.tiles[dwTile].dwLine, gRDP.tiles[dwTile].dwPitch, gRDP.tiles[dwTile].dwTMem, gRDP.tiles[dwTile].dwPalette); DebuggerAppendMsg("S: Clamp: %s Mirror:%s Mask:0x%x Shift:0x%x\n", pszOnOff[gRDP.tiles[dwTile].bClampS],pszOnOff[gRDP.tiles[dwTile].bMirrorS], gRDP.tiles[dwTile].dwMaskS, gRDP.tiles[dwTile].dwShiftS); DebuggerAppendMsg("T: Clamp: %s Mirror:%s Mask:0x%x Shift:0x%x\n", pszOnOff[gRDP.tiles[dwTile].bClampT],pszOnOff[gRDP.tiles[dwTile].bMirrorT], gRDP.tiles[dwTile].dwMaskT, gRDP.tiles[dwTile].dwShiftT); DebuggerAppendMsg("(%d,%d) -> (%d,%d), hilite [%d, %d]\n", gRDP.tiles[dwTile].sl, gRDP.tiles[dwTile].tl, gRDP.tiles[dwTile].sh, gRDP.tiles[dwTile].th, gRDP.tiles[dwTile].hilite_sl,gRDP.tiles[dwTile].hilite_tl); }
//Copies Direct3D graphics surface to the RDRAM memory structure //Doesnt use render-targets (no HWFBE) void DXFrameBufferManager::CopyD3DSurfaceToRDRAM(uint32 addr, uint32 fmt, uint32 siz, uint32 width, uint32 height, uint32 bufWidth, uint32 bufHeight, uint32 startaddr, uint32 memsize, uint32 pitch, IDirect3DSurface9 *surf) { if( addr == 0 || addr>=g_dwRamSize ) return; if( pitch == 0 ) pitch = width; IDirect3DSurface9 *surf2 = NULL; TXTRBUF_DUMP(DebuggerAppendMsg("Copy Back to N64 RDRAM"););
void DumpTlut(uint16* palAddr) { for( uint32 i=0; i<0x100; i+=8 ) { DebuggerAppendMsg("0x%4X 0x%4X 0x%4X 0x%4X 0x%4X 0x%4X 0x%4X 0x%4X ", g_wRDPTlut[i], g_wRDPTlut[i+1], g_wRDPTlut[i+2], g_wRDPTlut[i+2], g_wRDPTlut[i+4], g_wRDPTlut[i+5], g_wRDPTlut[i+6], g_wRDPTlut[i+7]); } }
void OGLRender::EnableTexUnit(int unitno, bool flag) { #ifdef DEBUGGER if( unitno != 0 ) DebuggerAppendMsg("Check me, in the base OpenGL render, unitno!=0"); #endif if( m_texUnitEnabled[0] != flag ) m_texUnitEnabled[0] = flag; }
void OGLRender::SetZBias(int bias) { #if defined(DEBUGGER) if( pauseAtNext == true ) DebuggerAppendMsg("Set zbias = %d", bias); #endif // set member variable and apply the setting in opengl m_dwZBias = bias; ApplyZBias(bias); }
// Yoshi's Story uses this - 0xb0 void RSP_S2DEX_SELECT_DL(Gfx *gfx) { //static BOOL bWarned = FALSE; //if (!bWarned) { RSP_RDP_NOIMPL("RDP: RSP_S2DEX_SELECT_DL (0x%08x 0x%08x)", (gfx->words.w0), (gfx->words.w1)); //bWarned = TRUE; } DEBUGGER_PAUSE_AND_DUMP_COUNT_N(NEXT_OBJ_TXT_CMD, {DebuggerAppendMsg("Paused at RSP_S2DEX_SELECT_DL");});
void __cdecl LOG_UCODE(const char* szFormat, ...) { if( logUcodes) { char Msg[400]; va_list va; va_start(va, szFormat); vsprintf( Msg, szFormat, va ); va_end(va); DebuggerAppendMsg("%s\n", Msg); } }
BOOL CALLBACK MyEnumChildProc(HWND hwnd, LPARAM lParam) { #ifndef _XBOX int id = GetDlgCtrlID(hwnd); if( id != 0 ) { if( CGraphicsContext::m_hWndStatus != hwnd && IsWindow( hwnd ) ) { RECT rect; GetClientRect(hwnd, &rect); if( rect.left == 0 && rect.top == 0 && rect.bottom < 40 && rect.right > 320 ) { DEBUGGER_IF_DUMP((CGraphicsContext::m_hWndToolbar!=NULL), {DebuggerAppendMsg("Check me, found two toolbar");});
void OGLRender::BindTexture(GLuint texture, int unitno) { #ifdef DEBUGGER if( unitno != 0 ) { DebuggerAppendMsg("Check me, base ogl bind texture, unit no != 0"); } #endif if( m_curBoundTex[0] != texture ) { glBindTexture(GL_TEXTURE_2D,texture); m_curBoundTex[0] = texture; } }
void COGLColorCombiner2::DisplaySimpleMuxString(void) { char buf0[30], buf1[30], buf2[30]; OGLExtCombinerSaveType &result = m_vCompiledSettings[m_lastIndex]; COGLColorCombiner::DisplaySimpleMuxString(); int generalCombinerIndex = CGeneralCombiner::FindCompiledMux(); if( generalCombinerIndex < 0 ) // Can not found { generalCombinerIndex = CGeneralCombiner::ParseDecodedMux(); } DebuggerAppendMsg("Generated general combiners:"); GeneralCombinerInfo &generalRes = m_vCompiledCombinerStages[generalCombinerIndex]; General_DisplayBlendingStageInfo(generalRes); DebuggerAppendMsg("OpenGL 1.2: %d Stages", result.numOfUnits); for( int i=0; i<result.numOfUnits; i++ ) { DebuggerAppendMsg("//aRGB%d:\t%s: %s, %s, %s\n", i,GetOpStr(result.units[i].rgbOp), DecodedMux::FormatStr(result.units[i].rgbArg0,buf0), DecodedMux::FormatStr(result.units[i].rgbArg1,buf1), DecodedMux::FormatStr(result.units[i].rgbArg2,buf2)); DebuggerAppendMsg("//aAlpha%d:\t%s: %s, %s, %s\n", i,GetOpStr(result.units[i].alphaOp), DecodedMux::FormatStr(result.units[i].alphaArg0,buf0), DecodedMux::FormatStr(result.units[i].alphaArg1,buf1), DecodedMux::FormatStr(result.units[i].alphaArg2,buf2)); } TRACE0("\n\n"); }
bool CRender::FillRect(LONG nX0, LONG nY0, LONG nX1, LONG nY1, uint32 dwColor) { LOG_UCODE("FillRect: X0=%d, Y0=%d, X1=%d, Y1=%d, Color=0x%8X", nX0, nY0, nX1, nY1, dwColor); if( g_CI.dwSize != TXT_SIZE_16b && frameBufferOptions.bIgnore ) return true; if( status.bHandleN64RenderTexture) status.bFrameBufferIsDrawn = true; if( status.bVIOriginIsUpdated == true && currentRomOptions.screenUpdateSetting==SCREEN_UPDATE_AT_1ST_PRIMITIVE ) { status.bVIOriginIsUpdated=false; CGraphicsContext::Get()->UpdateFrame(); DEBUGGER_PAUSE_AND_DUMP_NO_UPDATE(NEXT_SET_CIMG,{DebuggerAppendMsg("Screen Update at 1st FillRectangle");});
void CRender::SetWorldProjectMatrix(Matrix &mtx) { #ifdef _DEBUG if( pauseAtNext && (eventToPause == NEXT_TRIANGLE || eventToPause == NEXT_FLUSH_TRI || eventToPause == NEXT_MATRIX_CMD ) ) { uint32 dwPC = gDlistStack[gDlistStackPointer].pc-8; DebuggerAppendMsg("Force Matrix: pc=%08X", dwPC); DumpMatrix(mtx, "Force Matrix, loading new world-project matrix"); } #endif gRSPworldProject = mtx; gRSP.bMatrixIsUpdated = false; gRSP.bCombinedMatrixIsUpdated = true; }
void OGLRender::SetTexWrapS(int unitno,GLuint flag) { static GLuint mflag; static GLuint mtex; #ifdef DEBUGGER if( unitno != 0 ) { DebuggerAppendMsg("Check me, unitno != 0 in base ogl"); } #endif if( m_curBoundTex[0] != mtex || mflag != flag ) { mtex = m_curBoundTex[0]; mflag = flag; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, flag); } }
void COGLColorCombiner::InitCombinerCycleCopy(void) { m_pOGLRender->DisableMultiTexture(); m_pOGLRender->EnableTexUnit(0,TRUE); COGLTexture* pTexture = g_textures[gRSP.curTile].m_pCOGLTexture; if( pTexture ) { m_pOGLRender->BindTexture(pTexture->m_dwTextureName, 0); m_pOGLRender->SetTexelRepeatFlags(gRSP.curTile); } #ifdef _DEBUG else { DebuggerAppendMsg("Check me, texture is NULL"); } #endif glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); }
void COGLColorCombinerNvidia::DisplayNVCombinerString(NVRegisterCombinerSettingType &record) { NVRegisterCombinerParserType &result = record.parseResult; char buf[2000]; char buf0[30]; char buf1[30]; char buf2[30]; char buf3[30]; char buf4[30]; char buf5[30]; char buf6[30]; buf[0]='\0'; TRACE0("\n\n"); TRACE0("\nNvidia combiner stages:\n"); DebuggerAppendMsg("//aRGB0:\t%s * %s + %s * %s\n", DecodedMux::FormatStr(result.s1rgb.a, buf0), DecodedMux::FormatStr(result.s1rgb.b, buf1), DecodedMux::FormatStr(result.s1rgb.c, buf2),DecodedMux::FormatStr(result.s1rgb.d, buf3)); DebuggerAppendMsg("//aA0:\t%s * %s + %s * %s\n", DecodedMux::FormatStr(result.s1alpha.a, buf0), DecodedMux::FormatStr(result.s1alpha.b, buf1), DecodedMux::FormatStr(result.s1alpha.c, buf2),DecodedMux::FormatStr(result.s1alpha.d, buf3)); if( record.numOfStages == 2 ) { DebuggerAppendMsg("//aRGB1:\t%s * %s + %s * %s\n", DecodedMux::FormatStr(result.s2rgb.a, buf0), DecodedMux::FormatStr(result.s2rgb.b, buf1), DecodedMux::FormatStr(result.s2rgb.c, buf2),DecodedMux::FormatStr(result.s2rgb.d, buf3)); DebuggerAppendMsg("//aA1:\t%s * %s + %s * %s\n", DecodedMux::FormatStr(result.s2alpha.a, buf0), DecodedMux::FormatStr(result.s2alpha.b, buf1), DecodedMux::FormatStr(result.s2alpha.c, buf2),DecodedMux::FormatStr(result.s2alpha.d, buf3)); } DebuggerAppendMsg("//Final:\t%s * %s + (1 - %s) * %s + %s\n\tE=%s, F=%s\n", FormatStrForFinalStage(result.finalrgb.a, buf0), FormatStrForFinalStage(result.finalrgb.b, buf1), FormatStrForFinalStage(result.finalrgb.a, buf2), FormatStrForFinalStage(result.finalrgb.c, buf3), FormatStrForFinalStage(result.finalrgb.d, buf4), FormatStrForFinalStage(result.finalrgb.e, buf5), FormatStrForFinalStage(result.finalrgb.f, buf6)); if( result.constant0 != MUX_0 ) { DebuggerAppendMsg("//Constant 0:\t%s\n", DecodedMux::FormatStr(result.constant0, buf0)); } if( result.constant1 != MUX_0 ) { DebuggerAppendMsg("//Constant 1:\t%s\n", DecodedMux::FormatStr(result.constant1, buf0)); } TRACE0("\n\n"); }
void CGXRenderTexture::LoadTexture(TxtrCacheEntry* pEntry) { #if 0 //This function copies the current color buffer (m_pTexture for this RenderTexture) to pEntry->pTexture bool IsBeingRendered = m_beingRendered; if( IsBeingRendered ) { TXTRBUF_DUMP(TRACE0("Warning, loading from render_texture while it is being rendered")); SetAsRenderTarget(false); //return; } CTexture *pSurf = pEntry->pTexture; TxtrInfo &ti = pEntry->ti; // Need to load texture from the saved back buffer MYLPDIRECT3DTEXTURE pNewTexture = MYLPDIRECT3DTEXTURE(pSurf->GetTexture()); MYLPDIRECT3DSURFACE pNewSurface = NULL; HRESULT res = pNewTexture->GetSurfaceLevel(0,&pNewSurface); MYLPDIRECT3DSURFACE pSourceSurface = NULL; (MYLPDIRECT3DTEXTURE(m_pTexture->GetTexture()))->GetSurfaceLevel(0,&pSourceSurface); int left = (pEntry->ti.Address- m_pInfo->CI_Info.dwAddr )%m_pInfo->CI_Info.bpl + pEntry->ti.LeftToLoad; int top = (pEntry->ti.Address- m_pInfo->CI_Info.dwAddr)/m_pInfo->CI_Info.bpl + pEntry->ti.TopToLoad; RECT srcrect = {uint32(left*m_pInfo->scaleX) ,uint32(top*m_pInfo->scaleY), uint32(min(m_width, left+(int)ti.WidthToLoad)*m_pInfo->scaleX), uint32(min(m_height,top+(int)ti.HeightToLoad)*m_pInfo->scaleY) }; if( pNewSurface != NULL && pSourceSurface != NULL ) { if( left < m_width && top<m_height ) { RECT dstrect = {0,0,ti.WidthToLoad,ti.HeightToLoad}; HRESULT res = D3DXLoadSurfaceFromSurface(pNewSurface,NULL,&dstrect,pSourceSurface,NULL,&srcrect,D3DX_FILTER_POINT ,0xFF000000); DEBUGGER_IF_DUMP(( res != S_OK), {DebuggerAppendMsg("Error to reload texture from render_texture, res=%x", res);} );
void DLParser_Process() { dlistMtxCount = 0; bHalfTxtScale = false; if ( CRender::g_pRender == NULL) { TriggerDPInterrupt(); return; } status.bScreenIsDrawn = true; DebuggerPauseCountN( NEXT_DLIST ); status.gRDPTime = timeGetTime(); status.gDlistCount++; OSTask * pTask = (OSTask *)(g_GraphicsInfo.DMEM + 0x0FC0); u32 code_base = (u32)pTask->t.ucode & 0x1fffffff; u32 code_size = pTask->t.ucode_size; u32 data_base = (u32)pTask->t.ucode_data & 0x1fffffff; u32 data_size = pTask->t.ucode_data_size; u32 stack_size = pTask->t.dram_stack_size >> 6; if (gLastUcodeBase != code_base) { DLParser_InitMicrocode(code_base, code_size, data_base, data_size); } // Initialize stack status.bN64FrameBufferIsUsed = false; gDlistStackPointer=0; gDlistStack[gDlistStackPointer].pc = (uint32)pTask->t.data_ptr; gDlistStack[gDlistStackPointer].countdown = MAX_DL_COUNT; DEBUGGER_PAUSE_AT_COND_AND_DUMP_COUNT_N((gDlistStack[gDlistStackPointer].pc == 0 && pauseAtNext && eventToPause==NEXT_UNKNOWN_OP), {DebuggerAppendMsg("Start Task without DLIST: ucode=%08X, data=%08X", (uint32)pTask->t.ucode, (uint32)pTask->t.ucode_data);});
void DecodedMux::Display(bool simplified,FILE *fp) { DecodedMux decodedMux; DecodedMux *mux; if( simplified ) { mux = this; } else { decodedMux.Decode(m_dwMux0, m_dwMux1); mux = &decodedMux; } char buf0[30]; char buf1[30]; char buf2[30]; char buf3[30]; for( int i=0; i<2; i++ ) { for(int j=0;j<2;j++) { N64CombinerType &m = mux->m_n64Combiners[i+2*j]; if( fp ) { fprintf(fp,"%s: (%s - %s) * %s + %s\n", MuxGroupStr[i+2*j], FormatStr(m.a,buf0), FormatStr(m.b,buf1), FormatStr(m.c,buf2), FormatStr(m.d,buf3)); } else { DebuggerAppendMsg("%s: (%s - %s) * %s + %s\n", MuxGroupStr[i+2*j], FormatStr(m.a,buf0), FormatStr(m.b,buf1), FormatStr(m.c,buf2), FormatStr(m.d,buf3)); } } } }
void CNvTNTCombiner::DisplaySimpleMuxString() { char buf0[30]; char buf1[30]; char buf2[30]; char buf3[30]; TNT2CombinerSaveType &result = m_vCompiledTNTSettings[m_lastIndexTNT]; TRACE0("\nNVidia TNT2+ Combiner\n"); DebuggerAppendMsg("//aRGB0:\t(%s * %s) %s (%s * %s)\n", DecodedMux::FormatStr(result.unit1.rgbArg0,buf0), DecodedMux::FormatStr(result.unit1.rgbArg1,buf1), result.unit1.rgbOp==0x0104?"+":"-", DecodedMux::FormatStr(result.unit1.rgbArg2,buf2), DecodedMux::FormatStr(result.unit1.rgbArg3,buf3)); DebuggerAppendMsg("//aRGB1:\t(%s * %s) %s (%s * %s)\n", DecodedMux::FormatStr(result.unit2.rgbArg0,buf0), DecodedMux::FormatStr(result.unit2.rgbArg1,buf1), result.unit2.rgbOp==0x0104?"+":"-", DecodedMux::FormatStr(result.unit2.rgbArg2,buf2), DecodedMux::FormatStr(result.unit2.rgbArg3,buf3)); DebuggerAppendMsg("//aAlpha0:\t(%s * %s) %s (%s * %s)\n", DecodedMux::FormatStr(result.unit1.alphaArg0,buf0), DecodedMux::FormatStr(result.unit1.alphaArg1,buf1), result.unit1.alphaOp==0x0104?"+":"-", DecodedMux::FormatStr(result.unit1.alphaArg2,buf2), DecodedMux::FormatStr(result.unit1.alphaArg3,buf3)); DebuggerAppendMsg("//aAlpha1:\t(%s * %s) %s (%s * %s)\n", DecodedMux::FormatStr(result.unit2.alphaArg0,buf0), DecodedMux::FormatStr(result.unit2.alphaArg1,buf1), result.unit2.alphaOp==0x0104?"+":"-", DecodedMux::FormatStr(result.unit2.alphaArg2,buf2), DecodedMux::FormatStr(result.unit2.alphaArg3,buf3)); if( result.unit1.constant != MUX_0 ) DebuggerAppendMsg("//Constant for unit 1:\t%s\n", DecodedMux::FormatStr(result.unit1.constant,buf0)); if( result.unit2.constant != MUX_0 ) DebuggerAppendMsg("//Constant for unit 2:\t%s\n", DecodedMux::FormatStr(result.unit2.constant,buf0)); TRACE0("\n\n"); }
TxtrCacheEntry * CTextureManager::GetTexture(TxtrInfo * pgti, bool fromTMEM, bool doCRCCheck, bool AutoExtendTexture) { TxtrCacheEntry *pEntry; if( g_curRomInfo.bDisableTextureCRC ) doCRCCheck = false; gRDP.texturesAreReloaded = true; dwAsmCRC = 0; uint32 dwPalCRC = 0; pEntry = GetTxtrCacheEntry(pgti); bool loadFromTextureBuffer=false; int txtBufIdxToLoadFrom = -1; if( (frameBufferOptions.bCheckRenderTextures&&!frameBufferOptions.bWriteBackBufToRDRAM) || (frameBufferOptions.bCheckBackBufs&&!frameBufferOptions.bWriteBackBufToRDRAM) ) { txtBufIdxToLoadFrom = g_pFrameBufferManager->CheckAddrInRenderTextures(pgti->Address); if( txtBufIdxToLoadFrom >= 0 ) { loadFromTextureBuffer = true; // Check if it is the same size, RenderTextureInfo &info = gRenderTextureInfos[txtBufIdxToLoadFrom]; //if( info.pRenderTexture && info.CI_Info.dwAddr == pgti->Address && info.CI_Info.dwFormat == pgti->Format if( info.pRenderTexture && info.CI_Info.dwFormat == pgti->Format && info.CI_Info.dwSize == pgti->Size ) { info.txtEntry.ti = *pgti; return &info.txtEntry; } } } if( frameBufferOptions.bCheckBackBufs && g_pFrameBufferManager->CheckAddrInBackBuffers(pgti->Address, pgti->HeightToLoad*pgti->Pitch) >= 0 ) { if( !frameBufferOptions.bWriteBackBufToRDRAM ) { // Load the texture from recent back buffer txtBufIdxToLoadFrom = g_pFrameBufferManager->CheckAddrInRenderTextures(pgti->Address); if( txtBufIdxToLoadFrom >= 0 ) { loadFromTextureBuffer = true; // Check if it is the same size, RenderTextureInfo &info = gRenderTextureInfos[txtBufIdxToLoadFrom]; //if( info.pRenderTexture && info.CI_Info.dwAddr == pgti->Address && info.CI_Info.dwFormat == pgti->Format if( info.pRenderTexture && info.CI_Info.dwFormat == pgti->Format && info.CI_Info.dwSize == pgti->Size ) { info.txtEntry.ti = *pgti; return &info.txtEntry; } } } } if (pEntry && pEntry->dwTimeLastUsed == status.gRDPTime && status.gDlistCount != 0 && !status.bN64FrameBufferIsUsed ) // This is not good, Palatte may changes { // We've already calculated a CRC this frame! dwAsmCRC = pEntry->dwCRC; } else { if ( doCRCCheck ) { if( loadFromTextureBuffer ) dwAsmCRC = gRenderTextureInfos[txtBufIdxToLoadFrom].crcInRDRAM; else CalculateRDRAMCRC(pgti->pPhysicalAddress, pgti->LeftToLoad, pgti->TopToLoad, pgti->WidthToLoad, pgti->HeightToLoad, pgti->Size, pgti->Pitch); } } int maxCI = 0; if ( doCRCCheck && (pgti->Format == TXT_FMT_CI || (pgti->Format == TXT_FMT_RGBA && pgti->Size <= TXT_SIZE_8b ))) { //maxCI = pgti->Size == TXT_SIZE_8b ? 255 : 15; extern unsigned char CalculateMaxCI(void *pPhysicalAddress, uint32 left, uint32 top, uint32 width, uint32 height, uint32 size, uint32 pitchInBytes ); if( !pEntry || pEntry->dwCRC != dwAsmCRC || pEntry->maxCI < 0 ) { maxCI = CalculateMaxCI(pgti->pPhysicalAddress, pgti->LeftToLoad, pgti->TopToLoad, pgti->WidthToLoad, pgti->HeightToLoad, pgti->Size, pgti->Pitch); } else { maxCI = pEntry->maxCI; } //Check PAL CRC uint8 * pStart; uint32 dwPalSize = 16; uint32 dwOffset; if( pgti->Size == TXT_SIZE_8b ) { dwPalSize = 256; dwOffset = 0; } else { dwOffset = pgti->Palette << 4; } pStart = (uint8*)pgti->PalAddress+dwOffset*2; //uint32 y; //for (y = 0; y < dwPalSize*2; y+=4) //{ // dwPalCRC = (dwPalCRC + *(uint32*)&pStart[y]); //} uint32 dwAsmCRCSave = dwAsmCRC; //dwPalCRC = CalculateRDRAMCRC(pStart, 0, 0, dwPalSize, 1, TXT_SIZE_16b, dwPalSize*2); dwPalCRC = CalculateRDRAMCRC(pStart, 0, 0, maxCI+1, 1, TXT_SIZE_16b, dwPalSize*2); dwAsmCRC = dwAsmCRCSave; } if (pEntry && doCRCCheck ) { if(pEntry->dwCRC == dwAsmCRC && pEntry->dwPalCRC == dwPalCRC && (!loadFromTextureBuffer || gRenderTextureInfos[txtBufIdxToLoadFrom].updateAtFrame < pEntry->FrameLastUsed ) ) { // Tile is ok, return pEntry->dwUses++; pEntry->dwTimeLastUsed = status.gRDPTime; pEntry->FrameLastUsed = status.gDlistCount; LOG_TEXTURE(TRACE0(" Use current texture:\n")); pEntry->lastEntry = g_lastTextureEntry; g_lastTextureEntry = pEntry; lastEntryModified = false; DEBUGGER_IF_DUMP((pauseAtNext && loadFromTextureBuffer) , {DebuggerAppendMsg("Load cached texture from render_texture");} );