| 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 | |
| 9 | #ifndef MP_STDAFX_H |
| 10 | #define MP_STDAFX_H |
| 11 | |
| 12 | #ifdef _WIN32 |
| 13 | |
| 14 | #ifdef MSC_VER |
| 15 | #pragma warning (disable:4201) |
| 16 | #pragma warning (disable:4514) |
| 17 | #endif |
| 18 | |
| 19 | #define WIN32_LEAN_AND_MEAN |
| 20 | #include <windows.h> |
| 21 | #include <windowsx.h> |
| 22 | #include <mmsystem.h> |
| 23 | #include <stdio.h> |
| 24 | #include <stdlib.h> |
| 25 | #include <stdint.h> |
| 26 | |
| 27 | #define srandom(_seed) srand(_seed) |
| 28 | #define random() rand() |
| 29 | #define sleep(_ms) Sleep(_ms) |
| 30 | |
| 31 | #undef strcasecmp |
| 32 | #undef strncasecmp |
| 33 | #define strcasecmp(a,b) _stricmp(a,b) |
| 34 | #define strncasecmp(a,b,c) _strnicmp(a,b,c) |
| 35 | |
| 36 | #ifndef isblank |
| 37 | #define isblank(c) ((c) == ' ' || (c) == '\t') |
| 38 | #endif |
| 39 | |
| 40 | #else |
| 41 | |
| 42 | #include <inttypes.h> |
| 43 | #include <stdint.h> |
| 44 | #include <stdlib.h> |
| 45 | #include <stdio.h> |
| 46 | #include <string.h> |
| 47 | |
| 48 | typedef int8_t CHAR; |
| 49 | typedef uint8_t UCHAR; |
| 50 | typedef uint8_t* PUCHAR; |
| 51 | typedef uint16_t USHORT; |
| 52 | typedef uint32_t ULONG; |
| 53 | typedef uint32_t UINT; |
| 54 | typedef uint32_t DWORD; |
| 55 | typedef int32_t LONG; |
| 56 | typedef int64_t LONGLONG; |
| 57 | typedef int32_t* LPLONG; |
| 58 | typedef uint32_t* LPDWORD; |
| 59 | typedef uint16_t WORD; |
| 60 | typedef uint8_t BYTE; |
| 61 | typedef uint8_t* LPBYTE; |
| 62 | typedef bool BOOL; |
| 63 | typedef char* LPSTR; |
| 64 | typedef void* LPVOID; |
| 65 | typedef uint16_t* LPWORD; |
| 66 | typedef const char* LPCSTR; |
| 67 | typedef void* PVOID; |
| 68 | typedef void VOID; |
| 69 | |
| 70 | inline LONG MulDiv (long a, long b, long c) |
| 71 | { |
| 72 | /*if (!c) return 0;*/ |
| 73 | return ((uint64_t) a * (uint64_t) b ) / c; |
| 74 | } |
| 75 | |
| 76 | #define lstrcpynA strncpy |
| 77 | #define lstrcpyA strcpy |
| 78 | #define wsprintfA sprintf |
| 79 | |
| 80 | #define WAVE_FORMAT_PCM 1 |
| 81 | |
| 82 | #define GHND 0 |
| 83 | #define GlobalFreePtr(p) free((void *)(p)) |
| 84 | inline int8_t * GlobalAllocPtr(unsigned int, size_t size) |
| 85 | { |
| 86 | int8_t * p = (int8_t *) malloc(size); |
| 87 | |
| 88 | if (p != NULL) memset(p, 0, size); |
| 89 | return p; |
| 90 | } |
| 91 | |
| 92 | #ifndef FALSE |
| 93 | #define FALSE false |
| 94 | #endif |
| 95 | |
| 96 | #ifndef TRUE |
| 97 | #define TRUE true |
| 98 | #endif |
| 99 | |
| 100 | #endif /* _WIN32 */ |
| 101 | |
| 102 | #endif |