Path: blob/master/libmupen64plus/mupen64plus-video-rice/src/Debugger.h
2 views
/*1Copyright (C) 2002 Rice196423This program is free software; you can redistribute it and/or4modify it under the terms of the GNU General Public License5as published by the Free Software Foundation; either version 26of the License, or (at your option) any later version.78This program is distributed in the hope that it will be useful,9but WITHOUT ANY WARRANTY; without even the implied warranty of10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11GNU General Public License for more details.1213You should have received a copy of the GNU General Public License14along with this program; if not, write to the Free Software15Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.1617*/1819#if !defined(DEBUGGER_H)20#define DEBUGGER_H2122#include "typedefs.h"2324#if defined(DEBUGGER)2526// Debugger.h : header file27//2829/////////////////////////////////////////////////////////////////////////////30// CDebugger dialog31extern bool debuggerWinOpened;3233extern bool logCombiners;34extern bool logTriangles;35extern bool logVertex;36extern bool logWarning;37extern bool logTextures;38extern bool logTextureBuffer;39extern bool logMatrix;40extern bool logToScreen;41extern bool logToFile;42extern bool logUcodes;43extern bool logMicrocode;44extern bool logFog;45extern bool logDetails;464748extern bool debuggerEnableTexture;49extern bool debuggerEnableZBuffer;50extern bool debuggerEnableCullFace;51extern bool debuggerEnableTestTris;52extern bool debuggerEnableAlphaTest;53extern bool debuggerContinueWithUnknown;5455extern bool debuggerPause;56extern bool pauseAtNext;57extern int eventToPause;58extern int debuggerPauseCount;59extern int countToPause;6061extern bool debuggerDropCombiners;62extern bool debuggerDropGeneralCombiners;63extern bool debuggerDropDecodedMux;64extern bool debuggerDropCombinerInfos;6566enum {67NEXT_FRAME,68NEXT_FLUSH_TRI,69NEXT_TEXTRECT,70NEXT_TRIANGLE,71NEXT_SET_CIMG,72NEXT_OBJ_TXT_CMD,73NEXT_OBJ_BG,74NEXT_SPRITE_2D,75NEXT_FILLRECT,76NEXT_DLIST,77NEXT_UCODE,78NEXT_RENDER_TEXTURE,79NEXT_MATRIX_CMD,80NEXT_VERTEX_CMD,81NEXT_NEW_TEXTURE,82NEXT_SET_TEXTURE,83NEXT_MUX,84NEXT_SET_LIGHT,85NEXT_SET_MODE_CMD,86NEXT_SET_PRIM_COLOR,87NEXT_TEXTURE_CMD,88NEXT_UNKNOWN_OP,89NEXT_SCALE_IMG,90NEXT_LOADTLUT,91NEXT_SWITCH_UCODE,92};9394void DebuggerPause();95void __cdecl DebuggerAppendMsg(const char * Message, ...);96void DumpHex(uint32 rdramAddr, int count);9798void DumpMatrix(const Matrix &mtx, const char* prompt);99100//Some common used macros101#define DEBUG_DUMP_VERTEXES(str, v0, v1, v2) \102if( (pauseAtNext && (eventToPause == NEXT_TRIANGLE || eventToPause == NEXT_FLUSH_TRI)) && logTriangles ) \103{ \104DebuggerAppendMsg("%s:%d(%08X),%d(%08X),%d(%08X)\n", (str),\105(v0), GetVertexDiffuseColor((v0)), \106(v1), GetVertexDiffuseColor((v1)), \107(v2), GetVertexDiffuseColor((v2))); \108}109110#define DEBUGGER_IF(op) if(op)111#define DEBUGGER_PAUSE(op) if(pauseAtNext && eventToPause == op){pauseAtNext = false;CGraphicsContext::Get()->UpdateFrame(); debuggerPause = true;}112extern void DEBUGGER_PAUSE_COUNT_N(uint32 event);113extern void DEBUGGER_PAUSE_COUNT_N_WITHOUT_UPDATE(uint32 val);114#define DebuggerPauseCountN DEBUGGER_PAUSE_COUNT_N115#define DEBUGGER_PAUSE_AND_DUMP(op,dumpfuc) \116if(pauseAtNext && eventToPause == op) \117{ pauseAtNext = false;debuggerPause = true; CGraphicsContext::Get()->UpdateFrame(); dumpfuc;}118#define DEBUGGER_PAUSE_AND_DUMP_NO_UPDATE(op,dumpfuc) \119if(pauseAtNext && eventToPause == op) \120{ pauseAtNext = false;debuggerPause = true; dumpfuc;}121122#define DEBUGGER_PAUSE_AND_DUMP_COUNT_N(op,dumpfuc) \123if(pauseAtNext && eventToPause == op) \124{ if( debuggerPauseCount > 0 ) debuggerPauseCount--; if( debuggerPauseCount == 0 ){pauseAtNext = false;debuggerPause = true; CGraphicsContext::Get()->UpdateFrame(); dumpfuc;}}125126#define DEBUGGER_PAUSE_AT_COND_AND_DUMP_COUNT_N(cond,dumpfuc) \127if(pauseAtNext && (cond) ) \128{ if( debuggerPauseCount > 0 ) debuggerPauseCount--; if( debuggerPauseCount == 0 ){pauseAtNext = false;debuggerPause = true; CGraphicsContext::Get()->UpdateFrame(); dumpfuc;}}129130void RDP_NOIMPL_Real(const char* op,uint32,uint32) ;131#define RSP_RDP_NOIMPL RDP_NOIMPL_Real132#define DEBUGGER_IF_DUMP(cond, dumpfunc) {if(cond) {dumpfunc}}133#define TXTRBUF_DUMP(dumpfunc) DEBUGGER_IF_DUMP((logTextureBuffer), dumpfunc)134#define TXTRBUF_DETAIL_DUMP(dumpfunc) DEBUGGER_IF_DUMP((logTextureBuffer&&logDetails), dumpfunc)135#define TXTRBUF_OR_CI_DUMP(dumpfunc) DEBUGGER_IF_DUMP((logTextureBuffer || (pauseAtNext && eventToPause == NEXT_SET_CIMG)), dumpfunc)136#define TXTRBUF_OR_CI_DETAIL_DUMP(dumpfunc) DEBUGGER_IF_DUMP(((logTextureBuffer || (pauseAtNext && eventToPause == NEXT_SET_CIMG))&&logDetails), dumpfunc)137#define VTX_DUMP(dumpfunc) DEBUGGER_IF_DUMP((logVertex && pauseAtNext), dumpfunc)138#define TRI_DUMP(dumpfunc) DEBUGGER_IF_DUMP((logTriangles && pauseAtNext), dumpfunc)139#define LIGHT_DUMP(dumpfunc) DEBUGGER_IF_DUMP((eventToPause == NEXT_SET_LIGHT && pauseAtNext), dumpfunc)140#define WARNING(dumpfunc) DEBUGGER_IF_DUMP(logWarning, dumpfunc)141#define FOG_DUMP(dumpfunc) DEBUGGER_IF_DUMP(logFog, dumpfunc)142#define LOG_TEXTURE(dumpfunc) DEBUGGER_IF_DUMP((logTextures || (pauseAtNext && eventToPause==NEXT_TEXTURE_CMD) ), dumpfunc)143#define DEBUGGER_ONLY_IF DEBUGGER_IF_DUMP144#define DEBUGGER_ONLY(func) {func}145146#define TRACE0(arg0) {DebuggerAppendMsg(arg0);}147#define TRACE1(arg0,arg1) {DebuggerAppendMsg(arg0,arg1);}148#define TRACE2(arg0,arg1,arg2) {DebuggerAppendMsg(arg0,arg1,arg2);}149#define TRACE3(arg0,arg1,arg2,arg3) {DebuggerAppendMsg(arg0,arg1,arg2,arg3);}150#define TRACE4(arg0,arg1,arg2,arg3,arg4) {DebuggerAppendMsg(arg0,arg1,arg2,arg3,arg4);}151#define TRACE5(arg0,arg1,arg2,arg3,arg4,arg5) {DebuggerAppendMsg(arg0,arg1,arg2,arg3,arg4,arg5);}152153#define DEBUG_TRIANGLE(dumpfunc) { if(pauseAtNext && eventToPause==NEXT_TRIANGLE ) { eventToPause = NEXT_FLUSH_TRI; debuggerPause = true; DEBUGGER_PAUSE(NEXT_FLUSH_TRI); dumpfunc} }154155#else156#define DEBUG_DUMP_VERTEXES(str, v0, v1, v2)157#define DEBUGGER_IF(op)158#define DEBUGGER_PAUSE(op)159#define DEBUGGER_PAUSE_COUNT_N(op)160#define DEBUGGER_PAUSE_AND_DUMP(op,dumpfuc)161#define DebuggerPauseCountN DEBUGGER_PAUSE_COUNT_N162#define DEBUGGER_PAUSE_AT_COND_AND_DUMP_COUNT_N(cond,dumpfuc)163#define DEBUGGER_PAUSE_AND_DUMP_COUNT_N(op,dumpfuc)164#define DEBUGGER_PAUSE_COUNT_N_WITHOUT_UPDATE(op)165#define DEBUGGER_PAUSE_AND_DUMP_NO_UPDATE(op,dumpfuc)166#define RSP_RDP_NOIMPL(a,b,c)167void __cdecl DebuggerAppendMsg(const char * Message, ...);168#define DumpHex(rdramAddr, count)169#define DEBUGGER_IF_DUMP(cond, dumpfunc)170#define TXTRBUF_DUMP(dumpfunc)171#define TXTRBUF_DETAIL_DUMP(dumpfunc)172#define TXTRBUF_OR_CI_DUMP(dumpfunc)173#define TXTRBUF_OR_CI_DETAIL_DUMP(dumpfunc)174#define VTX_DUMP(dumpfunc)175#define TRI_DUMP(dumpfunc)176#define LIGHT_DUMP(dumpfunc)177#define WARNING(dumpfunc)178#define FOG_DUMP(dumpfunc)179#define LOG_TEXTURE(dumpfunc)180#define DEBUGGER_ONLY_IF DEBUGGER_IF_DUMP181#define DEBUGGER_ONLY(func)182#define DumpMatrix(a,b)183184#define TRACE0(arg0) {}185#define TRACE1(arg0,arg1) {}186#define TRACE2(arg0,arg1,arg2) {}187#define TRACE3(arg0,arg1,arg2,arg3) {}188#define TRACE4(arg0,arg1,arg2,arg3,arg4) {}189#define TRACE5(arg0,arg1,arg2,arg3,arg4,arg5) {}190191#define DEBUG_TRIANGLE(arg0) {}192193#endif194195#endif // !defined(DEBUGGER_H)196197198199