dderror.cpp 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // HRESULT converter
  4. //
  5. //////////////////////////////////////////////////////////////////////////////
  6. #include "pch.h"
  7. #include "ddraw.h"
  8. #include "d3d.h"
  9. #include "d3drm.h"
  10. #include "dinput.h"
  11. #ifdef _DEBUG
  12. class HRESULTInfo {
  13. public:
  14. HRESULT hresult;
  15. char* pszError;
  16. char* pszText;
  17. };
  18. HRESULTInfo gpinfo[] =
  19. {
  20. /*************************/
  21. /*** DirectDraw Errors ***/
  22. /*************************/
  23. {DDERR_ALREADYINITIALIZED, "DDERR_ALREADYINITIALIZED",
  24. "This object is already initialized"},
  25. {DDERR_CANNOTATTACHSURFACE, "DDERR_CANNOTATTACHSURFACE",
  26. "This surface can not be attached to the requested surface"},
  27. {DDERR_CANNOTDETACHSURFACE, "DDERR_CANNOTDETACHSURFACE",
  28. "This surface can not be detached from the requested surface"},
  29. {DDERR_CURRENTLYNOTAVAIL, "DDERR_CURRENTLYNOTAVAIL",
  30. "Support is currently not available"},
  31. {DDERR_EXCEPTION, "DDERR_EXCEPTION",
  32. "An exception was encountered while performing the requested "
  33. "operation"},
  34. {DDERR_GENERIC, "DDERR_GENERIC",
  35. "Generic failure"},
  36. {DDERR_HEIGHTALIGN, "DDERR_HEIGHTALIGN",
  37. "Height of rectangle provided is not a multiple of required "
  38. "alignment"},
  39. {DDERR_INCOMPATIBLEPRIMARY, "DDERR_INCOMPATIBLEPRIMARY",
  40. "Unable to match primary surface creation request with existing "
  41. "primary surface"},
  42. {DDERR_INVALIDCAPS, "DDERR_INVALIDCAPS",
  43. "One or more of the caps bits passed to the callback are incorrect"},
  44. {DDERR_INVALIDCLIPLIST, "DDERR_INVALIDCLIPLIST",
  45. "DirectDraw does not support provided Cliplist"},
  46. {DDERR_INVALIDMODE, "DDERR_INVALIDMODE",
  47. "DirectDraw does not support the requested mode"},
  48. {DDERR_INVALIDOBJECT, "DDERR_INVALIDOBJECT",
  49. "DirectDraw received a pointer that was an invalid DIRECTDRAW object"},
  50. {DDERR_INVALIDPARAMS, "DDERR_INVALIDPARAMS",
  51. "One or more of the parameters passed to the method are incorrect."},
  52. {DDERR_INVALIDPIXELFORMAT, "DDERR_INVALIDPIXELFORMAT",
  53. "Pixel format was invalid as specified"},
  54. {DDERR_INVALIDRECT, "DDERR_INVALIDRECT",
  55. "Rectangle provided was invalid"},
  56. {DDERR_LOCKEDSURFACES, "DDERR_LOCKEDSURFACES",
  57. "Operation could not be carried out because one or more surfaces "
  58. "are locked"},
  59. {DDERR_NO3D, "DDERR_NO3D",
  60. "There is no 3D present"},
  61. {DDERR_NOALPHAHW, "DDERR_NOALPHAHW",
  62. "Operation could not be carried out because there is no alpha "
  63. "accleration hardware present or available"},
  64. {DDERR_NOCLIPLIST, "DDERR_NOCLIPLIST",
  65. "No clip list available"},
  66. {DDERR_NOCOLORCONVHW, "DDERR_NOCOLORCONVHW",
  67. "Operation could not be carried out because there is no color "
  68. "conversion hardware present or available"},
  69. {DDERR_NOCOOPERATIVELEVELSET, "DDERR_NOCOOPERATIVELEVELSET",
  70. "Create function called without DirectDraw object method "
  71. "SetCooperativeLevel being called"},
  72. {DDERR_NOCOLORKEY, "DDERR_NOCOLORKEY",
  73. "Surface doesn't currently have a color key"},
  74. {DDERR_NOCOLORKEYHW, "DDERR_NOCOLORKEYHW",
  75. "Operation could not be carried out because there is no "
  76. "hardware support of the destination color key"},
  77. {DDERR_NODIRECTDRAWSUPPORT, "DDERR_NODIRECTDRAWSUPPORT",
  78. "No DirectDraw support possible with current display driver"},
  79. {DDERR_NOEXCLUSIVEMODE, "DDERR_NOEXCLUSIVEMODE",
  80. "Operation requires the application to have exclusive mode "
  81. "but the application does not have exclusive mode"},
  82. {DDERR_NOFLIPHW, "DDERR_NOFLIPHW",
  83. "Flipping visible surfaces is not supported"},
  84. {DDERR_NOGDI, "DDERR_NOGDI",
  85. "There is no GDI present"},
  86. {DDERR_NOMIRRORHW, "DDERR_NOMIRRORHW",
  87. "Operation could not be carried out because there is "
  88. "no hardware present or available"},
  89. {DDERR_NOTFOUND, "DDERR_NOTFOUND",
  90. "Requested item was not found"},
  91. {DDERR_NOOVERLAYHW, "DDERR_NOOVERLAYHW",
  92. "Operation could not be carried out because there is "
  93. "no overlay hardware present or available"},
  94. {DDERR_NORASTEROPHW, "DDERR_NORASTEROPHW",
  95. "Operation could not be carried out because there is "
  96. "no appropriate raster op hardware present or available"},
  97. {DDERR_NOROTATIONHW, "DDERR_NOROTATIONHW",
  98. "Operation could not be carried out because there is "
  99. "no rotation hardware present or available"},
  100. {DDERR_NOSTRETCHHW, "DDERR_NOSTRETCHHW",
  101. "Operation could not be carried out because there is "
  102. "no hardware support for stretching"},
  103. {DDERR_NOT4BITCOLOR, "DDERR_NOT4BITCOLOR",
  104. "DirectDrawSurface is not in 4 bit color palette and "
  105. "the requested operation requires 4 bit color palette"},
  106. {DDERR_NOT4BITCOLORINDEX, "DDERR_NOT4BITCOLORINDEX",
  107. "DirectDrawSurface is not in 4 bit color index palette "
  108. "and the requested operation requires 4 bit color index palette"},
  109. {DDERR_NOT8BITCOLOR, "DDERR_NOT8BITCOLOR",
  110. "DirectDraw Surface is not in 8 bit color mode "
  111. "and the requested operation requires 8 bit color"},
  112. {DDERR_NOTEXTUREHW, "DDERR_NOTEXTUREHW",
  113. "Operation could not be carried out because there is "
  114. "no texture mapping hardware present or available"},
  115. {DDERR_NOVSYNCHW, "DDERR_NOVSYNCHW",
  116. "Operation could not be carried out because there is "
  117. "no hardware support for vertical blank synchronized operations"},
  118. {DDERR_NOZBUFFERHW, "DDERR_NOZBUFFERHW",
  119. "Operation could not be carried out because there is "
  120. "no hardware support for zbuffer blting"},
  121. {DDERR_NOZOVERLAYHW, "DDERR_NOZOVERLAYHW",
  122. "Overlay surfaces could not be z layered based on their "
  123. "BltOrder because the hardware does not support z layering of overlays"},
  124. {DDERR_OUTOFCAPS, "DDERR_OUTOFCAPS",
  125. "The hardware needed for the requested operation has "
  126. "already been allocated"},
  127. {DDERR_OUTOFMEMORY, "DDERR_OUTOFMEMORY",
  128. "DirectDraw does not have enough memory to perform the operation"},
  129. {DDERR_OUTOFVIDEOMEMORY, "DDERR_OUTOFVIDEOMEMORY",
  130. "DirectDraw does not have enough memory to perform the operation"},
  131. {DDERR_OVERLAYCANTCLIP, "DDERR_OVERLAYCANTCLIP",
  132. "hardware does not support clipped overlays"},
  133. {DDERR_OVERLAYCOLORKEYONLYONEACTIVE, "DDERR_OVERLAYCOLORKEYONLYONEACTIVE",
  134. "Can only have ony color key active at one time for overlays"},
  135. {DDERR_PALETTEBUSY, "DDERR_PALETTEBUSY",
  136. "Access to this palette is being refused because the palette "
  137. "is already locked by another thread"},
  138. {DDERR_COLORKEYNOTSET, "DDERR_COLORKEYNOTSET",
  139. "No src color key specified for this operation"},
  140. {DDERR_SURFACEALREADYATTACHED, "DDERR_SURFACEALREADYATTACHED",
  141. "This surface is already attached to the surface it is "
  142. "being attached to"},
  143. {DDERR_SURFACEALREADYDEPENDENT, "DDERR_SURFACEALREADYDEPENDENT",
  144. "This surface is already a dependency of the surface it "
  145. "is being made a dependency of"},
  146. {DDERR_SURFACEBUSY, "DDERR_SURFACEBUSY",
  147. "Access to this surface is being refused because the surface "
  148. "is already locked by another thread"},
  149. {DDERR_SURFACEISOBSCURED, "DDERR_SURFACEISOBSCURED",
  150. "Access to Surface refused because Surface is obscured"},
  151. {DDERR_SURFACELOST, "DDERR_SURFACELOST",
  152. "The DIRECTDRAWSURFACE object representing this surface "
  153. "should have Restore called on it. Access to this surface is "
  154. "being refused because the surface is gone"},
  155. {DDERR_SURFACENOTATTACHED, "DDERR_SURFACENOTATTACHED",
  156. "The requested surface is not attached"},
  157. {DDERR_TOOBIGHEIGHT, "DDERR_TOOBIGHEIGHT",
  158. "Height requested by DirectDraw is too large"},
  159. {DDERR_TOOBIGSIZE, "DDERR_TOOBIGSIZE",
  160. "Size requested by DirectDraw is too large. The individual height "
  161. "and width are OK"},
  162. {DDERR_TOOBIGWIDTH, "DDERR_TOOBIGWIDTH",
  163. "Width requested by DirectDraw is too large"},
  164. {DDERR_UNSUPPORTED, "DDERR_UNSUPPORTED",
  165. "Action not supported"},
  166. {DDERR_UNSUPPORTEDFORMAT, "DDERR_UNSUPPORTEDFORMAT",
  167. "FOURCC format requested is unsupported by DirectDraw"},
  168. {DDERR_UNSUPPORTEDMASK, "DDERR_UNSUPPORTEDMASK",
  169. "Bitmask in the pixel format requested is unsupported by DirectDraw"},
  170. {DDERR_VERTICALBLANKINPROGRESS, "DDERR_VERTICALBLANKINPROGRESS",
  171. "vertical blank is in progress"},
  172. {DDERR_WASSTILLDRAWING, "DDERR_WASSTILLDRAWING",
  173. "Informs DirectDraw that the previous Blt which is "
  174. "transfering information to or from this Surface is incomplete"},
  175. {DDERR_XALIGN, "DDERR_XALIGN",
  176. "Rectangle provided was not horizontally aligned on required boundary"},
  177. {DDERR_INVALIDDIRECTDRAWGUID, "DDERR_INVALIDDIRECTDRAWGUID",
  178. "The GUID passed to DirectDrawCreate is not a valid DirectDraw driver "
  179. "identifier"},
  180. {DDERR_DIRECTDRAWALREADYCREATED, "DDERR_DIRECTDRAWALREADYCREATED",
  181. "A DirectDraw object representing this driver has already been "
  182. "created for this process"},
  183. {DDERR_NODIRECTDRAWHW, "DDERR_NODIRECTDRAWHW",
  184. "A hardware only DirectDraw object creation was attempted "
  185. "but the driver did not support any hardware"},
  186. {DDERR_PRIMARYSURFACEALREADYEXISTS, "DDERR_PRIMARYSURFACEALREADYEXISTS",
  187. "This process already has created a primary surface"},
  188. {DDERR_NOEMULATION, "DDERR_NOEMULATION",
  189. "Software emulation not available"},
  190. {DDERR_REGIONTOOSMALL, "DDERR_REGIONTOOSMALL",
  191. "Region passed to Clipper::GetClipList is too small"},
  192. {DDERR_CLIPPERISUSINGHWND, "DDERR_CLIPPERISUSINGHWND",
  193. "An attempt was made to set a clip list for a clipper objec that is "
  194. "already monitoring an hwnd"},
  195. {DDERR_NOCLIPPERATTACHED, "DDERR_NOCLIPPERATTACHED",
  196. "No clipper object attached to surface object"},
  197. {DDERR_NOHWND, "DDERR_NOHWND",
  198. "Clipper notification requires an HWND or no HWND has previously "
  199. "been set as the CooperativeLevel HWND"},
  200. {DDERR_HWNDSUBCLASSED, "DDERR_HWNDSUBCLASSED",
  201. "HWND used by DirectDraw CooperativeLevel has been subclassed, "
  202. "this prevents DirectDraw from restoring state"},
  203. {DDERR_HWNDALREADYSET, "DDERR_HWNDALREADYSET",
  204. "The CooperativeLevel HWND has already been set. It can not be "
  205. "reset while the process has surfaces or palettes created"},
  206. {DDERR_NOPALETTEATTACHED, "DDERR_NOPALETTEATTACHED",
  207. "No palette object attached to this surface"},
  208. {DDERR_NOPALETTEHW, "DDERR_NOPALETTEHW",
  209. "No hardware support for 16 or 256 color palettes"},
  210. {DDERR_BLTFASTCANTCLIP, "DDERR_BLTFASTCANTCLIP",
  211. "If a clipper object is attached to the source surface passed "
  212. "into a BltFast call"},
  213. {DDERR_NOBLTHW, "DDERR_NOBLTHW",
  214. "No blitter hardware"},
  215. {DDERR_NODDROPSHW, "DDERR_NODDROPSHW",
  216. "No DirectDraw ROP hardware"},
  217. {DDERR_OVERLAYNOTVISIBLE, "DDERR_OVERLAYNOTVISIBLE",
  218. "GetOverlayPosition called on a hidden overlay"},
  219. {DDERR_NOOVERLAYDEST, "DDERR_NOOVERLAYDEST",
  220. "GetOverlayPosition called on a overlay that "
  221. "UpdateOverlay has never been called on to establish a destination"},
  222. {DDERR_INVALIDPOSITION, "DDERR_INVALIDPOSITION",
  223. "The position of the overlay on the destination is "
  224. "no longer legal for that destination"},
  225. {DDERR_NOTAOVERLAYSURFACE, "DDERR_NOTAOVERLAYSURFACE",
  226. "Overlay member called for a non-overlay surface"},
  227. {DDERR_EXCLUSIVEMODEALREADYSET, "DDERR_EXCLUSIVEMODEALREADYSET",
  228. "An attempt was made to set the cooperative level when it was "
  229. "already set to exclusive"},
  230. {DDERR_NOTFLIPPABLE, "DDERR_NOTFLIPPABLE",
  231. "An attempt has been made to flip a surface that is not flippable"},
  232. {DDERR_CANTDUPLICATE, "DDERR_CANTDUPLICATE",
  233. "Can't duplicate primary & 3D surfaces, or surfaces that are "
  234. "implicitly created"},
  235. {DDERR_NOTLOCKED, "DDERR_NOTLOCKED",
  236. "Surface was not locked. An attempt to unlock a surface that was "
  237. "not locked at all, or by this process, has been attempted"},
  238. {DDERR_CANTCREATEDC, "DDERR_CANTCREATEDC",
  239. "Windows can not create any more DCs"},
  240. {DDERR_NODC, "DDERR_NODC",
  241. "No DC was ever created for this surface"},
  242. {DDERR_WRONGMODE, "DDERR_WRONGMODE",
  243. "This surface can not be restored because it was created in a "
  244. "different mode"},
  245. {DDERR_IMPLICITLYCREATED, "DDERR_IMPLICITLYCREATED",
  246. "This surface can not be restored because it is an implicitly "
  247. "created surface"},
  248. {DDERR_NOTPALETTIZED, "DDERR_NOTPALETTIZED",
  249. "The surface being used is not a palette-based surface"},
  250. {DDERR_UNSUPPORTEDMODE, "DDERR_UNSUPPORTEDMODE",
  251. "The display is currently in an unsupported mode"},
  252. /******************/
  253. /*** D3D Errors ***/
  254. /******************/
  255. {D3DERR_BADMAJORVERSION, "D3DERR_BADMAJORVERSION",
  256. "Bad major version"},
  257. {D3DERR_BADMINORVERSION, "D3DERR_BADMINORVERSION",
  258. "Bad minor version"},
  259. {D3DERR_EXECUTE_CREATE_FAILED, "D3DERR_EXECUTE_CREATE_FAILED",
  260. "Execute buffer create failed"},
  261. {D3DERR_EXECUTE_DESTROY_FAILED, "D3DERR_EXECUTE_DESTROY_FAILED",
  262. "Execute buffer destroy failed"},
  263. {D3DERR_EXECUTE_LOCK_FAILED, "D3DERR_EXECUTE_LOCK_FAILED",
  264. "Execute buffer lock failed"},
  265. {D3DERR_EXECUTE_UNLOCK_FAILED, "D3DERR_EXECUTE_UNLOCK_FAILED",
  266. "Execute buffer unlock failed"},
  267. {D3DERR_EXECUTE_LOCKED, "D3DERR_EXECUTE_LOCKED",
  268. "Execute buffer locked"},
  269. {D3DERR_EXECUTE_NOT_LOCKED, "D3DERR_EXECUTE_NOT_LOCKED",
  270. "Execute buffer not locked"},
  271. {D3DERR_EXECUTE_FAILED, "D3DERR_EXECUTE_FAILED",
  272. "Execute buffer execute failed"},
  273. {D3DERR_EXECUTE_CLIPPED_FAILED, "D3DERR_EXECUTE_CLIPPED_FAILED",
  274. "Execute buffer execute clipped failed"},
  275. {D3DERR_TEXTURE_NO_SUPPORT, "D3DERR_TEXTURE_NO_SUPPORT",
  276. "Texture not supported"},
  277. {D3DERR_TEXTURE_CREATE_FAILED, "D3DERR_TEXTURE_CREATE_FAILED",
  278. "Texture create failed"},
  279. {D3DERR_TEXTURE_DESTROY_FAILED, "D3DERR_TEXTURE_DESTROY_FAILED",
  280. "Texture destroy failed"},
  281. {D3DERR_TEXTURE_LOCK_FAILED, "D3DERR_TEXTURE_LOCK_FAILED",
  282. "Texture lock failed"},
  283. {D3DERR_TEXTURE_UNLOCK_FAILED, "D3DERR_TEXTURE_UNLOCK_FAILED",
  284. "Texture unlock failed"},
  285. {D3DERR_TEXTURE_LOAD_FAILED, "D3DERR_TEXTURE_LOAD_FAILED",
  286. "Texture load failed"},
  287. {D3DERR_TEXTURE_SWAP_FAILED, "D3DERR_TEXTURE_SWAP_FAILED",
  288. "Texture swap failed"},
  289. {D3DERR_TEXTURE_LOCKED, "D3DERR_TEXTURE_LOCKED",
  290. "Texture locked"},
  291. {D3DERR_TEXTURE_NOT_LOCKED, "D3DERR_TEXTURE_NOT_LOCKED",
  292. "Texture not locked"},
  293. {D3DERR_TEXTURE_GETSURF_FAILED, "D3DERR_TEXTURE_GETSURF_FAILED",
  294. "Texture get surface failed"},
  295. {D3DERR_MATRIX_CREATE_FAILED, "D3DERR_MATRIX_CREATE_FAILED",
  296. "Matrix create failed"},
  297. {D3DERR_MATRIX_DESTROY_FAILED, "D3DERR_MATRIX_DESTROY_FAILED",
  298. "Matrix destroy failedj"},
  299. {D3DERR_MATRIX_SETDATA_FAILED, "D3DERR_MATRIX_SETDATA_FAILED",
  300. "Matrix set data failed"},
  301. {D3DERR_MATRIX_GETDATA_FAILED, "D3DERR_MATRIX_GETDATA_FAILED",
  302. "Matrix get data failed"},
  303. {D3DERR_SETVIEWPORTDATA_FAILED, "D3DERR_SETVIEWPORTDATA_FAILED",
  304. "Set viewport data failed"},
  305. {D3DERR_MATERIAL_CREATE_FAILED, "D3DERR_MATERIAL_CREATE_FAILED",
  306. "Material create failed"},
  307. {D3DERR_MATERIAL_DESTROY_FAILED, "D3DERR_MATERIAL_DESTROY_FAILED",
  308. "Material destroy failed"},
  309. {D3DERR_MATERIAL_SETDATA_FAILED, "D3DERR_MATERIAL_SETDATA_FAILED",
  310. "Material set data failed"},
  311. {D3DERR_MATERIAL_GETDATA_FAILED, "D3DERR_MATERIAL_GETDATA_FAILED",
  312. "Material get data failed"},
  313. {D3DERR_LIGHT_SET_FAILED, "D3DERR_LIGHT_SET_FAILED",
  314. "Light set failed"},
  315. {D3DERR_SCENE_IN_SCENE, "D3DERR_SCENE_IN_SCENE",
  316. "Scene in scene"},
  317. {D3DERR_SCENE_NOT_IN_SCENE, "D3DERR_SCENE_NOT_IN_SCENE",
  318. "Scene not in scene"},
  319. {D3DERR_SCENE_BEGIN_FAILED, "D3DERR_SCENE_BEGIN_FAILED",
  320. "Scene begin failed"},
  321. {D3DERR_SCENE_END_FAILED, "D3DERR_SCENE_END_FAILED",
  322. "Scene end failed"},
  323. /*************************************/
  324. /*** Direct3D Retained-Mode Errors ***/
  325. /*************************************/
  326. {D3DRMERR_BADOBJECT, "D3DRMERR_BADOBJECT",
  327. "Object expected in argument"},
  328. {D3DRMERR_BADTYPE, "D3DRMERR_BADTYPE",
  329. "Bad argument type passed"},
  330. {D3DRMERR_BADALLOC, "D3DRMERR_ALLOC",
  331. "Out of memory"},
  332. {D3DRMERR_FACEUSED, "D3DRMERR_FACEUSED",
  333. "Face already used in a mesh"},
  334. {D3DRMERR_NOTFOUND, "D3DRMERR_NOTFOUND",
  335. "Object not found in specified place"},
  336. {D3DRMERR_NOTDONEYET, "D3DRMERR_NOTDONEYET",
  337. "Unimplemented"},
  338. {D3DRMERR_FILENOTFOUND, "D3DRMERR_FILENOTFOUND",
  339. "File cannot be opened"},
  340. {D3DRMERR_BADFILE, "D3DRMERR_BADFILE",
  341. "Data file is corrupt or has incorrect format"},
  342. {D3DRMERR_BADDEVICE, "D3DRMERR_BADDEVICE",
  343. "Device is not compatible with renderer"},
  344. {D3DRMERR_BADVALUE, "D3DRMERR_BADVALUE",
  345. "Bad argument value passed"},
  346. {D3DRMERR_BADMAJORVERSION, "D3DRMERR_BADMAJORVERSION",
  347. "Bad DLL major version"},
  348. {D3DRMERR_BADMINORVERSION, "D3DRMERR_BADMINORVERSION",
  349. "Bad DLL minor version"},
  350. {D3DRMERR_UNABLETOEXECUTE, "D3DRMERR_UNABLETOEXECUTE",
  351. "Unable to carry out procedure"},
  352. //
  353. // DirectInput errors
  354. //
  355. { DI_BUFFEROVERFLOW, "DI_BUFFEROVERFLOW", "The device buffer overflowed and some input was lost. This value is equal to the S_FALSE standard COM return value."},
  356. { DI_DOWNLOADSKIPPED , "DI_DOWNLOADSKIPPED ","The parameters of the effect were successfully updated, but the effect could not be downloaded because the associated device was not acquired in exclusive mode."},
  357. { DI_EFFECTRESTARTED , "DI_EFFECTRESTARTED ","The effect was stopped, the parameters were updated, and the effect was restarted."},
  358. { DI_NOEFFECT , "DI_NOEFFECT ","The operation had no effect. This value is equal to the S_FALSE standard COM return value."},
  359. { DI_NOTATTACHED , "DI_NOTATTACHED ","The device exists but is not currently attached. This value is equal to the S_FALSE standard COM return value."},
  360. { DI_OK , "DI_OK ","The operation completed successfully. This value is equal to the S_OK standard COM return value."},
  361. { DI_POLLEDDEVICE , "DI_POLLEDDEVICE ","The device is a polled device. As a result, device buffering will not collect any data and event notifications will not be signaled until the IDirectInputDevice2::Poll method is called."},
  362. { DI_PROPNOEFFECT , "DI_PROPNOEFFECT ","The change in device properties had no effect. This value is equal to the S_FALSE standard COM return value."},
  363. { DI_TRUNCATED , "DI_TRUNCATED ","The parameters of the effect were successfully updated, but some of them were beyond the capabilities of the device and were truncated to the nearest supported value."},
  364. { DI_TRUNCATEDANDRESTARTED , "DI_TRUNCATEDANDRESTARTED ","Equal to DI_EFFECTRESTARTED | DI_TRUNCATED."},
  365. { DIERR_ACQUIRED , "DIERR_ACQUIRED ","The operation cannot be performed while the device is acquired."},
  366. { DIERR_ALREADYINITIALIZED , "DIERR_ALREADYINITIALIZED ","This object is already initialized"},
  367. { DIERR_BADDRIVERVER , "DIERR_BADDRIVERVER ","The object could not be created due to an incompatible driver version or mismatched or incomplete driver components."},
  368. { DIERR_BETADIRECTINPUTVERSION , "DIERR_BETADIRECTINPUTVERSION ","The application was written for an unsupported prerelease version of DirectInput."},
  369. { DIERR_DEVICEFULL , "DIERR_DEVICEFULL ","The device is full."},
  370. { DIERR_DEVICENOTREG , "DIERR_DEVICENOTREG ","The device or device instance is not registered with DirectInput. This value is equal to the REGDB_E_CLASSNOTREG standard COM return value."},
  371. { DIERR_EFFECTPLAYING , "DIERR_EFFECTPLAYING ","The parameters were updated in memory but were not downloaded to the device because the device does not support updating an effect while it is still playing."},
  372. { DIERR_HASEFFECTS , "DIERR_HASEFFECTS ","The device cannot be reinitialized because there are still effects attached to it."},
  373. { DIERR_GENERIC , "DIERR_GENERIC ","An undetermined error occurred inside the DirectInput subsystem. This value is equal to the E_FAIL standard COM return value."},
  374. { DIERR_HANDLEEXISTS , "DIERR_HANDLEEXISTS ","The device already has an event notification associated with it. This value is equal to the E_ACCESSDENIED standard COM return value."},
  375. { DIERR_INCOMPLETEEFFECT , "DIERR_INCOMPLETEEFFECT ","The effect could not be downloaded because essential information is missing. For example, no axes have been associated with the effect, or no type-specific information has been supplied."},
  376. { DIERR_INPUTLOST , "DIERR_INPUTLOST ","Access to the input device has been lost. It must be reacquired."},
  377. { DIERR_INVALIDPARAM , "DIERR_INVALIDPARAM ","An invalid parameter was passed to the returning function, or the object was not in a state that permitted the function to be called."},
  378. { DIERR_MOREDATA , "DIERR_MOREDATA ","Not all the requested information fitted into the buffer."},
  379. { DIERR_NOAGGREGATION , "DIERR_NOAGGREGATION ","This object does not support aggregation."},
  380. { DIERR_NOINTERFACE , "DIERR_NOINTERFACE ","The specified interface is not supported by the object. This value is equal to the E_NOINTERFACE standard COM return value."},
  381. { DIERR_NOTACQUIRED , "DIERR_NOTACQUIRED ","The operation cannot be performed unless the device is acquired."},
  382. { DIERR_NOTBUFFERED , "DIERR_NOTBUFFERED ","The device is not buffered. Set the DIPROP_BUFFERSIZE property to enable buffering."},
  383. { DIERR_NOTDOWNLOADED , "DIERR_NOTDOWNLOADED ","The effect is not downloaded."},
  384. { DIERR_NOTEXCLUSIVEACQUIRED , "DIERR_NOTEXCLUSIVEACQUIRED ","The operation cannot be performed unless the device is acquired in DISCL_EXCLUSIVE mode."},
  385. { DIERR_NOTFOUND , "DIERR_NOTFOUND ","The requested object does not exist."},
  386. { DIERR_NOTINITIALIZED , "DIERR_NOTINITIALIZED ","This object has not been initialized."},
  387. { DIERR_OBJECTNOTFOUND , "DIERR_OBJECTNOTFOUND ","The requested object does not exist."},
  388. { DIERR_OLDDIRECTINPUTVERSION , "DIERR_OLDDIRECTINPUTVERSION ", "he application requires a newer version of DirectInput."},
  389. { DIERR_OTHERAPPHASPRIO , "DIERR_OTHERAPPHASPRIO ","Another application has a higher priority level, preventing this call from succeeding."},
  390. { DIERR_OUTOFMEMORY , "DIERR_OUTOFMEMORY ","The DirectInput subsystem couldn't allocate sufficient memory to complete the call. This value is equal to the E_OUTOFMEMORY standard COM return value."},
  391. { DIERR_READONLY , "DIERR_READONLY ","The specified property cannot be changed. This value is equal to the E_ACCESSDENIED standard COM return value."},
  392. { DIERR_UNSUPPORTED , "DIERR_UNSUPPORTED ","The function called is not supported at this time. This value is equal to the E_NOTIMPL standard COM return value."},
  393. /************************************/
  394. /*** Miscellaneous Windows Errors ***/
  395. /************************************/
  396. {ERROR_INVALID_PARAMETER, "ERROR_INVALID_PARAMETER",
  397. "Invalid parameter"},
  398. {ERROR_NOT_ENOUGH_MEMORY, "ERROR_NOT_ENOUGH_MEMORY",
  399. "Insufficient memory available"},
  400. {ERROR_OUTOFMEMORY, "ERROR_OUTOFMEMORY",
  401. "Out of memory"},
  402. {0,0,0}
  403. };
  404. //////////////////////////////////////////////////////////////////////////////
  405. //
  406. //
  407. //
  408. //////////////////////////////////////////////////////////////////////////////
  409. bool g_bDumpDD = false;
  410. //////////////////////////////////////////////////////////////////////////////
  411. //
  412. //
  413. //
  414. //////////////////////////////////////////////////////////////////////////////
  415. bool DDError(HRESULT hresult, const char* pszCall, const char* pszFile, int line, const char* pszModule)
  416. {
  417. if (g_bDumpDD) {
  418. ZDebugOutput(ZString(pszCall) + "\n");
  419. }
  420. if (FAILED(hresult)) {
  421. HRESULTInfo* pinfo = gpinfo;
  422. while (pinfo->hresult != hresult && pinfo->hresult != 0) {
  423. pinfo++;
  424. }
  425. ZDebugOutput(ZString(pszCall) + "\n");
  426. if (pinfo->hresult == 0) {
  427. ZAssertImpl(false, "unknown error code", pszFile, line, pszModule);
  428. } else {
  429. ZAssertImpl(false, pinfo->pszText, pszFile, line, pszModule);
  430. }
  431. return false;
  432. }
  433. return true;
  434. }
  435. //////////////////////////////////////////////////////////////////////////////
  436. //
  437. //
  438. //
  439. //////////////////////////////////////////////////////////////////////////////
  440. bool DDSCallImpl(
  441. HRESULT hr,
  442. const char* pszCall,
  443. const char* pszFile,
  444. int line,
  445. const char* pszModule
  446. ) {
  447. if (
  448. hr == DDERR_SURFACELOST
  449. || hr == DDERR_SURFACEBUSY
  450. || hr == DDERR_UNSUPPORTED
  451. ) {
  452. return false;
  453. }
  454. return DDError(hr, pszCall, pszFile, line, pszModule);
  455. }
  456. #endif // _DEBUG