Subversion Repositories pentevo

Rev

Rev 723 | Blame | Last modification | View Log | Download | RSS feed

  1. #include "std.h"
  2.  
  3. #include "emul.h"
  4. #include "vars.h"
  5. #include "util.h"
  6.  
  7. #ifdef __GNUC__
  8. #define DXGetErrorString DXGetErrorString9
  9. #endif
  10.  
  11. #ifdef EMUL_DEBUG
  12.  
  13.  // lvd {
  14.  #ifdef __GNUC__
  15.   #include <dxerr9.h>
  16.  #else
  17.   #include "dxerr9.h"
  18.  #endif
  19.  // lvd }
  20.  
  21. void printrdd(const char *pr, HRESULT r)
  22. {
  23.    color(CONSCLR_ERROR);
  24.    printf("%s: %s\n", pr, DXGetErrorString(r));
  25.  
  26. #ifdef _DEBUG
  27.    OutputDebugString(pr);
  28.    OutputDebugString(": ");
  29.    OutputDebugString(DXGetErrorString(r));
  30.    OutputDebugString("\n");
  31. #endif
  32. }
  33.  
  34. void printrdi(const char *pr, HRESULT r)
  35. {
  36.    color(CONSCLR_ERROR);
  37.    printf("%s: %s\n", pr, DXGetErrorString(r));
  38.  
  39. #ifdef _DEBUG
  40.    OutputDebugString(pr);
  41.    OutputDebugString(": ");
  42.    OutputDebugString(DXGetErrorString(r));
  43.    OutputDebugString("\n");
  44. #endif
  45. }
  46.  
  47. void printrmm(const char *pr, HRESULT r)
  48. {
  49.    char buf[200]; sprintf(buf, "unknown error (%08lX)", r);
  50.    const char *str = buf;
  51.    switch (r)
  52.    {
  53.       case MMSYSERR_NOERROR: str = "ok"; break;
  54.       case MMSYSERR_INVALHANDLE: str = "MMSYSERR_INVALHANDLE"; break;
  55.       case MMSYSERR_NODRIVER: str = "MMSYSERR_NODRIVER"; break;
  56.       case WAVERR_UNPREPARED: str = "WAVERR_UNPREPARED"; break;
  57.       case MMSYSERR_NOMEM: str = "MMSYSERR_NOMEM"; break;
  58.       case MMSYSERR_ALLOCATED: str = "MMSYSERR_ALLOCATED"; break;
  59.       case WAVERR_BADFORMAT: str = "WAVERR_BADFORMAT"; break;
  60.       case WAVERR_SYNC: str = "WAVERR_SYNC"; break;
  61.       case MMSYSERR_INVALFLAG: str = "MMSYSERR_INVALFLAG"; break;
  62.    }
  63.    color(CONSCLR_ERROR);
  64.    printf("%s: %s\n", pr, str);
  65. }
  66.  
  67. void printrds(const char *pr, HRESULT r)
  68. {
  69.    color(CONSCLR_ERROR);
  70.    printf("%s: 0x%lX, %s\n", pr, r, DXGetErrorString(r));
  71. }
  72. #else
  73. #define printrdd(x,y)
  74. #define printrdi(x,y)
  75. #define printrds(x,y)
  76. #define printrmm(x,y)
  77. #endif
  78.