SDL_directx.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2025 Sam Lantinga <[email protected]>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #include "SDL_internal.h"
  19. #ifndef SDL_directx_h_
  20. #define SDL_directx_h_
  21. // Include all of the DirectX 8.0 headers and adds any necessary tweaks
  22. #include "SDL_windows.h"
  23. #include <mmsystem.h>
  24. #ifndef WIN32
  25. #define WIN32
  26. #endif
  27. #undef WINNT
  28. // Far pointers don't exist in 32-bit code
  29. #ifndef FAR
  30. #define FAR
  31. #endif
  32. // Error codes not yet included in Win32 API header files
  33. #ifndef MAKE_HRESULT
  34. #define MAKE_HRESULT(sev, fac, code) \
  35. ((HRESULT)(((unsigned long)(sev) << 31) | ((unsigned long)(fac) << 16) | ((unsigned long)(code))))
  36. #endif
  37. #ifndef S_OK
  38. #define S_OK (HRESULT)0x00000000L
  39. #endif
  40. #ifndef SUCCEEDED
  41. #define SUCCEEDED(x) ((HRESULT)(x) >= 0)
  42. #endif
  43. #ifndef FAILED
  44. #define FAILED(x) ((HRESULT)(x) < 0)
  45. #endif
  46. #ifndef E_FAIL
  47. #define E_FAIL (HRESULT)0x80000008L
  48. #endif
  49. #ifndef E_NOINTERFACE
  50. #define E_NOINTERFACE (HRESULT)0x80004002L
  51. #endif
  52. #ifndef E_OUTOFMEMORY
  53. #define E_OUTOFMEMORY (HRESULT)0x8007000EL
  54. #endif
  55. #ifndef E_INVALIDARG
  56. #define E_INVALIDARG (HRESULT)0x80070057L
  57. #endif
  58. #ifndef E_NOTIMPL
  59. #define E_NOTIMPL (HRESULT)0x80004001L
  60. #endif
  61. #ifndef REGDB_E_CLASSNOTREG
  62. #define REGDB_E_CLASSNOTREG (HRESULT)0x80040154L
  63. #endif
  64. // Severity codes
  65. #ifndef SEVERITY_ERROR
  66. #define SEVERITY_ERROR 1
  67. #endif
  68. // Error facility codes
  69. #ifndef FACILITY_WIN32
  70. #define FACILITY_WIN32 7
  71. #endif
  72. #ifndef FIELD_OFFSET
  73. #define FIELD_OFFSET(type, field) ((LONG) & (((type *)0)->field))
  74. #endif
  75. /* DirectX headers (if it isn't included, I haven't tested it yet)
  76. */
  77. // We need these defines to mark what version of DirectX API we use
  78. #define DIRECTDRAW_VERSION 0x0700
  79. #define DIRECTSOUND_VERSION 0x0800
  80. #define DIRECTINPUT_VERSION 0x0800 // Need version 7 for force feedback. Need version 8 so IDirectInput8_EnumDevices doesn't leak like a sieve...
  81. #ifdef HAVE_DDRAW_H
  82. #include <ddraw.h>
  83. #endif
  84. #ifdef HAVE_DSOUND_H
  85. #include <dsound.h>
  86. #endif
  87. #ifdef HAVE_DINPUT_H
  88. #include <dinput.h>
  89. #else
  90. typedef struct
  91. {
  92. int unused;
  93. } DIDEVICEINSTANCE;
  94. #endif
  95. #endif // SDL_directx_h_