123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- #ifndef _COMMON_H
- #define _COMMON_H
- #ifndef ENABLE_REVISIED_BATTLE
- # define PAL_CLASSIC 1
- #endif
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
- #define _CRT_SECURE_NO_WARNINGS
- #endif
- #include <wchar.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <time.h>
- #include <limits.h>
- #include <stdarg.h>
- #include <assert.h>
- #include "SDL.h"
- #include "SDL_endian.h"
- #if SDL_VERSION_ATLEAST(2,0,0)
- #define SDLK_KP1 SDLK_KP_1
- #define SDLK_KP2 SDLK_KP_2
- #define SDLK_KP3 SDLK_KP_3
- #define SDLK_KP4 SDLK_KP_4
- #define SDLK_KP5 SDLK_KP_5
- #define SDLK_KP6 SDLK_KP_6
- #define SDLK_KP7 SDLK_KP_7
- #define SDLK_KP8 SDLK_KP_8
- #define SDLK_KP9 SDLK_KP_9
- #define SDLK_KP0 SDLK_KP_0
- #define SDL_HWSURFACE 0
- #endif
- #ifndef max
- #define max fmax
- #endif
- #ifndef min
- #define min fmin
- #endif
- #ifndef SDL_FORCE_INLINE
- #if defined(_MSC_VER)
- #define SDL_FORCE_INLINE __forceinline
- #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
- #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
- #else
- #define SDL_FORCE_INLINE static SDL_INLINE
- #endif
- #endif
- #if defined(_MSC_VER)
- # define PAL_FORCE_INLINE static SDL_FORCE_INLINE
- #else
- # define PAL_FORCE_INLINE SDL_FORCE_INLINE
- #endif
- #ifdef _WIN32
- # include <windows.h>
- # include <io.h>
- # if defined(_MSC_VER)
- # if _MSC_VER < 1900
- # define vsnprintf _vsnprintf
- # define snprintf _snprintf
- # endif
- # define strdup _strdup
- # pragma warning (disable:4244)
- # endif
- # ifndef _LPCBYTE_DEFINED
- # define _LPCBYTE_DEFINED
- typedef const BYTE *LPCBYTE;
- # endif
- #else
- # include <unistd.h>
- # include <dirent.h>
- # ifndef FALSE
- # define FALSE 0
- # endif
- # ifndef TRUE
- # define TRUE 1
- # endif
- # define VOID void
- typedef char CHAR;
- typedef wchar_t WCHAR;
- typedef short SHORT;
- typedef long LONG;
- typedef unsigned long ULONG, *PULONG;
- typedef unsigned short USHORT, *PUSHORT;
- typedef unsigned char UCHAR, *PUCHAR;
- typedef unsigned short WORD, *LPWORD;
- typedef unsigned int DWORD, *LPDWORD;
- typedef int INT, *LPINT;
- # ifndef __OBJC__
- typedef int BOOL, *LPBOOL;
- # endif
- typedef unsigned int UINT, *PUINT, UINT32, *PUINT32;
- typedef unsigned char BYTE, *LPBYTE;
- typedef const BYTE *LPCBYTE;
- typedef float FLOAT, *LPFLOAT;
- typedef void *LPVOID;
- typedef const void *LPCVOID;
- typedef CHAR *LPSTR;
- typedef const CHAR *LPCSTR;
- typedef WCHAR *LPWSTR;
- typedef const WCHAR *LPCWSTR;
- #endif
- #include "pal_config.h"
- #ifndef PAL_DEFAULT_FULLSCREEN_HEIGHT
- # define PAL_DEFAULT_FULLSCREEN_HEIGHT PAL_DEFAULT_WINDOW_HEIGHT
- #endif
- #ifndef PAL_AUDIO_DEFAULT_BUFFER_SIZE
- # define PAL_AUDIO_DEFAULT_BUFFER_SIZE 1024
- #endif
- #ifndef PAL_HAS_SDLCD
- # define PAL_HAS_SDLCD 0
- #endif
- #ifndef PAL_HAS_MP3
- # define PAL_HAS_MP3 1
- #endif
- #ifndef PAL_HAS_OGG
- # define PAL_HAS_OGG 1
- #endif
- #ifndef SDL_INIT_CDROM
- # define SDL_INIT_CDROM 0
- #endif
- #ifndef SDL_AUDIO_BITSIZE
- # define SDL_AUDIO_BITSIZE(x) (x & 0xFF)
- #endif
- #ifndef PAL_CONFIG_PREFIX
- # define PAL_CONFIG_PREFIX PAL_PREFIX
- #endif
- #ifndef PAL_SCREENSHOT_PREFIX
- # define PAL_SCREENSHOT_PREFIX PAL_SAVE_PREFIX
- #endif
- #ifndef PAL_HAS_NATIVEMIDI
- # define PAL_HAS_NATIVEMIDI 0
- #endif
- #ifndef PAL_LARGE
- # define PAL_LARGE
- #endif
- #ifndef PAL_SCALE_SCREEN
- # define PAL_SCALE_SCREEN TRUE
- #endif
- #define __WIDETEXT(quote) L##quote
- #define WIDETEXT(quote) __WIDETEXT(quote)
- #ifndef SDL_TICKS_PASSED
- #define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0)
- #endif
- typedef enum tagCODEPAGE {
- CP_MIN = 0,
- CP_BIG5 = 0,
- CP_GBK = 1,
- CP_SHIFTJIS = 2,
- CP_JISX0208 = 3,
- CP_MAX = CP_GBK + 1,
- CP_UTF_8 = CP_MAX + 1
- } CODEPAGE;
- #ifdef __cplusplus
- }
- #endif
- #endif
|