2 Copyright (C) 2002 Rice1964
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #define M64P_PLUGIN_PROTOTYPES 1
21 #include "m64p_plugin.h"
25 void __cdecl DebuggerAppendMsg(const char * Message, ...) {}
29 void DumpMatrix2(const Matrix &mtx, const char* prompt);
31 bool debuggerWinOpened = false;
32 bool debuggerDrawRenderTexture = false;
33 int debuggerDrawRenderTextureNo = 0;
35 bool logCombiners = false;
36 bool logWarning = true;
37 bool logTriangles = false;
38 bool logMatrix = false;
39 bool logVertex = false;
40 bool logTextures = false;
41 bool logTextureBuffer = false;
42 bool logToScreen = true;
43 bool logToFile = false;
44 bool logUcodes = false;
45 bool logMicrocode = false;
47 bool logDetails = false;
51 bool debuggerEnableTexture=true;
52 bool debuggerEnableZBuffer=true;
53 bool debuggerEnableCullFace=true;
54 bool debuggerEnableTestTris=true;
55 bool debuggerEnableAlphaTest=true;
56 bool debuggerContinueWithUnknown=false;
58 bool debuggerPause = false;
59 bool pauseAtNext = true;
60 int eventToPause = NEXT_FRAME;
61 int debuggerPauseCount = 340;
64 bool debuggerDropCombiners=false;
65 bool debuggerDropGeneralCombiners=false;
66 bool debuggerDropDecodedMux=false;
67 bool debuggerDropCombinerInfos=false;
69 char msgBuf[0x20000+2];
70 bool msgBufUpdated = false;
71 extern FiddledVtx * g_pVtxBase;
73 uint32 CachedTexIndex = 0;
75 const char* otherNexts[] = {
102 int numberOfNextOthers = sizeof(otherNexts)/sizeof(char*);
104 const char* thingsToDump[] = {
106 "Cur+1 Texture RGBA",
120 "Cur+1 Texture Alpha",
134 "Frame Buffer in RDRAM",
138 int numberOfThingsToDump = sizeof(thingsToDump)/sizeof(char*);
141 DUMP_CUR_TEXTURE_RGBA,
142 DUMP_CUR_1_TEXTURE_RGBA,
151 DUMP_CUR_TEXTURE_TO_FILE,
152 DUMP_CUR_1_TEXTURE_TO_FILE,
153 DUMP_CUR_TEXTURE_RGB,
154 DUMP_CUR_TEXTURE_ALPHA,
155 DUMP_CUR_1_TEXTURE_RGB,
156 DUMP_CUR_1_TEXTURE_ALPHA,
166 DUMP_COMBINED_MATRIX,
167 DUMP_WORLD_TOP_MATRIX,
168 DUMP_PROJECTION_MATRIX,
169 DUMP_WORLD_MATRIX_AT,
175 //---------------------------------------------------------------------
176 void DumpVIRegisters(void)
178 DebuggerAppendMsg("----VI Registers----\nSTATUS:\t%08X\nORIGIN:\t%08X\nWIDTH:\t%08X\n\
179 V_SYNC:\t%08X\nH_SYNC:\t%08X\nX_SCALE:\t%08X\nY_SCALE:\t%08X\n\
180 H_START:\t%08X\nV_START:\t%08X\nVI Width=%f(x %f), VI Height=%f(x %f)\n\n",
181 *g_GraphicsInfo.VI_STATUS_REG, *g_GraphicsInfo.VI_ORIGIN_REG, *g_GraphicsInfo.VI_WIDTH_REG, *g_GraphicsInfo.VI_V_SYNC_REG,
182 *g_GraphicsInfo.VI_H_SYNC_REG, *g_GraphicsInfo.VI_X_SCALE_REG, *g_GraphicsInfo.VI_Y_SCALE_REG,
183 *g_GraphicsInfo.VI_H_START_REG, *g_GraphicsInfo.VI_V_START_REG, windowSetting.fViWidth,windowSetting.fMultX,
184 windowSetting.fViHeight,windowSetting.fMultY);
185 DebuggerAppendMsg("Scissor: x0=%d y0=%d x1=%d y1=%d mode=%d",
186 gRDP.scissor.left, gRDP.scissor.top,
187 gRDP.scissor.right, gRDP.scissor.bottom,
189 DebuggerAppendMsg("Effective scissor: x0=%d y0=%d x1=%d y1=%d",
190 gRSP.real_clip_scissor_left, gRSP.real_clip_scissor_top,
191 gRSP.real_clip_scissor_right, gRSP.real_clip_scissor_bottom);
192 DebuggerAppendMsg("Clipping: (%d) left=%f top=%f right=%f bottom=%f",
193 gRSP.clip_ratio_posx, gRSP.real_clip_ratio_negx , gRSP.real_clip_ratio_negy,
194 gRSP.real_clip_ratio_posx, gRSP.real_clip_ratio_posy);
195 DebuggerAppendMsg("Viewport: left=%d top=%d right=%d bottom=%d",
196 gRSP.nVPLeftN, gRSP.nVPTopN , gRSP.nVPRightN,
198 DebuggerAppendMsg("Current CImg: Addr=0x%08X, Fmt:%s-%sb, Width=%d\n",
199 g_CI.dwAddr, pszImgFormat[g_CI.dwFormat], pszImgSize[g_CI.dwSize], g_CI.dwWidth);
200 DebuggerAppendMsg("Current ZImg: Addr=0x%08X, Fmt:%s-%sb, Width=%d\n",
201 g_ZI.dwAddr, pszImgFormat[g_ZI.dwFormat], pszImgSize[g_ZI.dwSize], g_ZI.dwWidth);
204 void DumpVertexArray(void)
206 DebuggerAppendMsg("----Vertexes----\n");
209 for( int i=0; i<32; i++ )
211 FiddledVtx &v = g_pVtxBase[i];
212 DebuggerAppendMsg("[%d] x=%d,y=%d,z=%d -- r=%d,g=%d,b=%d,a=%d\n", i, v.x, v.y, v.z,
213 v.rgba.r, v.rgba.g, v.rgba.b, v.rgba.a);
214 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);
219 DebuggerAppendMsg("Invalid memory pointer of vertex array\n");
223 void DumpHex(uint32 rdramAddr, int count);
224 uint32 StrToHex(char *HexStr);
226 void DumpTileInfo(uint32 dwTile)
228 const char *pszOnOff[2] = {"Off", "On"};
230 DebuggerAppendMsg("Tile: %d\nFmt: %s/%s Line:%d (Pitch %d) TMem:0x%04x Palette:%d\n",
231 dwTile, pszImgFormat[gRDP.tiles[dwTile].dwFormat], pszImgSize[gRDP.tiles[dwTile].dwSize],
232 gRDP.tiles[dwTile].dwLine, gRDP.tiles[dwTile].dwPitch, gRDP.tiles[dwTile].dwTMem, gRDP.tiles[dwTile].dwPalette);
233 DebuggerAppendMsg("S: Clamp: %s Mirror:%s Mask:0x%x Shift:0x%x\n",
234 pszOnOff[gRDP.tiles[dwTile].bClampS],pszOnOff[gRDP.tiles[dwTile].bMirrorS],
235 gRDP.tiles[dwTile].dwMaskS, gRDP.tiles[dwTile].dwShiftS);
236 DebuggerAppendMsg("T: Clamp: %s Mirror:%s Mask:0x%x Shift:0x%x\n",
237 pszOnOff[gRDP.tiles[dwTile].bClampT],pszOnOff[gRDP.tiles[dwTile].bMirrorT],
238 gRDP.tiles[dwTile].dwMaskT, gRDP.tiles[dwTile].dwShiftT);
239 DebuggerAppendMsg("(%d,%d) -> (%d,%d), hilite [%d, %d]\n",
240 gRDP.tiles[dwTile].sl, gRDP.tiles[dwTile].tl, gRDP.tiles[dwTile].sh, gRDP.tiles[dwTile].th,
241 gRDP.tiles[dwTile].hilite_sl,gRDP.tiles[dwTile].hilite_tl);
244 void DumpTexture(int tex, TextureChannel channel = TXT_RGB )
246 CRender::GetRender()->DrawTexture(tex, channel);
249 void DumpRenderTexture(int tex=-1)
251 if( CDeviceBuilder::GetBuilder()->GetGeneralDeviceType() == DIRECTX_DEVICE )
253 g_pFrameBufferManager->DisplayRenderTexture(tex);
257 debuggerDrawRenderTextureNo = tex;
258 debuggerDrawRenderTexture = true;
262 void DumpTextureToFile(int tex, TextureChannel channel = TXT_RGB)
264 CRender::GetRender()->SaveTextureToFile(tex, channel,false);
267 void DumpTlut(uint16* palAddr)
269 for( uint32 i=0; i<0x100; i+=8 )
271 DebuggerAppendMsg("0x%4X 0x%4X 0x%4X 0x%4X 0x%4X 0x%4X 0x%4X 0x%4X ",
272 g_wRDPTlut[i], g_wRDPTlut[i+1], g_wRDPTlut[i+2], g_wRDPTlut[i+2],
273 g_wRDPTlut[i+4], g_wRDPTlut[i+5], g_wRDPTlut[i+6], g_wRDPTlut[i+7]);
277 extern char ucodeNames_GBI1[256];
278 extern char ucodeNames_GBI2[256];
280 void DumpDlistAt(uint32 dwPC)
282 uint32 word0, word1, opcode;
289 name=ucodeNames_GBI2;
292 name=ucodeNames_GBI1;
295 DebuggerAppendMsg("\n\n");
296 //if( dwPC>100 ) dwPC -= 40;
297 for( uint32 i=0; i<20; i++)
299 word0 = g_pRDRAMu32[(dwPC>>2)+0];
300 word1 = g_pRDRAMu32[(dwPC>>2)+1];
302 DebuggerAppendMsg("%08X: %08X, %08X - %s", dwPC, word0, word1, name[opcode] );
305 DebuggerAppendMsg("\n\n");
308 void DumpMatrixAt(uint32 dwPC)
311 const float fRecip = 1.0f / 65536.0f;
313 for (uint32 dwI = 0; dwI < 4; dwI++)
315 for (uint32 dwJ = 0; dwJ < 4; dwJ++)
317 int nDataHi = *(short *)(g_pRDRAMu8 + ((dwPC+(dwI<<3)+(dwJ<<1) )^0x2));
318 int nDataLo = *(uint16 *)(g_pRDRAMu8 + ((dwPC+(dwI<<3)+(dwJ<<1) + 32)^0x2));
319 mat.m[dwI][dwJ] = (float)((nDataHi << 16) | nDataLo) * fRecip;
323 TRACE0("Dump Matrix in Memory");
325 " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n"
326 " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n"
327 " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n"
328 " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n",
329 mat.m[0][0], mat.m[0][1], mat.m[0][2], mat.m[0][3],
330 mat.m[1][0], mat.m[1][1], mat.m[1][2], mat.m[1][3],
331 mat.m[2][0], mat.m[2][1], mat.m[2][2], mat.m[2][3],
332 mat.m[3][0], mat.m[3][1], mat.m[3][2], mat.m[3][3]);
336 static const char *alphadithertypes[4] = {"Pattern", "NotPattern", "Noise", "Disable"};
337 static const char *rgbdithertype[4] = {"MagicSQ", "Bayer", "Noise", "Disable"};
338 static const char *convtype[8] = {"Conv", "?", "?", "?", "?", "FiltConv", "Filt", "?"};
339 static const char *filtertype[4] = {"Point", "?", "Bilinear", "Average"};
340 static const char *cycletype[4] = {"1Cycle", "2Cycle", "Copy", "Fill"};
341 static const char *alphacomptype[4] = {"None", "Threshold", "?", "Dither"};
342 static const char * szCvgDstMode[4] = { "Clamp", "Wrap", "Full", "Save" };
343 static const char * szZMode[4] = { "Opa", "Inter", "XLU", "Decal" };
344 static const char * szZSrcSel[2] = { "Pixel", "Primitive" };
345 static const char * sc_szBlClr[4] = { "In", "Mem", "Bl", "Fog" };
346 static const char * sc_szBlA1[4] = { "AIn", "AFog", "AShade", "0" };
347 static const char * sc_szBlA2[4] = { "1-A", "AMem", "1", "0" };
351 uint16 blender = gRDP.otherMode.blender;
352 RDP_BlenderSetting &bl = *(RDP_BlenderSetting*)(&(blender));
353 DebuggerAppendMsg( "Other Modes");
354 DebuggerAppendMsg( "\talpha_compare:\t%s", alphacomptype[ gRDP.otherMode.alpha_compare ]);
355 DebuggerAppendMsg( "\tdepth_source:\t%s", szZSrcSel[ gRDP.otherMode.depth_source ]);
356 DebuggerAppendMsg( "\taa_en:\t\t%d", gRDP.otherMode.aa_en );
357 DebuggerAppendMsg( "\tz_cmp:\t\t%d", gRDP.otherMode.z_cmp );
358 DebuggerAppendMsg( "\tz_upd:\t\t%d", gRDP.otherMode.z_upd );
359 DebuggerAppendMsg( "\tim_rd:\t\t%d", gRDP.otherMode.im_rd );
360 DebuggerAppendMsg( "\tclr_on_cvg:\t%d", gRDP.otherMode.clr_on_cvg );
361 DebuggerAppendMsg( "\tcvg_dst:\t\t%s", szCvgDstMode[ gRDP.otherMode.cvg_dst ] );
362 DebuggerAppendMsg( "\tzmode:\t\t%s", szZMode[ gRDP.otherMode.zmode ] );
363 DebuggerAppendMsg( "\tcvg_x_alpha:\t%d", gRDP.otherMode.cvg_x_alpha );
364 DebuggerAppendMsg( "\talpha_cvg_sel:\t%d", gRDP.otherMode.alpha_cvg_sel );
365 DebuggerAppendMsg( "\tforce_bl:\t\t%d", gRDP.otherMode.force_bl );
366 DebuggerAppendMsg( "\ttex_edge:\t\t%d", gRDP.otherMode.tex_edge );
367 DebuggerAppendMsg( "\tblender:\t\t%04x - Cycle1:\t%s * %s + %s * %s\n\t\t\tCycle2:\t%s * %s + %s * %s", gRDP.otherMode.blender,
368 sc_szBlClr[bl.c1_m1a], sc_szBlA1[bl.c1_m1b], sc_szBlClr[bl.c1_m2a], sc_szBlA2[bl.c1_m2b],
369 sc_szBlClr[bl.c2_m1a], sc_szBlA1[bl.c2_m1b], sc_szBlClr[bl.c2_m2a], sc_szBlA2[bl.c2_m2b]);
370 DebuggerAppendMsg( "\tblend_mask:\t%d", gRDP.otherMode.blend_mask );
371 DebuggerAppendMsg( "\talpha_dither:\t%s", alphadithertypes[ gRDP.otherMode.alpha_dither ] );
372 DebuggerAppendMsg( "\trgb_dither:\t\t%s", rgbdithertype[ gRDP.otherMode.rgb_dither ] );
373 DebuggerAppendMsg( "\tcomb_key:\t%s", gRDP.otherMode.key_en ? "Key" : "None" );
374 DebuggerAppendMsg( "\ttext_conv:\t\t%s", convtype[ gRDP.otherMode.text_conv ] );
375 DebuggerAppendMsg( "\ttext_filt:\t\t%s", filtertype[ gRDP.otherMode.text_filt ] );
376 DebuggerAppendMsg( "\ttext_tlut:\t\t%s", textluttype[ gRDP.otherMode.text_tlut ] );
377 DebuggerAppendMsg( "\ttext_lod:\t\t%s", gRDP.otherMode.text_lod ? "Yes": "No" );
378 DebuggerAppendMsg( "\ttext_detail:\t\t%s", gRDP.otherMode.text_detail ? "Yes": "No" );
379 DebuggerAppendMsg( "\ttext_sharpen:\t\t%s", gRDP.otherMode.text_sharpen ? "Yes": "No" );
380 DebuggerAppendMsg( "\ttext_persp:\t%s", gRDP.otherMode.text_persp ? "On" : "Off" );
381 DebuggerAppendMsg( "\tcycle_type:\t%s", cycletype[ gRDP.otherMode.cycle_type ] );
382 DebuggerAppendMsg( "\tpipeline:\t\t%s", gRDP.otherMode.atomic_prim ? "1Primitive" : "NPrimitive" );
384 DebuggerAppendMsg("\n\nSP render flags:");
385 DebuggerAppendMsg("\tCull mode: %s%s", gRSP.bCullFront?"Cull Front":"", gRSP.bCullBack?" Cull Back":"");
386 DebuggerAppendMsg("\tShade mode: %d", gRSP.shadeMode);
387 DebuggerAppendMsg("\tFog: %s", gRSP.bFogEnabled?"enabled":"disabled");
388 DebuggerAppendMsg("\tZbuffer in SP: %s", gRSP.bZBufferEnabled?"enabled":"disabled");
389 DebuggerAppendMsg("\tLighting: %s", gRSP.bLightingEnable?"enabled":"disabled");
390 DebuggerAppendMsg("\\Number of lights: %d", gRSPnumLights);
391 DebuggerAppendMsg("\tTexture Gen: %s", gRSP.bTextureGen?"enabled":"disabled");
392 DebuggerAppendMsg("\tTexture Gen Linear: %s", (gRDP.geometryMode & G_TEXTURE_GEN_LINEAR)?"enabled":"disabled");
395 void DumpCachedTexture(uint32 index)
397 TxtrCacheEntry *p = gTextureManager.GetCachedTexture(index);
401 sprintf(filename,"\\Texture%d_rgb", index);
402 CRender::GetRender()->SaveTextureToFile(*(p->pTexture), filename, TXT_RGB);
403 DebuggerAppendMsg("Display cached texture #%d of %d\n", index, gTextureManager.GetNumOfCachedTexture());
404 DebuggerAppendMsg("W:%d, H:%d, RealW:%d, RealH:%d, D3DW:%d, D3DH: %d", p->ti.WidthToCreate, p->ti.HeightToCreate,
405 p->ti.WidthToLoad, p->ti.HeightToLoad, p->pTexture->m_dwCreatedTextureWidth, p->pTexture->m_dwCreatedTextureHeight);
406 DebuggerAppendMsg("ScaledS:%s, ScaledT:%s", p->pTexture->m_bScaledS?"T":"F", p->pTexture->m_bScaledT?"T":"F");
410 DebuggerAppendMsg("No cached texture at index = %d\n", index);
414 extern uint32 gObjTlutAddr;
415 void DumpInfo(int thingToDump)
420 DebuggerAppendMsg("----Colors----\nPrim Color:\t%08X\nEnv Color:\t%08X\n"
421 "Fill Color:\t%08X\nFog Color:\t%08X\n"
422 "Prim Depth:\t%f\nPrim LOD Frac:\t%08X\n",
423 GetPrimitiveColor(), GetEnvColor(), gRDP.fillColor,
424 CRender::GetRender()->GetFogColor(), GetPrimitiveDepth(), GetLODFrac());
427 CRender::GetRender()->m_pColorCombiner->DisplayMuxString();
430 DebuggerAppendMsg("----Light Colors----\nNumber of Lights: %d\n",GetNumLights());
431 for( uint32 i=0; i<GetNumLights()+2; i++)
433 DebuggerAppendMsg("Light %d:\t%08X, (%d,%d,%d)\n", i, gRSPn64lights[i].dwRGBA,gRSPn64lights[i].x,gRSPn64lights[i].y,gRSPn64lights[i].z );
436 case DUMP_TEXTURE_AT:
440 case DUMP_CUR_TEXTURE_RGBA:
441 DumpTexture(gRSP.curTile, TXT_RGBA);
443 case DUMP_CUR_1_TEXTURE_RGBA:
444 DumpTexture((1+gRSP.curTile)%7, TXT_RGBA);
446 case DUMP_CUR_TEXTURE_RGB:
447 DumpTexture(gRSP.curTile, TXT_RGB);
449 case DUMP_CUR_1_TEXTURE_RGB:
450 DumpTexture((1+gRSP.curTile)%7, TXT_RGB);
452 case DUMP_CUR_TEXTURE_TO_FILE:
453 DumpTextureToFile(0,TXT_RGB);
454 DumpTextureToFile(0,TXT_ALPHA);
455 DumpTextureToFile(0,TXT_RGBA);
457 case DUMP_CUR_1_TEXTURE_TO_FILE:
458 DumpTextureToFile(1,TXT_RGB);
459 DumpTextureToFile(1,TXT_ALPHA);
460 DumpTextureToFile(1,TXT_RGBA);
462 case DUMP_CUR_TEXTURE_ALPHA:
463 DumpTexture(0, TXT_ALPHA);
465 case DUMP_CUR_1_TEXTURE_ALPHA:
466 DumpTexture(1, TXT_ALPHA);
469 DumpTlut(g_wRDPTlut);
472 DumpTlut((uint16*)(g_pRDRAMu8+gObjTlutAddr));
484 case DUMP_SIMPLE_MUX:
485 CRender::GetRender()->m_pColorCombiner->DisplaySimpleMuxString();
487 case DUMP_OTHER_MODE:
490 case DUMP_FRAME_BUFFER:
491 CRender::GetRender()->DrawFrameBuffer(true);
493 case DUMP_CONTENT_AT:
507 if( CachedTexIndex >= gTextureManager.GetNumOfCachedTexture() )
511 DumpCachedTexture(CachedTexIndex);
515 if( CachedTexIndex < 0 || CachedTexIndex >= gTextureManager.GetNumOfCachedTexture() )
517 DumpCachedTexture(CachedTexIndex);
519 case DUMP_CACHED_TEX:
520 DumpCachedTexture(CachedTexIndex);
522 case DUMP_TEXBUFFER_AT:
526 case DUMP_COMBINED_MATRIX:
527 DumpMatrix2(gRSPworldProject,"Combined Matrix");
529 case DUMP_WORLD_TOP_MATRIX:
530 DumpMatrix2(gRSP.modelviewMtxs[gRSP.modelViewMtxTop],"World Top Matrix");
532 case DUMP_WORLD_MATRIX_AT:
536 case DUMP_PROJECTION_MATRIX:
537 DumpMatrix2(gRSP.projectionMtxs[gRSP.projectionMtxTop],"Projection Top Matrix");
543 void SetLogToFile(bool log)
549 logFp = fopen("\\RiceVideo.log", "at");
563 void __cdecl DebuggerAppendMsg(const char * Message, ...)
565 if( !logToScreen && !logToFile )
571 va_start( ap, Message );
572 vsprintf( Msg, Message, ap );
575 if( Msg[strlen(Msg)-1]!='\n' ) strcat(Msg,"\n");
579 DebugMessage(M64MSG_INFO, "Rice Debug: %s", Msg);
584 fprintf(logFp, "%s\n", Msg);
591 while( debuggerPause )
593 if( debuggerDrawRenderTexture )
595 g_pFrameBufferManager->DisplayRenderTexture(debuggerDrawRenderTextureNo);
596 debuggerDrawRenderTexture = false;
599 debuggerPause = false;
603 void __cdecl LOG_UCODE(const char* szFormat, ...)
609 va_start(va, szFormat);
610 vsprintf( Msg, szFormat, va );
612 DebuggerAppendMsg("%s\n", Msg);
616 void DumpHex(uint32 rdramAddr, int count)
618 rdramAddr &= 0xFFFFFFF0;
619 uint32 *ptr = (uint32 *)((rdramAddr&(g_dwRamSize-1))+g_pRDRAMu8);
621 for( int i=0; i<(count+3)/4; i++)
623 DebuggerAppendMsg("%08X: %08X, %08X, %08X, %08X\n",
624 rdramAddr+i*16, ptr[i*4], ptr[i*4+1], ptr[i*4+2], ptr[i*4+3]);
626 DebuggerAppendMsg("\n");
629 uint32 StrToHex(char *HexStr)
633 for(uint32 k = 0; k < strlen(HexStr); k++)
635 if(HexStr[k] <= '9' && HexStr[k] >= '0')
638 temp += HexStr[k] - '0';
640 else if(HexStr[k] <= 'F' && HexStr[k] >= 'A')
643 temp += HexStr[k] - 'A' + 10;
645 else if(HexStr[k] <= 'f' && HexStr[k] >= 'a')
648 temp += HexStr[k] - 'a' + 10;
659 void DEBUGGER_PAUSE_COUNT_N(uint32 val)
661 if (eventToPause == (int)val)
663 if(debuggerPauseCount>0)
664 debuggerPauseCount--;
665 if(debuggerPauseCount==0)
667 CGraphicsContext::Get()->UpdateFrame();
668 debuggerPause = true;
673 void DEBUGGER_PAUSE_COUNT_N_WITHOUT_UPDATE(uint32 val)
675 if(eventToPause == (int)val)
677 if(debuggerPauseCount>0)
678 debuggerPauseCount--;
679 if(debuggerPauseCount==0)
681 debuggerPauseCount = countToPause;
682 debuggerPause = true;
687 void DumpMatrix2(const Matrix &mat, const char* prompt)
689 DebuggerAppendMsg(prompt);
691 " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n"
692 " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n"
693 " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n"
694 " %#+12.5f %#+12.5f %#+12.5f %#+12.5f\n",
695 mat.m[0][0], mat.m[0][1], mat.m[0][2], mat.m[0][3],
696 mat.m[1][0], mat.m[1][1], mat.m[1][2], mat.m[1][3],
697 mat.m[2][0], mat.m[2][1], mat.m[2][2], mat.m[2][3],
698 mat.m[3][0], mat.m[3][1], mat.m[3][2], mat.m[3][3]);
701 void DumpMatrix(const Matrix &mat, const char* prompt)
703 if( pauseAtNext && logMatrix )
705 DumpMatrix2(mat, prompt);