diff options
-rw-r--r-- | PocketSCUMM/missing/sys/stat.h | 23 | ||||
-rw-r--r-- | PocketSCUMM/missing/sys/time.h | 10 | ||||
-rw-r--r-- | PocketSCUMM/missing/sys/types.h | 5 | ||||
-rw-r--r-- | scummsys.h | 43 |
4 files changed, 71 insertions, 10 deletions
diff --git a/PocketSCUMM/missing/sys/stat.h b/PocketSCUMM/missing/sys/stat.h new file mode 100644 index 0000000000..d9eef1318d --- /dev/null +++ b/PocketSCUMM/missing/sys/stat.h @@ -0,0 +1,23 @@ +/* Header is not present in Windows CE SDK */ + +#include <sys/types.h> + +struct stat { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; + time_t st_atime; + time_t st_mtime; + time_t st_ctime; +}; + + +#define _S_IFDIR 0040000 /* directory */ +#define S_IFDIR _S_IFDIR + +int stat(const char *, struct stat *); diff --git a/PocketSCUMM/missing/sys/time.h b/PocketSCUMM/missing/sys/time.h new file mode 100644 index 0000000000..ded29bb009 --- /dev/null +++ b/PocketSCUMM/missing/sys/time.h @@ -0,0 +1,10 @@ +/* Header is not present in Windows CE SDK */ + +struct timeval +{ + int tv_sec; + int tv_usec; +}; + +void gettimeofday(struct timeval* tp, void* dummy); +void usleep(long usec); diff --git a/PocketSCUMM/missing/sys/types.h b/PocketSCUMM/missing/sys/types.h new file mode 100644 index 0000000000..b6c05e3958 --- /dev/null +++ b/PocketSCUMM/missing/sys/types.h @@ -0,0 +1,5 @@ +/* Header is not present in Windows CE SDK */ + +typedef unsigned short _ino_t; +typedef unsigned int _dev_t; +typedef long _off_t; diff --git a/scummsys.h b/scummsys.h index b46ff58c4a..0a6fa1dee6 100644 --- a/scummsys.h +++ b/scummsys.h @@ -17,10 +17,17 @@ * * Change Log: * $Log$ + * Revision 1.8 2001/11/06 10:34:48 cmatsuoka + * Added missing missing/sys files. + * * Revision 1.7 2001/11/05 19:21:49 strigeus * bug fixes, * speech in dott * + * Revision 1.6 2001/11/03 06:33:29 cmatsuoka + * Protecting VC++-specific pragmas with ifdef _MSC_VER to allow + * a clean Cygwin build. + * * Revision 1.5 2001/10/23 19:51:50 strigeus * recompile not needed when switching games * debugger skeleton implemented @@ -43,8 +50,11 @@ #if defined(WIN32) +/* Pragmas are VC++-specific */ +#if defined(_MSC_VER) #pragma warning (disable: 4244) #pragma warning (disable: 4101) +#endif #define scumm_stricmp stricmp @@ -114,23 +124,36 @@ typedef signed long int32; #if defined(SCUMM_LITTLE_ENDIAN) -#if defined(SCUMM_NEED_ALIGNMENT) -#error Little endian processors that need alignment is not implemented -#endif +//#if defined(SCUMM_NEED_ALIGNMENT) +//#error Little endian processors that need alignment is not implemented +//#endif #define MKID(a) ((((a)>>24)&0xFF) | (((a)>>8)&0xFF00) | (((a)<<8)&0xFF0000) | (((a)<<24)&0xFF000000)) -int FORCEINLINE READ_LE_UINT16(void *ptr) { - return *(uint16*)(ptr); -} +#if defined(SCUMM_NEED_ALIGNMENT) + int FORCEINLINE READ_LE_UINT16(void *ptr) { + return (((byte*)ptr)[1]<<8)|((byte*)ptr)[0]; + } +#else + int FORCEINLINE READ_LE_UINT16(void *ptr) { + return *(uint16*)(ptr); + } +#endif int FORCEINLINE READ_BE_UINT16(void *ptr) { return (((byte*)ptr)[0]<<8)|((byte*)ptr)[1]; } -uint32 FORCEINLINE READ_LE_UINT32(void *ptr) { - return *(uint32*)(ptr); -} +#if defined(SCUMM_NEED_ALIGNMENT) + uint32 FORCEINLINE READ_LE_UINT32(void *ptr) { + byte *b = (byte*)ptr; + return (b[3]<<24)+(b[2]<<16)+(b[1]<<8)+(b[0]); + } +#else + uint32 FORCEINLINE READ_LE_UINT32(void *ptr) { + return *(uint32*)(ptr); + } +#endif uint32 FORCEINLINE READ_BE_UINT32(void *ptr) { byte *b = (byte*)ptr; @@ -140,7 +163,7 @@ uint32 FORCEINLINE READ_BE_UINT32(void *ptr) { #define READ_BE_UINT32_UNALIGNED READ_BE_UINT32 #define READ_BE_UINT16_UNALIGNED READ_BE_UINT16 -#define READ_UINT32_UNALIGNED(a) (*((uint32*)a)) +#define READ_UINT32_UNALIGNED(a) READ_LE_UINT32(a) #define FROM_LE_32(__a__) __a__ #define FROM_LE_16(__a__) __a__ |