platform.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _PLATFORM_H_
  23. #define _PLATFORM_H_
  24. #include <stdlib.h>
  25. #ifndef _TORQUECONFIG_H_
  26. #include "torqueConfig.h"
  27. #endif
  28. #ifndef _TORQUE_TYPES_H_
  29. #include "platform/types.h"
  30. #endif
  31. #ifndef _PLATFORMASSERT_H_
  32. #include "platform/platformAssert.h"
  33. #endif
  34. #ifndef _MSGBOX_H_
  35. #include "platform/nativeDialogs/msgBox.h"
  36. #endif
  37. #ifndef _VERSION_H_
  38. #include "app/version.h"
  39. #endif
  40. #ifndef _TORQUE_STRING_H_
  41. #include "core/util/str.h"
  42. #endif
  43. #ifndef _TORQUE_SAFEDELETE_H_
  44. #include "core/util/safeDelete.h"
  45. #endif
  46. #include <new>
  47. #include <typeinfo>
  48. /// Global processor identifiers.
  49. ///
  50. /// @note These enums must be globally scoped so that they work with the inline assembly
  51. enum ProcessorType
  52. {
  53. // x86
  54. CPU_X86Compatible,
  55. CPU_Intel_Unknown,
  56. CPU_Intel_486,
  57. CPU_Intel_Pentium,
  58. CPU_Intel_PentiumMMX,
  59. CPU_Intel_PentiumPro,
  60. CPU_Intel_PentiumII,
  61. CPU_Intel_PentiumCeleron,
  62. CPU_Intel_PentiumIII,
  63. CPU_Intel_Pentium4,
  64. CPU_Intel_PentiumM,
  65. CPU_Intel_Core,
  66. CPU_Intel_Core2,
  67. CPU_Intel_Corei7Xeon, // Core i7 or Xeon
  68. CPU_AMD_K6,
  69. CPU_AMD_K6_2,
  70. CPU_AMD_K6_3,
  71. CPU_AMD_Athlon,
  72. CPU_AMD_Phenom,
  73. CPU_AMD_PhenomII,
  74. CPU_AMD_Bulldozer,
  75. CPU_AMD_Unknown,
  76. CPU_Cyrix_6x86,
  77. CPU_Cyrix_MediaGX,
  78. CPU_Cyrix_6x86MX,
  79. CPU_Cyrix_GXm, ///< Media GX w/ MMX
  80. CPU_Cyrix_Unknown,
  81. // PowerPC
  82. CPU_PowerPC_Unknown,
  83. CPU_PowerPC_601,
  84. CPU_PowerPC_603,
  85. CPU_PowerPC_603e,
  86. CPU_PowerPC_603ev,
  87. CPU_PowerPC_604,
  88. CPU_PowerPC_604e,
  89. CPU_PowerPC_604ev,
  90. CPU_PowerPC_G3,
  91. CPU_PowerPC_G4,
  92. CPU_PowerPC_G4_7450,
  93. CPU_PowerPC_G4_7455,
  94. CPU_PowerPC_G4_7447,
  95. CPU_PowerPC_G5,
  96. // Xenon
  97. CPU_Xenon,
  98. };
  99. /// Properties for CPU.
  100. enum ProcessorProperties
  101. {
  102. CPU_PROP_C = (1<<0), ///< We should use C fallback math functions.
  103. CPU_PROP_FPU = (1<<1), ///< Has an FPU. (It better!)
  104. CPU_PROP_MMX = (1<<2), ///< Supports MMX instruction set extension.
  105. CPU_PROP_3DNOW = (1<<3), ///< Supports AMD 3dNow! instruction set extension.
  106. CPU_PROP_SSE = (1<<4), ///< Supports SSE instruction set extension.
  107. CPU_PROP_RDTSC = (1<<5), ///< Supports Read Time Stamp Counter op.
  108. CPU_PROP_SSE2 = (1<<6), ///< Supports SSE2 instruction set extension.
  109. CPU_PROP_SSE3 = (1<<7), ///< Supports SSE3 instruction set extension.
  110. CPU_PROP_SSE3xt = (1<<8), ///< Supports extended SSE3 instruction set
  111. CPU_PROP_SSE4_1 = (1<<9), ///< Supports SSE4_1 instruction set extension.
  112. CPU_PROP_SSE4_2 = (1<<10), ///< Supports SSE4_2 instruction set extension.
  113. CPU_PROP_MP = (1<<11), ///< This is a multi-processor system.
  114. CPU_PROP_LE = (1<<12), ///< This processor is LITTLE ENDIAN.
  115. CPU_PROP_64bit = (1<<13), ///< This processor is 64-bit capable
  116. CPU_PROP_ALTIVEC = (1<<14), ///< Supports AltiVec instruction set extension (PPC only).
  117. };
  118. /// Processor info manager.
  119. struct Processor
  120. {
  121. /// Gather processor state information.
  122. static void init();
  123. };
  124. #if defined(TORQUE_SUPPORTS_GCC_INLINE_X86_ASM)
  125. #define TORQUE_DEBUGBREAK() { asm ( "int 3"); }
  126. #elif defined (TORQUE_SUPPORTS_VC_INLINE_X86_ASM) // put this test second so that the __asm syntax doesn't break the Visual Studio Intellisense parser
  127. #define TORQUE_DEBUGBREAK() { __asm { int 3 }; }
  128. #else
  129. /// Macro to do in-line debug breaks, used for asserts. Does inline assembly when possible.
  130. #define TORQUE_DEBUGBREAK() Platform::debugBreak();
  131. #endif
  132. /// Physical type of a drive.
  133. enum DriveType
  134. {
  135. DRIVETYPE_FIXED = 0, ///< Non-removable fixed drive.
  136. DRIVETYPE_REMOVABLE = 1, ///< Removable drive.
  137. DRIVETYPE_REMOTE = 2, ///< Networked/remote drive.
  138. DRIVETYPE_CDROM = 3, ///< CD-Rom.
  139. DRIVETYPE_RAMDISK = 4, ///< A ramdisk!
  140. DRIVETYPE_UNKNOWN = 5 ///< Don't know.
  141. };
  142. // Some forward declares for later.
  143. class Point2I;
  144. template<class T> class Vector;
  145. template<typename Signature> class Signal;
  146. struct InputEventInfo;
  147. namespace Platform
  148. {
  149. // Time
  150. struct LocalTime
  151. {
  152. U8 sec; ///< Seconds after minute (0-59)
  153. U8 min; ///< Minutes after hour (0-59)
  154. U8 hour; ///< Hours after midnight (0-23)
  155. U8 month; ///< Month (0-11; 0=january)
  156. U8 monthday; ///< Day of the month (1-31)
  157. U8 weekday; ///< Day of the week (0-6, 6=sunday)
  158. U16 year; ///< Current year minus 1900
  159. U16 yearday; ///< Day of year (0-365)
  160. bool isdst; ///< True if daylight savings time is active
  161. };
  162. void getLocalTime(LocalTime &);
  163. /// Converts the local time to a formatted string appropriate
  164. /// for the current platform.
  165. String localTimeToString( const LocalTime &lt );
  166. U32 getTime();
  167. U32 getVirtualMilliseconds();
  168. /// Returns the milliseconds since the system was started. You should
  169. /// not depend on this for high precision timing.
  170. /// @see PlatformTimer
  171. U32 getRealMilliseconds();
  172. void advanceTime(U32 delta);
  173. S32 getBackgroundSleepTime();
  174. // Platform control
  175. void init();
  176. void initConsole();
  177. void shutdown();
  178. void process();
  179. // Math control state
  180. U32 getMathControlState();
  181. void setMathControlState(U32 state);
  182. void setMathControlStateKnown();
  183. // Process control
  184. void sleep(U32 ms);
  185. bool excludeOtherInstances(const char *string);
  186. bool checkOtherInstances(const char *string);
  187. void restartInstance();
  188. void postQuitMessage(const S32 in_quitVal);
  189. void forceShutdown(S32 returnValue);
  190. // Debug
  191. void outputDebugString(const char *string, ...);
  192. void debugBreak();
  193. // Random
  194. F32 getRandom();
  195. // Window state
  196. void setWindowLocked(bool locked);
  197. void minimizeWindow();
  198. //const Point2I &getWindowSize();
  199. void setWindowSize( U32 newWidth, U32 newHeight, bool fullScreen );
  200. void closeWindow();
  201. // File stuff
  202. bool doCDCheck();
  203. StringTableEntry createPlatformFriendlyFilename(const char *filename);
  204. struct FileInfo
  205. {
  206. const char* pFullPath;
  207. const char* pFileName;
  208. U32 fileSize;
  209. };
  210. bool cdFileExists(const char *filePath, const char *volumeName, S32 serialNum);
  211. void fileToLocalTime(const FileTime &ft, LocalTime *lt);
  212. /// compare file times returns < 0 if a is earlier than b, >0 if b is earlier than a
  213. S32 compareFileTimes(const FileTime &a, const FileTime &b);
  214. bool stringToFileTime(const char * string, FileTime * time);
  215. bool fileTimeToString(FileTime * time, char * string, U32 strLen);
  216. /// Compares the last modified time between two file paths. Returns < 0 if
  217. /// the first file is earlier than the second, > 0 if the second file is earlier
  218. /// than the first, and 0 if the files are equal.
  219. ///
  220. /// If either of the files doesn't exist it returns -1.
  221. S32 compareModifiedTimes( const char *firstPath, const char *secondPath );
  222. // Directory functions. Dump path returns false iff the directory cannot be
  223. // opened.
  224. StringTableEntry getCurrentDirectory();
  225. bool setCurrentDirectory(StringTableEntry newDir);
  226. StringTableEntry getTemporaryDirectory();
  227. StringTableEntry getTemporaryFileName();
  228. /// Returns the filename of the torque executable.
  229. /// On Win32, this is the .exe file.
  230. /// On Mac, this is the .app/ directory bundle.
  231. StringTableEntry getExecutableName();
  232. /// Returns full pathname of the torque executable without filename
  233. StringTableEntry getExecutablePath();
  234. /// Returns the full path to the directory that contains main.cs.
  235. /// Tools scripts are validated as such if they are in this directory or a
  236. /// subdirectory of this directory.
  237. StringTableEntry getMainDotCsDir();
  238. /// Set main.cs directory. Used in runEntryScript()
  239. void setMainDotCsDir(const char *dir);
  240. StringTableEntry getPrefsPath(const char *file = NULL);
  241. char *makeFullPathName(const char *path, char *buffer, U32 size, const char *cwd = NULL);
  242. StringTableEntry stripBasePath(const char *path);
  243. bool isFullPath(const char *path);
  244. StringTableEntry makeRelativePathName(const char *path, const char *to);
  245. String stripExtension( String fileName, Vector< String >& validExtensions );
  246. bool dumpPath(const char *in_pBasePath, Vector<FileInfo>& out_rFileVector, S32 recurseDepth = -1);
  247. bool dumpDirectories( const char *path, Vector<StringTableEntry> &directoryVector, S32 depth = 0, bool noBasePath = false );
  248. bool hasSubDirectory( const char *pPath );
  249. bool getFileTimes(const char *filePath, FileTime *createTime, FileTime *modifyTime);
  250. bool isFile(const char *pFilePath);
  251. S32 getFileSize(const char *pFilePath);
  252. bool isDirectory(const char *pDirPath);
  253. bool isSubDirectory(const char *pParent, const char *pDir);
  254. void addExcludedDirectory(const char *pDir);
  255. void clearExcludedDirectories();
  256. bool isExcludedDirectory(const char *pDir);
  257. /// Given a directory path, create all necessary directories for that path to exist.
  258. bool createPath(const char *path); // create a directory path
  259. // Alerts
  260. void AlertOK(const char *windowTitle, const char *message);
  261. bool AlertOKCancel(const char *windowTitle, const char *message);
  262. bool AlertRetry(const char *windowTitle, const char *message);
  263. // Volumes
  264. struct VolumeInformation
  265. {
  266. StringTableEntry RootPath;
  267. StringTableEntry Name;
  268. StringTableEntry FileSystem;
  269. U32 SerialNumber;
  270. U32 Type;
  271. bool ReadOnly;
  272. };
  273. extern struct VolumeInformation *PVolumeInformation;
  274. // Volume functions.
  275. void getVolumeNamesList( Vector<const char*>& out_rNameVector, bool bOnlyFixedDrives = false );
  276. void getVolumeInformationList( Vector<VolumeInformation>& out_rVolumeInfoVector, bool bOnlyFixedDrives = false );
  277. struct SystemInfo_struct
  278. {
  279. struct Processor
  280. {
  281. ProcessorType type;
  282. const char* name;
  283. U32 mhz;
  284. bool isMultiCore;
  285. bool isHyperThreaded;
  286. U32 numLogicalProcessors;
  287. U32 numPhysicalProcessors;
  288. U32 numAvailableCores;
  289. U32 properties; // CPU type specific enum
  290. } processor;
  291. };
  292. extern Signal<void(void)> SystemInfoReady;
  293. extern SystemInfo_struct SystemInfo;
  294. // Web page launch function:
  295. bool openWebBrowser( const char* webAddress );
  296. // display Splash Window
  297. bool displaySplashWindow( String path );
  298. // close Splash Window
  299. bool closeSplashWindow();
  300. void openFolder( const char* path );
  301. // Open file at the OS level, according to registered file-types.
  302. void openFile( const char* path );
  303. const char* getLoginPassword();
  304. bool setLoginPassword( const char* password );
  305. const char* getClipboard();
  306. bool setClipboard(const char *text);
  307. // User Specific Functions
  308. StringTableEntry getUserHomeDirectory();
  309. StringTableEntry getUserDataDirectory();
  310. bool getUserIsAdministrator();
  311. // Displays a fancy platform specific message box
  312. S32 messageBox(const UTF8 *title, const UTF8 *message, MBButtons buttons = MBOkCancel, MBIcons icon = MIInformation);
  313. /// Description of a keyboard input we want to ignore.
  314. struct KeyboardInputExclusion
  315. {
  316. KeyboardInputExclusion()
  317. {
  318. key = 0;
  319. orModifierMask = 0;
  320. andModifierMask = 0;
  321. }
  322. /// The key code to ignore, e.g. KEY_TAB. If this and the other
  323. /// conditions match, ignore the key.
  324. S32 key;
  325. /// if(modifiers | orModifierMask) and the other conditions match,
  326. /// ignore the key.
  327. U32 orModifierMask;
  328. /// if((modifiers & andModifierMask) == andModifierMask) and the
  329. /// other conditions match, ignore the key stroke.
  330. U32 andModifierMask;
  331. /// Based on the values above, determine if a given input event
  332. /// matchs this exclusion rule.
  333. const bool checkAgainstInput(const InputEventInfo *info) const;
  334. };
  335. /// Reset the keyboard input exclusion list.
  336. void clearKeyboardInputExclusion();
  337. /// Add a new keyboard exclusion.
  338. void addKeyboardInputExclusion(const KeyboardInputExclusion &kie);
  339. /// Check if a given input event should be excluded.
  340. const bool checkKeyboardInputExclusion(const InputEventInfo *info);
  341. /// Set/Get whether this is a web deployment
  342. bool getWebDeployment();
  343. void setWebDeployment(bool v);
  344. };
  345. //------------------------------------------------------------------------------
  346. // Unicode string conversions
  347. // UNICODE is a windows platform API switching flag. Don't define it on other platforms.
  348. #ifdef UNICODE
  349. #define dT(s) L##s
  350. #else
  351. #define dT(s) s
  352. #endif
  353. //------------------------------------------------------------------------------
  354. // Misc StdLib functions
  355. #define QSORT_CALLBACK FN_CDECL
  356. inline void dQsort(void *base, U32 nelem, U32 width, S32 (QSORT_CALLBACK *fcmp)(const void *, const void *))
  357. {
  358. qsort(base, nelem, width, fcmp);
  359. }
  360. //-------------------------------------- Some all-around useful inlines and globals
  361. //
  362. ///@defgroup ObjTrickery Object Management Trickery
  363. ///
  364. /// These functions are to construct and destruct objects in memory
  365. /// without causing a free or malloc call to occur. This is so that
  366. /// we don't have to worry about allocating, say, space for a hundred
  367. /// NetAddresses with a single malloc call, calling delete on a single
  368. /// NetAdress, and having it try to free memory out from under us.
  369. ///
  370. /// @{
  371. /// Constructs an object that already has memory allocated for it.
  372. template <class T>
  373. inline T* constructInPlace(T* p)
  374. {
  375. return new ( p ) T;
  376. }
  377. template< class T >
  378. inline T* constructArrayInPlace( T* p, U32 num )
  379. {
  380. return new ( p ) T[ num ];
  381. }
  382. /// Copy constructs an object that already has memory allocated for it.
  383. template <class T>
  384. inline T* constructInPlace(T* p, const T* copy)
  385. {
  386. return new ( p ) T( *copy );
  387. }
  388. template <class T, class T2> inline T* constructInPlace(T* ptr, T2 t2)
  389. {
  390. return new ( ptr ) T( t2 );
  391. }
  392. template <class T, class T2, class T3> inline T* constructInPlace(T* ptr, T2 t2, T3 t3)
  393. {
  394. return new ( ptr ) T( t2, t3 );
  395. }
  396. template <class T, class T2, class T3, class T4> inline T* constructInPlace(T* ptr, T2 t2, T3 t3, T4 t4)
  397. {
  398. return new ( ptr ) T( t2, t3, t4 );
  399. }
  400. template <class T, class T2, class T3, class T4, class T5> inline T* constructInPlace(T* ptr, T2 t2, T3 t3, T4 t4, T5 t5)
  401. {
  402. return new ( ptr ) T( t2, t3, t4, t5 );
  403. }
  404. /// Destructs an object without freeing the memory associated with it.
  405. template <class T>
  406. inline void destructInPlace(T* p)
  407. {
  408. p->~T();
  409. }
  410. //------------------------------------------------------------------------------
  411. /// Memory functions
  412. #if !defined(TORQUE_DISABLE_MEMORY_MANAGER)
  413. # define TORQUE_TMM_ARGS_DECL , const char* fileName, const U32 lineNum
  414. # define TORQUE_TMM_ARGS , fileName, lineNum
  415. # define TORQUE_TMM_LOC , __FILE__, __LINE__
  416. extern void* FN_CDECL operator new(dsize_t size, const char*, const U32);
  417. extern void* FN_CDECL operator new[](dsize_t size, const char*, const U32);
  418. extern void FN_CDECL operator delete(void* ptr);
  419. extern void FN_CDECL operator delete[](void* ptr);
  420. # define _new new(__FILE__, __LINE__)
  421. # define new _new
  422. #else
  423. # define TORQUE_TMM_ARGS_DECL
  424. # define TORQUE_TMM_ARGS
  425. # define TORQUE_TMM_LOC
  426. #endif
  427. #define dMalloc(x) dMalloc_r(x, __FILE__, __LINE__)
  428. #define dRealloc(x, y) dRealloc_r(x, y, __FILE__, __LINE__)
  429. extern void setBreakAlloc(dsize_t);
  430. extern void setMinimumAllocUnit(U32);
  431. extern void* dMalloc_r(dsize_t in_size, const char*, const dsize_t);
  432. extern void dFree(void* in_pFree);
  433. extern void* dRealloc_r(void* in_pResize, dsize_t in_size, const char*, const dsize_t);
  434. extern void* dRealMalloc(dsize_t);
  435. extern void dRealFree(void*);
  436. extern void *dMalloc_aligned(dsize_t in_size, S32 alignment);
  437. extern void dFree_aligned(void *);
  438. inline void dFree( const void* p )
  439. {
  440. dFree( ( void* ) p );
  441. }
  442. // Helper function to copy one array into another of different type
  443. template<class T,class S> void dCopyArray(T *dst, const S *src, dsize_t size)
  444. {
  445. for (dsize_t i = 0; i < size; i++)
  446. dst[i] = (T)src[i];
  447. }
  448. extern void* dMemcpy(void *dst, const void *src, dsize_t size);
  449. extern void* dMemmove(void *dst, const void *src, dsize_t size);
  450. extern void* dMemset(void *dst, S32 c, dsize_t size);
  451. extern S32 dMemcmp(const void *ptr1, const void *ptr2, dsize_t size);
  452. // Special case of the above function when the arrays are the same type (use memcpy)
  453. template<class T> void dCopyArray(T *dst, const T *src, dsize_t size)
  454. {
  455. dMemcpy(dst, src, size * sizeof(T));
  456. }
  457. /// The dALIGN macro ensures the passed declaration is
  458. /// data aligned at 16 byte boundaries.
  459. #if defined( TORQUE_COMPILER_VISUALC )
  460. #define dALIGN( decl ) __declspec( align( 16 ) ) decl
  461. #define dALIGN_BEGIN __declspec( align( 16 ) )
  462. #define dALIGN_END
  463. #elif defined( TORQUE_COMPILER_GCC )
  464. #define dALIGN( decl ) decl __attribute__( ( aligned( 16 ) ) )
  465. #define dALIGN_BEGIN
  466. #define dALIGN_END __attribute__( ( aligned( 16 ) ) )
  467. #else
  468. #define dALIGN( decl ) decl
  469. #define dALIGN_BEGIN()
  470. #define dALIGN_END()
  471. #endif
  472. //------------------------------------------------------------------------------
  473. // FileIO functions
  474. extern bool dFileDelete(const char *name);
  475. extern bool dFileRename(const char *oldName, const char *newName);
  476. extern bool dFileTouch(const char *name);
  477. extern bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite = true);
  478. typedef void* FILE_HANDLE;
  479. enum DFILE_STATUS
  480. {
  481. DFILE_OK = 1
  482. };
  483. extern FILE_HANDLE dOpenFileRead(const char *name, DFILE_STATUS &error);
  484. extern FILE_HANDLE dOpenFileReadWrite(const char *name, bool append, DFILE_STATUS &error);
  485. extern S32 dFileRead(FILE_HANDLE handle, U32 bytes, char *dst, DFILE_STATUS &error);
  486. extern S32 dFileWrite(FILE_HANDLE handle, U32 bytes, const char *dst, DFILE_STATUS &error);
  487. extern void dFileClose(FILE_HANDLE handle);
  488. extern StringTableEntry osGetTemporaryDirectory();
  489. //------------------------------------------------------------------------------
  490. struct Math
  491. {
  492. /// Initialize the math library with the appropriate libraries
  493. /// to support hardware acceleration features.
  494. ///
  495. /// @param properties Leave zero to detect available hardware. Otherwise,
  496. /// pass CPU instruction set flags that you want to load
  497. /// support for.
  498. static void init(U32 properties = 0);
  499. };
  500. /// @}
  501. #endif