check.inc 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. {
  2. Free Pascal port of the OpenPTC C++ library.
  3. Copyright (C) 2001-2003 Nikolay Nikolov ([email protected])
  4. Original C++ version by Glenn Fiedler ([email protected])
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. }
  17. Procedure DirectXCheck(result : HRESULT);
  18. Begin
  19. If result = DD_OK Then
  20. Exit;
  21. { $IFDEF __PTC_DIRECTX_ERROR_STRINGS__}
  22. Case result Of
  23. DDERR_ALREADYINITIALIZED : Raise TPTCError.Create('DDERR_ALREADYINITIALIZED');
  24. DDERR_CANNOTATTACHSURFACE : Raise TPTCError.Create('DDERR_CANNOTATTACHSURFACE');
  25. DDERR_CANNOTDETACHSURFACE : Raise TPTCError.Create('DDERR_CANNOTDETACHSURFACE');
  26. DDERR_CURRENTLYNOTAVAIL : Raise TPTCError.Create('DDERR_CURRENTLYNOTAVAIL');
  27. DDERR_EXCEPTION : Raise TPTCError.Create('DDERR_EXCEPTION');
  28. DDERR_GENERIC : Raise TPTCError.Create('DDERR_GENERIC');
  29. DDERR_HEIGHTALIGN : Raise TPTCError.Create('DDERR_HEIGHTALIGN');
  30. DDERR_INCOMPATIBLEPRIMARY : Raise TPTCError.Create('DDERR_INCOMPATIBLEPRIMARY');
  31. DDERR_INVALIDCAPS : Raise TPTCError.Create('DDERR_INVALIDCAPS');
  32. DDERR_INVALIDCLIPLIST : Raise TPTCError.Create('DDERR_INVALIDCLIPLIST');
  33. DDERR_INVALIDMODE : Raise TPTCError.Create('DDERR_INVALIDMODE');
  34. DDERR_INVALIDOBJECT : Raise TPTCError.Create('DDERR_INVALIDOBJECT');
  35. DDERR_INVALIDPARAMS : Raise TPTCError.Create('DDERR_INVALIDPARAMS');
  36. DDERR_INVALIDPIXELFORMAT : Raise TPTCError.Create('DDERR_INVALIDPIXELFORMAT');
  37. DDERR_INVALIDRECT : Raise TPTCError.Create('DDERR_INVALIDRECT');
  38. DDERR_LOCKEDSURFACES : Raise TPTCError.Create('DDERR_LOCKEDSURFACES');
  39. DDERR_NO3D : Raise TPTCError.Create('DDERR_NO3D');
  40. DDERR_NOALPHAHW : Raise TPTCError.Create('DDERR_NOALPHAHW');
  41. DDERR_NOCLIPLIST : Raise TPTCError.Create('DDERR_CLIPLIST');
  42. DDERR_NOCOLORCONVHW : Raise TPTCError.Create('DDERR_NOCOLORCONVHW');
  43. DDERR_NOCOOPERATIVELEVELSET : Raise TPTCError.Create('DDERR_NOCOOPERATIVELEVELSET');
  44. DDERR_NOCOLORKEY : Raise TPTCError.Create('DDERR_NOCOLORKEY');
  45. DDERR_NOCOLORKEYHW : Raise TPTCError.Create('DDERR_NOCOLORKEYHW');
  46. DDERR_NODIRECTDRAWSUPPORT : Raise TPTCError.Create('DDERR_NODIRECTDRAWSUPPORT');
  47. DDERR_NOEXCLUSIVEMODE : Raise TPTCError.Create('DDERR_NOEXCLUSIVEMODE');
  48. DDERR_NOFLIPHW : Raise TPTCError.Create('DDERR_NOFLIPHW');
  49. DDERR_NOGDI : Raise TPTCError.Create('DDERR_NOGDI');
  50. DDERR_NOMIRRORHW : Raise TPTCError.Create('DDERR_NOMIRRORHW');
  51. DDERR_NOTFOUND : Raise TPTCError.Create('DDERR_NOTFOUND');
  52. DDERR_NOOVERLAYHW : Raise TPTCError.Create('DDERR_NOOVERLAYHW');
  53. DDERR_NORASTEROPHW : Raise TPTCError.Create('DDERR_NORASTEROPHW');
  54. DDERR_NOROTATIONHW : Raise TPTCError.Create('DDERR_NOROTATIONHW');
  55. DDERR_NOSTRETCHHW : Raise TPTCError.Create('DDERR_NOSTRETCHHW');
  56. DDERR_NOT4BITCOLOR : Raise TPTCError.Create('DDERR_NOT4BITCOLOR');
  57. DDERR_NOT4BITCOLORINDEX : Raise TPTCError.Create('DDERR_NOT4BITCOLORINDEX');
  58. DDERR_NOT8BITCOLOR : Raise TPTCError.Create('DDERR_NOT8BITCOLOR');
  59. DDERR_NOTEXTUREHW : Raise TPTCError.Create('DDERR_NOTEXTUREHW');
  60. DDERR_NOVSYNCHW : Raise TPTCError.Create('DDERR_NOVSYNCHW');
  61. DDERR_NOZBUFFERHW : Raise TPTCError.Create('DDERR_NOZBUFFERHW');
  62. DDERR_NOZOVERLAYHW : Raise TPTCError.Create('DDERR_NOZOVERLAYHW');
  63. DDERR_OUTOFCAPS : Raise TPTCError.Create('DDERR_OUTOFCAPS');
  64. DDERR_OUTOFMEMORY : Raise TPTCError.Create('DDERR_OUTOFMEMORY');
  65. DDERR_OUTOFVIDEOMEMORY : Raise TPTCError.Create('DDERR_OUTOFVIDEOMEMORY');
  66. DDERR_OVERLAYCANTCLIP : Raise TPTCError.Create('DDERR_OVERLAYCANTCLIP');
  67. DDERR_OVERLAYCOLORKEYONLYONEACTIVE : Raise TPTCError.Create('DDERR_OVERLAYCOLORKEYONLYONEACTIVE');
  68. DDERR_PALETTEBUSY : Raise TPTCError.Create('DDERR_PALETTEBUSY');
  69. DDERR_COLORKEYNOTSET : Raise TPTCError.Create('DDERR_COLORKEYNOTSET');
  70. DDERR_SURFACEALREADYATTACHED : Raise TPTCError.Create('DDERR_SURFACEALREADYATTACHED');
  71. DDERR_SURFACEALREADYDEPENDENT : Raise TPTCError.Create('DDERR_SURFACEALREADYDEPENDENT');
  72. DDERR_SURFACEBUSY : Raise TPTCError.Create('DDERR_SURFACEBUSY');
  73. DDERR_CANTLOCKSURFACE : Raise TPTCError.Create('DDERR_CANTLOCKSURFACE');
  74. DDERR_SURFACEISOBSCURED : Raise TPTCError.Create('DDERR_SURFACEISOBSCURED');
  75. DDERR_SURFACELOST : Raise TPTCError.Create('DDERR_SURFACELOST');
  76. DDERR_SURFACENOTATTACHED : Raise TPTCError.Create('DDERR_SURFACENOTATTACHED');
  77. DDERR_TOOBIGHEIGHT : Raise TPTCError.Create('DDERR_TOOBIGHEIGHT');
  78. DDERR_TOOBIGSIZE : Raise TPTCError.Create('DDERR_TOOBIGSIZE');
  79. DDERR_TOOBIGWIDTH : Raise TPTCError.Create('DDERR_TOOBIGWIDTH');
  80. DDERR_UNSUPPORTED : Raise TPTCError.Create('DDERR_UNSUPPORTED');
  81. DDERR_UNSUPPORTEDFORMAT : Raise TPTCError.Create('DDERR_UNSUPPORTEDFORMAT');
  82. DDERR_UNSUPPORTEDMASK : Raise TPTCError.Create('DDERR_UNSUPPORTEDMASK');
  83. DDERR_VERTICALBLANKINPROGRESS : Raise TPTCError.Create('DDERR_VERTICALBLANKINPROGRESS');
  84. DDERR_WASSTILLDRAWING : Raise TPTCError.Create('DDERR_WASSTILLDRAWING');
  85. DDERR_XALIGN : Raise TPTCError.Create('DDERR_XALIGN');
  86. DDERR_INVALIDDIRECTDRAWGUID : Raise TPTCError.Create('DDERR_INVALIDDIRECTDRAWGUID');
  87. DDERR_DIRECTDRAWALREADYCREATED : Raise TPTCError.Create('DDERR_DIRECTDRAWALREADYCREATED');
  88. DDERR_NODIRECTDRAWHW : Raise TPTCError.Create('DDERR_NODIRECTDRAWHW');
  89. DDERR_PRIMARYSURFACEALREADYEXISTS : Raise TPTCError.Create('DDERR_PRIMARYSURFACEALREADYEXISTS');
  90. DDERR_NOEMULATION : Raise TPTCError.Create('DDERR_NOEMULATION');
  91. DDERR_REGIONTOOSMALL : Raise TPTCError.Create('DDERR_REGIONTOOSMALL');
  92. DDERR_CLIPPERISUSINGHWND : Raise TPTCError.Create('DDERR_CLIPPERISUSINGHWND');
  93. DDERR_NOCLIPPERATTACHED : Raise TPTCError.Create('DDERR_NOCLIPPERATTACHED');
  94. DDERR_NOHWND : Raise TPTCError.Create('DDERR_NOHWND');
  95. DDERR_HWNDSUBCLASSED : Raise TPTCError.Create('DDERR_HWNDSUBCLASSED');
  96. DDERR_HWNDALREADYSET : Raise TPTCError.Create('DDERR_HWNDALREADYSET');
  97. DDERR_NOPALETTEATTACHED : Raise TPTCError.Create('DDERR_NOPALETTEATTACHED');
  98. DDERR_NOPALETTEHW : Raise TPTCError.Create('DDERR_NOPALETTEHW');
  99. DDERR_BLTFASTCANTCLIP : Raise TPTCError.Create('DDERR_BLTFASTCANTCLIP');
  100. DDERR_NOBLTHW : Raise TPTCError.Create('DDERR_NOBLTHW');
  101. DDERR_NODDROPSHW : Raise TPTCError.Create('DDERR_NODDROPSHW');
  102. DDERR_OVERLAYNOTVISIBLE : Raise TPTCError.Create('DDERR_OVERLAYNOTVISIBLE');
  103. DDERR_NOOVERLAYDEST : Raise TPTCError.Create('DDERR_NOOVERLAYDEST');
  104. DDERR_INVALIDPOSITION : Raise TPTCError.Create('DDERR_INVALIDPOSITION');
  105. DDERR_NOTAOVERLAYSURFACE : Raise TPTCError.Create('DDERR_NOTAOVERLAYSURFACE');
  106. DDERR_EXCLUSIVEMODEALREADYSET : Raise TPTCError.Create('DDERR_EXCLUSIVEMODEALREADYSET');
  107. DDERR_NOTFLIPPABLE : Raise TPTCError.Create('DDERR_NOTFLIPPABLE');
  108. DDERR_CANTDUPLICATE : Raise TPTCError.Create('DDERR_CANTDUPLICATE');
  109. DDERR_NOTLOCKED : Raise TPTCError.Create('DDERR_NOTLOCKED');
  110. DDERR_CANTCREATEDC : Raise TPTCError.Create('DDERR_CANTCREATEDC');
  111. DDERR_NODC : Raise TPTCError.Create('DDERR_NODC');
  112. DDERR_WRONGMODE : Raise TPTCError.Create('DDERR_WRONGMODE');
  113. DDERR_IMPLICITLYCREATED : Raise TPTCError.Create('DDERR_IMPLICITLYCREATED');
  114. DDERR_NOTPALETTIZED : Raise TPTCError.Create('DDERR_NOPALETTIZED');
  115. DDERR_UNSUPPORTEDMODE : Raise TPTCError.Create('DDERR_UNSUPPORTEDMODE');
  116. DDERR_NOMIPMAPHW : Raise TPTCError.Create('DDERR_NOMIPMAPHW');
  117. DDERR_INVALIDSURFACETYPE : Raise TPTCError.Create('DDERR_INVALIDSURFACETYPE');
  118. DDERR_DCALREADYCREATED : Raise TPTCError.Create('DDERR_DCALREADYCREATED');
  119. DDERR_CANTPAGELOCK : Raise TPTCError.Create('DDERR_CANTPAGELOCK');
  120. DDERR_CANTPAGEUNLOCK : Raise TPTCError.Create('DDERR_CANTPAGEUNLOCK');
  121. DDERR_NOTPAGELOCKED : Raise TPTCError.Create('DDERR_NOTPAGELOCKED');
  122. DDERR_NOTINITIALIZED : Raise TPTCError.Create('DDERR_NOTINITIALIZED');
  123. End;
  124. { $ENDIF}
  125. Raise TPTCError.Create('DDERR $' + HexStr(result, 8));
  126. End;
  127. Procedure DirectXCheck(result : HRESULT; Const message : String);
  128. Begin
  129. Try
  130. DirectXCheck(result);
  131. Except
  132. On error : TPTCError Do
  133. Raise TPTCError.Create(message, error);
  134. End;
  135. End;