diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index ab879317..eacc8f73 100644 --- a/source/Debugger/Debug.cpp +++ b/source/Debugger/Debug.cpp @@ -333,9 +333,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA int _CmdBreakpointAddCommonArg ( int iArg, int nArg, BreakpointSource_t iSrc, BreakpointOperator_t iCmp, bool bIsTempBreakpoint=false ); void _BWZ_Clear( Breakpoint_t * aBreakWatchZero, int iSlot ); -// Config - Colors - static void _ConfigColorsReset ( void ); - // Config - Save bool ConfigSave_BufferToDisk ( const char *pFileName, ConfigSave_t eConfigSave ); void ConfigSave_PrepareHeader ( const Parameters_e eCategory, const Commands_e eCommandClear ); @@ -2239,7 +2236,7 @@ Update_t CmdConfigColorMono (int nArgs) { if (iParam == PARAM_RESET) { - _ConfigColorsReset(); + ConfigColorsReset(); ConsoleBufferPush( TEXT(" Resetting colors." ) ); } else @@ -8766,86 +8763,6 @@ static void DebugEnd () } -#if _DEBUG -#define DEBUG_COLOR_RAMP 0 -//=========================================================================== -void _SetupColorRamp( const int iPrimary, int & iColor_ ) -{ - TCHAR sRamp[ CONSOLE_WIDTH*2 ] = TEXT(""); -#if DEBUG_COLOR_RAMP - TCHAR sText[ CONSOLE_WIDTH ]; -#endif - - bool bR = (iPrimary & 1) ? true : false; - bool bG = (iPrimary & 2) ? true : false; - bool bB = (iPrimary & 4) ? true : false; - int dStep = 32; - int nLevels = 256 / dStep; - for (int iLevel = nLevels; iLevel > 0; iLevel-- ) - { - int nC = ((iLevel * dStep) - 1); - int nR = bR ? nC : 0; - int nG = bG ? nC : 0; - int nB = bB ? nC : 0; - DWORD nColor = RGB(nR,nG,nB); - g_aColorPalette[ iColor_ ] = nColor; -#if DEBUG_COLOR_RAMP - wsprintf( sText, TEXT("RGB(%3d,%3d,%3d), "), nR, nG, nB ); - _tcscat( sRamp, sText ); -#endif - iColor_++; - } -#if DEBUG_COLOR_RAMP - wsprintf( sText, TEXT(" // %d%d%d\n"), bB, bG, bR ); - _tcscat( sRamp, sText ); - OutputDebugString( sRamp ); - sRamp[0] = 0; -#endif -} -#endif // _DEBUG - - -//=========================================================================== -void _ConfigColorsReset( void ) -{ -// int iColor = 1; // black only has one level, skip it, since black levels same as white levels -// for (int iPrimary = 1; iPrimary < 8; iPrimary++ ) -// { -// _SetupColorRamp( iPrimary, iColor ); -// } - - // Setup default colors - int iColor; - for (iColor = 0; iColor < NUM_DEBUG_COLORS; iColor++ ) - { - COLORREF nColor = g_aColorPalette[ g_aColorIndex[ iColor ] ]; - - int R = (nColor >> 0) & 0xFF; - int G = (nColor >> 8) & 0xFF; - int B = (nColor >> 16) & 0xFF; - - // There are many, many ways of shifting the color domain to the monochrome domain - // NTSC uses 3x3 matrix, could map RGB -> wavelength, etc. - int M = (R + G + B) / 3; // Monochrome component - - int nThreshold = 64; - - int BW; - if (M < nThreshold) - BW = 0; - else - BW = 255; - - COLORREF nMono = RGB(M,M,M); - COLORREF nBW = RGB(BW,BW,BW); - - DebuggerSetColor( SCHEME_COLOR, iColor, nColor ); - DebuggerSetColor( SCHEME_MONO , iColor, nMono ); - DebuggerSetColor( SCHEME_BW , iColor, nBW ); - } -} - - //=========================================================================== void DebugInitialize () { @@ -8939,7 +8856,7 @@ void DebugInitialize () WindowUpdateDisasmSize(); - _ConfigColorsReset(); + ConfigColorsReset(); WindowUpdateConsoleDisplayedSize(); diff --git a/source/Debugger/Debugger_Color.cpp b/source/Debugger/Debugger_Color.cpp index 004336c5..5cf94c0c 100644 --- a/source/Debugger/Debugger_Color.cpp +++ b/source/Debugger/Debugger_Color.cpp @@ -129,9 +129,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA W8 // FG_SOURCE }; - COLORREF g_aColors[ NUM_COLOR_SCHEMES ][ NUM_DEBUG_COLORS ]; -// COLORREF DebuggerGetColor ( int iColor ); +static COLORREF g_aColors[ NUM_COLOR_SCHEMES ][ NUM_DEBUG_COLORS ]; //=========================================================================== @@ -167,3 +166,82 @@ bool DebuggerSetColor( const int iScheme, const int iColor, const COLORREF nColo return bStatus; } + +#if _DEBUG +#define DEBUG_COLOR_RAMP 0 +//=========================================================================== +static void _SetupColorRamp(const int iPrimary, int & iColor_) +{ + TCHAR sRamp[CONSOLE_WIDTH * 2] = TEXT(""); +#if DEBUG_COLOR_RAMP + TCHAR sText[CONSOLE_WIDTH]; +#endif + + bool bR = (iPrimary & 1) ? true : false; + bool bG = (iPrimary & 2) ? true : false; + bool bB = (iPrimary & 4) ? true : false; + int dStep = 32; + int nLevels = 256 / dStep; + for (int iLevel = nLevels; iLevel > 0; iLevel--) + { + int nC = ((iLevel * dStep) - 1); + int nR = bR ? nC : 0; + int nG = bG ? nC : 0; + int nB = bB ? nC : 0; + DWORD nColor = RGB(nR, nG, nB); + g_aColorPalette[iColor_] = nColor; +#if DEBUG_COLOR_RAMP + wsprintf(sText, TEXT("RGB(%3d,%3d,%3d), "), nR, nG, nB); + _tcscat(sRamp, sText); +#endif + iColor_++; + } +#if DEBUG_COLOR_RAMP + wsprintf(sText, TEXT(" // %d%d%d\n"), bB, bG, bR); + _tcscat(sRamp, sText); + OutputDebugString(sRamp); + sRamp[0] = 0; +#endif +} +#endif // _DEBUG + + +//=========================================================================== +void ConfigColorsReset(void) +{ + // int iColor = 1; // black only has one level, skip it, since black levels same as white levels + // for (int iPrimary = 1; iPrimary < 8; iPrimary++ ) + // { + // _SetupColorRamp( iPrimary, iColor ); + // } + + // Setup default colors + int iColor; + for (iColor = 0; iColor < NUM_DEBUG_COLORS; iColor++) + { + COLORREF nColor = g_aColorPalette[g_aColorIndex[iColor]]; + + int R = (nColor >> 0) & 0xFF; + int G = (nColor >> 8) & 0xFF; + int B = (nColor >> 16) & 0xFF; + + // There are many, many ways of shifting the color domain to the monochrome domain + // NTSC uses 3x3 matrix, could map RGB -> wavelength, etc. + int M = (R + G + B) / 3; // Monochrome component + + int nThreshold = 64; + + int BW; + if (M < nThreshold) + BW = 0; + else + BW = 255; + + COLORREF nMono = RGB(M, M, M); + COLORREF nBW = RGB(BW, BW, BW); + + DebuggerSetColor(SCHEME_COLOR, iColor, nColor); + DebuggerSetColor(SCHEME_MONO, iColor, nMono); + DebuggerSetColor(SCHEME_BW, iColor, nBW); + } +} diff --git a/source/Debugger/Debugger_Color.h b/source/Debugger/Debugger_Color.h index f20bea05..50aa4dd2 100644 --- a/source/Debugger/Debugger_Color.h +++ b/source/Debugger/Debugger_Color.h @@ -132,3 +132,4 @@ // Color COLORREF DebuggerGetColor( int iColor ); bool DebuggerSetColor ( const int iScheme, const int iColor, const COLORREF nColor ); + void ConfigColorsReset(void);