Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
1.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. /* CDbgOutput.cpp
  3. *****************************************************************************/
  4. #define WIN32_LEAN_AND_MEAN
  5. #define STRICT
  6. #include <windows.h>
  7. #include <dbghelp.h>
  8. #include <dbgeng.h>
  9. #include "vgui/IVGui.h"
  10. #include "vgui/IPanel.h"
  11. #include "tier1/KeyValues.h"
  12. #include "vgui_controls/Frame.h"
  13. #include "CMDRipperMain.h"
  14. #include "CDbgOutput.h"
  15. using namespace vgui;
  16. CDbgOutput::CDbgOutput()
  17. {
  18. m_iRefCount = 0;
  19. m_Target = 0;
  20. }
  21. CDbgOutput::~CDbgOutput()
  22. {
  23. }
  24. STDMETHODIMP CDbgOutput::QueryInterface( THIS_ IN REFIID InterfaceId,
  25. OUT PVOID* Interface)
  26. {
  27. *Interface = NULL;
  28. if ( IsEqualIID( InterfaceId, __uuidof( IUnknown ) ) ||
  29. IsEqualIID( InterfaceId, __uuidof( IDebugOutputCallbacks ) ) )
  30. {
  31. *Interface = ( IDebugOutputCallbacks * )this;
  32. AddRef( );
  33. return S_OK;
  34. }
  35. else
  36. {
  37. return E_NOINTERFACE;
  38. }
  39. }
  40. STDMETHODIMP_( ULONG )CDbgOutput::AddRef( THIS )
  41. {
  42. return ( ++m_iRefCount );
  43. }
  44. STDMETHODIMP_( ULONG )CDbgOutput::Release( THIS )
  45. {
  46. return ( --m_iRefCount );
  47. }
  48. STDMETHODIMP CDbgOutput::Output( THIS_ IN ULONG Mask, IN PCSTR Text )
  49. {
  50. if (Text)
  51. {
  52. KeyValues *pkv = new KeyValues( "DebugOutput", "iMask", Mask );
  53. pkv->SetString( "pszDebugText", Text );
  54. ivgui()->DPrintf( "CDbgOutput::Output() about to post [%s]", Text );
  55. g_pCMDRipperMain->PostMessage( m_Target, pkv );
  56. }
  57. return S_OK;
  58. }
  59. void CDbgOutput::SetOutputPanel( vgui::VPANEL Target )
  60. {
  61. m_Target = Target;
  62. }
  63. /* CDbgOutput.cpp */