/*========================================================================= dbg.cpp Author: PKG Created: Project: Purpose: Copyright (c) 2000 Climax Development Ltd ===========================================================================*/ /*---------------------------------------------------------------------- Includes -------- */ #include "dbg.h" #ifdef DBG_ACTIVE #ifndef __SYSTEM_VSPRINTF_H__ #include "system\vsprintf.h" #endif /* Std Lib ------- */ #include #include #include /* Data ---- */ /*---------------------------------------------------------------------- Tyepdefs && Defines ------------------- */ /* Available options are: DBG_OUTPUT_TO_DEBUGGER Send output to the debug console DBG_OUTPUT_TO_LOG Send output to an internal log DBG_MAX_MESSAGE_LENGTH chars Length of entries in this log DBG_LOG_LINES lines Number of lines in the log buffer DBG_SHOW_MESSAGE_ORIGIN Prepend file and linenumber to messages DBG_FILENAME_LENGTH chars This many chars of the filename are shown DBG_DEFAULT_CHANNEL channelflags Channels to listen to by default */ #ifdef __USER_charles__ #define DBG_OUTPUT_TO_DEBUGGER #define DBG_SHOW_MESSAGE_ORIGIN #define DBG_FILENAME_LENGTH 16 #define DBG_DEFAULT_CHANNEL DC_CHARLES|DC_SYSTEM #elif __USER_daveo__ #define DBG_OUTPUT_TO_DEBUGGER #define DBG_SHOW_MESSAGE_ORIGIN #define DBG_FILENAME_LENGTH 16 #define DBG_DEFAULT_CHANNEL DC_DAVE|DC_SYSTEM #elif __USER_paul__ #define DBG_OUTPUT_TO_DEBUGGER #define DBG_OUTPUT_TO_LOG #define DBG_MAX_MESSAGE_LENGTH 256 #define DBG_LOG_LINES 8 #define DBG_SHOW_MESSAGE_ORIGIN #define DBG_FILENAME_LENGTH 12 #define DBG_DEFAULT_CHANNEL DC_PAUL|DC_SYSTEM|DC_SOUND|DC_GUI|DC_MEMCARD #else #define DBG_OUTPUT_TO_DEBUGGER #define DBG_FILENAME_LENGTH 16 #define DBG_DEFAULT_CHANNEL DC_ALL #endif /*---------------------------------------------------------------------- Structure defintions -------------------- */ /*---------------------------------------------------------------------- Function Prototypes ------------------- */ /*---------------------------------------------------------------------- Vars ---- */ static DEBUG_CHANNEL_FLAG s_activeChannelFlags=(DEBUG_CHANNEL_FLAG)(DBG_DEFAULT_CHANNEL); static int s_dbgTransientChannelFlags=DC_NONE; static char s_dbgTransientFilename[DBG_FILENAME_LENGTH+1]="\0"; static int s_dbgTransientLine=0; #ifdef DBG_OUTPUT_TO_LOG static char s_logLines[DBG_LOG_LINES][DBG_MAX_MESSAGE_LENGTH]; static int s_logLineCount=0; static int s_logLinePtr=0; #endif /*---------------------------------------------------------------------- Function: Purpose: Params: Returns: ---------------------------------------------------------------------- */ void __setActiveDbgChannels(DEBUG_CHANNEL_FLAG _channelFlags) { s_activeChannelFlags=_channelFlags; } /*---------------------------------------------------------------------- Function: Purpose: Params: Returns: ---------------------------------------------------------------------- */ DEBUG_CHANNEL_FLAG __getActiveDbgChannels() { return s_activeChannelFlags; } /*---------------------------------------------------------------------- Function: Purpose: Used by the__DBGMSG() macro Params: Returns: ---------------------------------------------------------------------- */ void __setDbgChannels(DEBUG_CHANNEL_FLAG _channelFlags) { s_dbgTransientChannelFlags=_channelFlags; } /*---------------------------------------------------------------------- Function: Purpose: Used by the__DBGMSG() macro Params: Returns: ---------------------------------------------------------------------- */ void __setDbgFilenameAndLine(const char *_filename,int _line) { int filenameLength; int start,len; filenameLength=strlen(_filename); if(filenameLength> 1), (256 >> 1), Text ); VSync(0); VidSwapDraw(); PrimDisplay(); while(DrawSync(1)); ClearNTag(OtPtr, MAX_OT); F.print( (512 >> 1), (256 >> 1), Text ); VSync(0); VidSwapDraw(); PrimDisplay(); while(DrawSync(1)); F.dump(); #endif PSYQpause(); } /*****************************************************************************/ void DbgPollHost() { #ifndef __CLIMAX_DEVKIT__ #if __FILE_SYSTEM__==PC pollhost(); #endif #endif } #endif /* __VERSION_DEBUG__ */ /*=========================================================================== end */