stdafx.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * This source code is public domain.
  3. *
  4. * Authors: Rani Assaf <[email protected]>,
  5. * Olivier Lapicque <[email protected]>,
  6. * Adam Goode <[email protected]> (endian and char fixes for PPC)
  7. */
  8. #ifndef MODPLUG_STDAFX_H
  9. #define MODPLUG_STDAFX_H
  10. /* Autoconf detection of stdint/inttypes */
  11. #if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED)
  12. # include "config.h"
  13. # define CONFIG_H_INCLUDED 1
  14. #endif
  15. #ifdef HAVE_INTTYPES_H
  16. # include <inttypes.h>
  17. #endif
  18. #ifdef HAVE_STDINT_H
  19. # include <stdint.h>
  20. #endif
  21. #ifdef _WIN32
  22. #ifdef MSC_VER
  23. #pragma warning (disable:4201)
  24. #pragma warning (disable:4514)
  25. #endif
  26. #define WIN32_LEAN_AND_MEAN
  27. #include <windows.h>
  28. #include <windowsx.h>
  29. #include <mmsystem.h>
  30. #include <stdio.h>
  31. #include <malloc.h>
  32. #include <stdint.h>
  33. #define srandom(_seed) srand(_seed)
  34. #define random() rand()
  35. #define sleep(_ms) Sleep(_ms)
  36. inline void ProcessPlugins(int n) {}
  37. #define strncasecmp(a,b,c) strncmp(a,b,c)
  38. #define strcasecmp(a,b) strcmp(a,b)
  39. #define strnicmp(a,b,c) strncasecmp(a,b,c)
  40. #define HAVE_SINF 1
  41. #ifndef isblank
  42. #define isblank(c) ((c) == ' ' || (c) == '\t')
  43. #endif
  44. #else
  45. #include <stdlib.h>
  46. #include <stdio.h>
  47. #include <string.h>
  48. #ifdef HAVE_MALLOC_H
  49. #include <malloc.h>
  50. #endif
  51. typedef int8_t CHAR;
  52. typedef uint8_t UCHAR;
  53. typedef uint8_t* PUCHAR;
  54. typedef uint16_t USHORT;
  55. typedef uint32_t ULONG;
  56. typedef uint32_t UINT;
  57. typedef uint32_t DWORD;
  58. typedef int32_t LONG;
  59. typedef int64_t LONGLONG;
  60. typedef int32_t* LPLONG;
  61. typedef uint32_t* LPDWORD;
  62. typedef uint16_t WORD;
  63. typedef uint8_t BYTE;
  64. typedef uint8_t* LPBYTE;
  65. typedef bool BOOL;
  66. typedef char* LPSTR;
  67. typedef void* LPVOID;
  68. typedef uint16_t* LPWORD;
  69. typedef const char* LPCSTR;
  70. typedef void* PVOID;
  71. typedef void VOID;
  72. inline LONG MulDiv (long a, long b, long c)
  73. {
  74. // if (!c) return 0;
  75. return ((uint64_t) a * (uint64_t) b ) / c;
  76. }
  77. #define MODPLUG_NO_FILESAVE
  78. #define NO_AGC
  79. #define LPCTSTR LPCSTR
  80. #define lstrcpyn strncpy
  81. #define lstrcpy strcpy
  82. #define lstrcmp strcmp
  83. #define WAVE_FORMAT_PCM 1
  84. //#define ENABLE_EQ
  85. #define GHND 0
  86. inline int8_t * GlobalAllocPtr(unsigned int, size_t size)
  87. {
  88. int8_t * p = (int8_t *) malloc(size);
  89. if (p != NULL) memset(p, 0, size);
  90. return p;
  91. }
  92. inline void ProcessPlugins(int /* n */ ) {}
  93. #define GlobalFreePtr(p) free((void *)(p))
  94. #define strnicmp(a,b,c) strncasecmp(a,b,c)
  95. #define wsprintf sprintf
  96. #ifndef FALSE
  97. #define FALSE false
  98. #endif
  99. #ifndef TRUE
  100. #define TRUE true
  101. #endif
  102. #endif // _WIN32
  103. #if defined(_WIN32) || defined(__CYGWIN__)
  104. # if defined(MODPLUG_BUILD) && defined(DLL_EXPORT) /* building libmodplug as a dll for windows */
  105. # define MODPLUG_EXPORT __declspec(dllexport)
  106. # elif defined(MODPLUG_BUILD) || defined(MODPLUG_STATIC) /* building or using static libmodplug for windows */
  107. # define MODPLUG_EXPORT
  108. # else
  109. # define MODPLUG_EXPORT __declspec(dllimport) /* using libmodplug dll for windows */
  110. # endif
  111. /* FIXME: USE VISIBILITY ATTRIBUTES HERE */
  112. #elif defined(MODPLUG_BUILD)
  113. #define MODPLUG_EXPORT
  114. #else
  115. #define MODPLUG_EXPORT
  116. #endif
  117. #endif