-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdxerr.cpp
51 lines (46 loc) · 1.35 KB
/
dxerr.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "std.h"
#include "emul.h"
#include "vars.h"
#include "util.h"
#ifdef EMUL_DEBUG
#include "dxerr8.h"
void printrdd(const char *pr, HRESULT r)
{
color(CONSCLR_ERROR);
printf("%s: %s\n", pr, DXGetErrorString8(r));
}
void printrdi(const char *pr, HRESULT r)
{
color(CONSCLR_ERROR);
printf("%s: %s\n", pr, DXGetErrorString8(r));
}
void printrmm(const char *pr, HRESULT r)
{
char buf[200]; sprintf(buf, "unknown error (%08X)", r);
const char *str = buf;
switch (r)
{
case MMSYSERR_NOERROR: str = "ok"; break;
case MMSYSERR_INVALHANDLE: str = "MMSYSERR_INVALHANDLE"; break;
case MMSYSERR_NODRIVER: str = "MMSYSERR_NODRIVER"; break;
case WAVERR_UNPREPARED: str = "WAVERR_UNPREPARED"; break;
case MMSYSERR_NOMEM: str = "MMSYSERR_NOMEM"; break;
case MMSYSERR_ALLOCATED: str = "MMSYSERR_ALLOCATED"; break;
case WAVERR_BADFORMAT: str = "WAVERR_BADFORMAT"; break;
case WAVERR_SYNC: str = "WAVERR_SYNC"; break;
case MMSYSERR_INVALFLAG: str = "MMSYSERR_INVALFLAG"; break;
}
color(CONSCLR_ERROR);
printf("%s: %s\n", pr, str);
}
void printrds(const char *pr, HRESULT r)
{
color(CONSCLR_ERROR);
printf("%s: %s\n", pr, DXGetErrorString8(r));
}
#else
#define printrdd(x,y)
#define printrdi(x,y)
#define printrds(x,y)
#define printrmm(x,y)
#endif